Question and answer method and device, electronic equipment and medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING QIYI CENTURY SCI & TECH CO LTD
- Filing Date
- 2026-03-12
- Publication Date
- 2026-06-30
AI Technical Summary
The search engines of existing internet service platforms cannot perform optimally in all scenarios, resulting in complex queries failing to retrieve relevant information, while simple queries increase system costs and latency, affecting the quality of answers.
A routing model is used to dynamically allocate search engines in the search engine pool. By extracting feature information from the query text, the utility gain score of each search engine is calculated. The target search engine with the highest matching degree with the query text is selected for retrieval, and the answer is generated based on the target search engine.
It improved retrieval efficiency and resource utilization efficiency, enhanced the accuracy and comprehensiveness of information acquisition, and increased the accuracy of question and answer.
Smart Images

Figure CN122309656A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a question-and-answer method, apparatus, electronic device, and medium. Background Technology
[0002] Internet service platforms possess massive amounts of content; for example, video platforms offer a vast library of movies, TV shows, actor information, and plot summaries. Users need to search through this vast amount of content when accessing services offered by these platforms. The search queries or keywords users input have varying characteristics and complexities. Currently, these platforms employ a single search-enhanced generative architecture, using a fixed search engine or retriever to retrieve relevant information from a knowledge base. The same search strategy is applied to all types of queries, and the search results are directly input into a generative model to generate answers. However, different types of queries require different search strategies, and a fixed search engine or retriever cannot perform optimally in all scenarios. For example, complex queries may not retrieve relevant information, resulting in inconsistent search performance and affecting the quality of the final answer. For simple queries, a large language model can provide a better answer; unnecessary searches increase system costs and latency. Summary of the Invention
[0003] To solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, embodiments of the present invention provide a question-and-answer method, apparatus, electronic device, and medium.
[0004] In a first aspect, embodiments of the present invention provide a question-and-answer method, including: In response to receiving query text, extract the feature information of the query text; The identification information of each retrieval in the retrieval pool and the feature information of the query text are respectively input into the routing model as input data. The utility gain score corresponding to each retrieval output by the routing model is obtained. The utility gain score corresponding to each retrieval is used as the matching degree between the query text and each retrieval. The retrieval with the highest matching degree with the query text is used as the target retrieval. Based on the target search engine, the query text is retrieved from the first database to obtain the search results of the target search engine; Based on the search results of the target search engine, the answer text corresponding to the query text is generated.
[0005] Optionally, the routing model determines the utility gain score corresponding to each retriever according to the following process: The routing model transforms the identification information into a first feature vector and the feature information into a second feature vector. Based on the mapping relationship learned during the training phase, it determines the utility gain score corresponding to the vector group composed of the first feature vector and the second feature vector.
[0006] Optionally, the feature information of the query text includes one or more of the following: the length feature of the query text, the semantic feature of the query text, and the type feature of the query text; wherein, the length feature is used to characterize the number of lexical units included in the query text, the semantic feature is used to characterize the meaning expressed by the query text, and the type feature is used to characterize the probability that the query text belongs to each of the preset multiple query types.
[0007] Optionally, the length feature is determined according to the following process: the query text is segmented to determine the corresponding word units, and the number of corresponding word units is used as the length feature of the query text.
[0008] Optionally, the semantic features are determined according to the following process: inputting the query text as input data into a first language model, obtaining the semantic information output by the first language model, and using the semantic information as the semantic features of the query text.
[0009] Optionally, the type feature is determined according to the following process: inputting the query text as input data into a second language model, obtaining the probability distribution output by the second language model, and using the probability distribution as the type feature of the query text, wherein the probability distribution includes the probability that the query text belongs to each of a plurality of preset query types.
[0010] Optionally, the training method of the routing model further includes: constructing training data, the training data including historical query text and relative utility gain corresponding to each retrieval device, the relative utility gain being the label of the training data; and dividing the training data into multiple batches of training samples. In each round of training the routing model, at least one batch of training samples is input into the routing model as input data to obtain the predicted utility gain output by the routing model; based on the relative utility gain corresponding to each retrieval device, the predicted utility gain and a preset loss function, a loss value is calculated; based on the loss value, the parameters of the routing model are updated so that the routing model learns the mapping relationship between the historical query text and the tags; Training stops when the preset loss function converges or reaches the preset number of iterations, resulting in the trained routing model.
[0011] Optionally, the relative utility gain corresponding to the retrieval device is the difference between the retrieval device utility and the basic utility, wherein the retrieval device utility is the score of the answer text generated based on the retrieval results of the retrieval device and the historical query text, and the basic utility is the score of the answer text directly generated based on the historical query text. Optionally, the retrieval system includes at least one first retrieval system, which is either a sparse retrieval system or a dense retrieval system. Retrieving the query text based on the target retrieval device includes: if the target retrieval device is the sparse retrieval device, performing keyword retrieval on the query text based on the sparse retrieval device; or, if the target retrieval device is the dense retrieval device, performing semantic retrieval on the query text based on the dense retrieval device.
[0012] Optionally, the first retrieval unit may further include a retrieval unit constructed based on the sparse retrieval unit and the ranking model, and a retrieval unit constructed based on the dense retrieval unit and the ranking model, wherein the ranking model is used to rank the retrieval results.
[0013] Optionally, the ranking model includes a first ranking model and / or a second ranking model. The first ranking model is used to rank the results based on the relevance score between the search results and the query text, and the second ranking model is used based on the relevance score between the search results and the query text, as well as the difference score between the current candidate search results and the selected search results.
[0014] Optionally, the searcher further includes a second searcher, the search scope of which is configured to be an empty database or a sub-database of the first database; Based on the target searcher, the query text is retrieved in the first database to obtain the search results of the target searcher, including: if the target searcher is a second searcher, the query text is retrieved in the sub-database to obtain the search results of the second searcher, or the query text is retrieved in the empty database to obtain the search results of the second searcher, wherein the search results of the second searcher are empty.
[0015] Secondly, embodiments of the present invention provide a question-and-answer device, comprising: The feature extraction module is used to extract feature information of the query text in response to receiving the query text; The matching module is used to input the identification information of each retrieval in the retrieval pool and the feature information of the query text into the routing model as input data, obtain the utility gain score corresponding to each retrieval output by the routing model, use the utility gain score corresponding to each retrieval as the matching degree between the query text and each retrieval, and use the retrieval with the highest matching degree with the query text as the target retrieval. The retrieval module is used to retrieve the query text from the first database based on the target retrieval tool and obtain the retrieval results of the target retrieval tool. The answer generation module is used to generate the answer text corresponding to the query text based on the search results of the target searcher.
[0016] Optionally, the feature extraction module is further configured to: perform word segmentation on the query text, determine the word units corresponding to the query text, and use the number of word units corresponding to the query text as the length feature of the query text.
[0017] Optionally, the feature extraction module is further configured to: input the query text as input data into a first language model, obtain the semantic information output by the first language model, and use the semantic information as the semantic features of the query text.
[0018] Optionally, the feature extraction module is further configured to: input the query text as input data into a second language model, obtain the type probability output by the second language model, and use the type probability as the type feature of the query text.
[0019] Optionally, the device further includes a training module for: Construct training data, which includes historical query texts and relative utility gains corresponding to each retrieval device, wherein the relative utility gains are the labels of the training data; divide the training data into multiple batches of training samples; in each round of training the routing model, input at least one batch of training samples as input data into the routing model to obtain the predicted utility gains output by the routing model; calculate the loss value based on the relative utility gains corresponding to each retrieval device, the predicted utility gains, and a preset loss function; update the parameters of the routing model based on the loss value so that the routing model learns the mapping relationship between the historical query texts and the labels; stop training when the preset loss function tends to converge or reaches a preset number of iterations, and obtain the trained routing model.
[0020] Optionally, the training module is further configured to: determine the score of the answer text on multiple evaluation dimensions, calculate the weighted sum of the scores of the answer text on multiple evaluation dimensions, and use the weighted sum as the score of the answer text; wherein the evaluation dimensions include one or more of the following: factual accuracy, completeness, and fluency.
[0021] Optionally, the retrieval system includes at least one first retrieval system, which is either a sparse retrieval system or a dense retrieval system. The retrieval module is used to: perform keyword retrieval on the query text based on the sparse retrieval when the target retrieval is the sparse retrieval; or, perform semantic retrieval on the query text based on the dense retrieval when the target retrieval is the dense retrieval.
[0022] Optionally, the searcher further includes a second searcher, the search scope of which is configured to be an empty database or a sub-database of the first database; The retrieval module is used to: when the target retrieval is the second retrieval, retrieve the query text in the sub-database to obtain the retrieval results of the second retrieval, or retrieve the query text in the empty database to obtain the retrieval results of the second retrieval, wherein the retrieval results of the second retrieval are empty.
[0023] Thirdly, embodiments of the present invention provide an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the question-and-answer method provided in any embodiment of the present invention when executing the program stored in the memory.
[0024] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the question-and-answer method provided in any embodiment of the present invention.
[0025] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects: The question-answering method provided in this embodiment of the invention, in response to receiving query text, extracts the feature information of the query text, and determines the target retrieval machine with the highest matching degree with the query text from multiple retrieval machines based on the feature information of the query text, thereby obtaining the retrieval strategy that best matches the query text, retrieving the query text based on the target retrieval machine, obtaining retrieval results, and generating answer text corresponding to the query text based on the retrieval results of the target retrieval machine; wherein, when determining the target retrieval machine, the identification information of each retrieval machine in the retrieval machine pool and the feature information of the query text are respectively input into the routing model as input data, the utility gain score corresponding to each retrieval machine output by the routing model is obtained, the utility gain score corresponding to each retrieval machine is used as the matching degree between the query text and each retrieval machine, and the retrieval machine with the highest matching degree with the query text is taken as the target retrieval machine. This method provides multiple search engines, each with a different search strategy. Different search strategies are suitable for different types of query text. Using the appropriate search engine not only improves search efficiency and optimizes resource utilization but also enhances the accuracy and comprehensiveness of information retrieval. By matching the query text's feature information with multiple search engines, the matching degree between the query text and each search engine is determined. The search strategy provided by the search engine with the highest matching degree is most suitable for the query text. Searching the query text using the search engine with the highest matching degree yields accurate search results, thereby improving the quality of the answers generated based on these accurate search results and increasing the accuracy of question answering. Attached Figure Description
[0026] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.
[0027] Figure 1 A flowchart illustrating a question-and-answer method according to an embodiment of the present invention is shown; Figure 2 A flowchart illustrating a question-and-answer method according to another embodiment of the present invention is shown; Figure 3 A schematic diagram illustrating the routing model training process according to an embodiment of the present invention is shown; Figure 4 A block diagram of a question-and-answer device according to an embodiment of the present invention is shown; Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention is shown. Detailed Implementation
[0028] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of the present invention, including various details to aid understanding. These details should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the invention. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0029] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character "=" generally indicates that the preceding and following objects have an "or" relationship.
[0030] Figure 1 A flowchart illustrating a question-and-answer method according to an embodiment of the present invention is shown. Figure 1 As shown, this question-and-answer method includes: Step S101: In response to receiving the query text, extract the feature information of the query text.
[0031] In optional embodiments, this question-and-answer method can be applied to an intelligent customer service system or an intelligent search engine. Users can input query text through a visual interactive interface provided by the intelligent customer service system or the intelligent search engine. For example, query text can be input through the search box displayed on the visual interactive interface, or a voice query can be input through the voice interface provided by the visual interactive interface. Upon receiving the voice query, the intelligent customer service system or the intelligent search engine performs speech recognition processing and converts it into query text. Optionally, the query text can be a relatively complete query sentence, such as "Who are the main actors in a certain TV series?", or it can be one or more query terms, such as "Wang xx (actor's name)". This invention does not impose any limitations on this.
[0032] After receiving the user's query text, feature information of the query text can be extracted using feature extraction networks such as recurrent neural networks, convolutional neural networks, or Transformer models (deep learning architectures based on self-attention mechanisms). For example, feature vectors of the query text can be extracted using a Transformer model. Optionally, the feature information of the query text may include length features (e.g., the length of the query text), semantic features, etc.
[0033] Step S102: Input the identification information of each retrieval in the retrieval pool and the feature information of the query text into the routing model as input data, obtain the utility gain score corresponding to each retrieval output by the routing model, use the utility gain score corresponding to each retrieval as the matching degree between the query text and each retrieval, and take the retrieval with the highest matching degree with the query text as the target retrieval.
[0034] A retrieval tool is used to retrieve content related to a query text from a specified database. Optionally, this embodiment provides various retrieval tools with different characteristics, such as sparse retrieval tools, dense retrieval tools, and variant retrieval tools processed with different optimization strategies, providing different retrieval strategies through different retrieval tools. For example, a sparse retrieval tool can be a keyword-matching based retrieval tool, which can perform retrieval using the BM25 algorithm (Best Matching 25, an algorithm for information retrieval and text mining that calculates the similarity between query text and documents in the database based on the degree of keyword matching between the query text and documents). Sparse retrieval tools can be used to handle exact matches and factual queries, and can quickly locate documents containing specific entities or facts. Factual queries refer to queries that seek specific, explicit, and verifiable factual information. Factual queries usually have standard answers and require exact matching of specific keywords or entity information. For example: "Who is the director of a certain TV series?", "When will the second season of a certain TV series be released?". The characteristic of factual queries is that the answers are relatively fixed, and documents containing accurate factual information can be quickly retrieved from the knowledge base.
[0035] Dense search engines are semantic search engines based on vector models. They retrieve content based on the similarity between the vectors corresponding to the query text and the vectors corresponding to documents in the database. This allows them to understand the deeper meaning of the query text and retrieve semantically relevant content. Dense search engines can handle both semantic retrieval and conceptual queries. Conceptual queries seek explanations of concepts, subjective evaluations, or queries that require understanding and reasoning. Conceptual queries often lack standard answers and require retrieval of relevant information based on semantic understanding and conceptual associations. Examples include: "Analyze the personality traits of the main character in a TV series" or "How would you evaluate the artistic value of a TV series?". The characteristics of conceptual queries are the need for semantic understanding and conceptual reasoning; the answers may vary from person to person, requiring the retrieval of documents that support different viewpoints or provide comprehensive information.
[0036] The embodiments of the present invention provide a variety of search engines with different characteristics to provide a variety of search strategy options with different characteristics, such as sparse search based on keyword matching, dense search based on semantic understanding, and variant search engines processed by different optimization strategies, thereby providing the most suitable search strategy for different types of queries and improving the system's adaptability to query diversity.
[0037] The routing model dynamically assigns a retrieval tool to the query text, thus providing the most suitable retrieval strategy for that query text. The routing model transforms the retrieval tool's identifier information into a first feature vector and the query text's feature information into a second feature vector, based on the mapping relationship learned during the training phase (see the training process of the routing model for details). Figure 3 In the illustrated embodiment, the utility gain score corresponding to the vector group consisting of the first feature vector and the second feature vector is determined. This utility gain score serves as the matching degree between the query text and each search engine (or, in other words, the matching degree between the query text and the search strategy provided by each search engine). The higher the utility gain score, the higher the matching degree between the search engine and the query text. In this embodiment, the search engine with the highest matching degree with the query text is selected as the target search engine.
[0038] Step S103: Based on the target searcher, retrieve the query text in the first database and obtain the search results of the target searcher.
[0039] After selecting the target search engine with the highest match degree to the query text from multiple search engines, the target search engine is invoked to perform a search in the first database to obtain the search results of the target search engine. Optionally, the first database may be a designated database corresponding to the technical field or application scenario to which this application embodiment pertains, and the designated database includes knowledge, data, or literature data of that technical field or application scenario. Alternatively, the first database may include not only the database corresponding to the designated technical field or application scenario, but also publicly available data sets on the Internet.
[0040] Step S104: Based on the search results of the target search engine, generate the answer text corresponding to the query text.
[0041] For example, the query text and the retrieval results of the target retrieval machine are input into the Large Language Model (a deep learning model trained on a large amount of text data, which enables the model to generate natural language text), and the Large Language Model is used to generate the answer text corresponding to the query text.
[0042] The question-answering method of this invention provides multiple search engines, each with a different search strategy. Different search strategies are suitable for different types of query text. Using a suitable search engine not only improves search efficiency and optimizes resource utilization, but also enhances the accuracy and comprehensiveness of information retrieval. By matching the query text's feature information with multiple search engines, the matching degree between the query text and each search engine is determined. The search strategy provided by the search engine with the highest matching degree is most suitable for the query text. Searching the query text using the search engine with the highest matching degree yields accurate search results, thereby improving the quality of the answers generated based on these accurate search results and increasing the accuracy of question-answering.
[0043] Optionally, the feature information extracted from the query text in this embodiment of the invention includes the length feature of the query text. The length feature is used to characterize the number of tokens included in the query text. For example, the query text is segmented, and the number of tokens included in the segmented query text is used as the length feature of the query text.
[0044] Optionally, the feature information extracted from the query text in this embodiment of the invention includes semantic features of the query text. Semantic features are used to characterize the meaning expressed by the query text. For example, the query text is input into a first language model as input data, and the semantic information output by the first language model is obtained. This semantic information is then used as the semantic features of the query text.
[0045] Optionally, the feature information extracted from the query text in this embodiment of the invention includes the type feature of the query text. For example, the type of the query text is analyzed by a pre-trained text classifier, and the probability distribution output by the text classifier is used as the type feature of the query text. The probability distribution output by the text classifier includes the probability that the query text belongs to each of a set of preset query types (i.e., the probability that the query text belongs to each query type).
[0046] As optional examples, the preset query types in this embodiment of the invention include, but are not limited to: keyword query type, natural language question type, compound query, factual query, conceptual query, and recommendation query. Keyword query type query text consists of short combinations of keywords, lacking a complete grammatical structure. For example, "Zhang xx movies", "historical drama 2023", "romantic comedy". Keyword query type query text is suitable for sparse search engines. Natural language question type query text consists of complete natural language sentences with a clear grammatical structure. For example, "What movies has Zhang xx recently filmed?" "Any good historical dramas recommended?" Natural language question type query text is suitable for both sparse and dense search engines. Compound query type query text refers to complex queries containing multiple subqueries or multiple conditions. For example, "What movies have Zhang xx and Yi xx collaborated on, and what are their ratings?" Factual query type refers to queries seeking specific and accurate factual information. For example, "Who is the director of a certain TV series?" Conceptual query type refers to queries seeking conceptual explanations, subjective evaluations, or queries requiring understanding and reasoning. Conceptual query type query text is suitable for dense search engines. Recommendation query refers to queries seeking recommendations. For example, "What movies are suitable for the whole family to watch together?"
[0047] In an optional embodiment, the length feature, semantic feature, and / or type feature of the query text can be combined as the feature information of the query text. For example, the feature information of the query text is: [query length, semantic vector dimension 1, ..., semantic vector dimension N, type probability 1, ..., type probability M].
[0048] Optionally, the retrieval system in this embodiment of the invention includes at least one first retrieval system. The first retrieval system is either a sparse retrieval system or a dense retrieval system.
[0049] Sparse search engines can be keyword-matching based, utilizing the BM25 algorithm (BestMatching 25, an algorithm for information retrieval and text mining that calculates the similarity between query text and documents in a database based on keyword matching). Sparse search engines can handle exact matches and factual queries, quickly locating documents containing specific entities or facts. Factual queries seek specific, explicit, and verifiable factual information. They typically have standard answers and require exact matching of specific keywords or entity information. Examples include: "Who is the director of a certain TV series?" and "When will the second season of a certain TV series be released?". A key characteristic of factual queries is that the answers are relatively fixed, allowing for rapid retrieval of documents containing accurate factual information from a knowledge base.
[0050] Dense search engines are semantic search engines based on vector models. They retrieve content based on the similarity between the vectors corresponding to the query text and the vectors corresponding to documents in the database. This allows them to understand the deeper meaning of the query text and retrieve semantically relevant content. Dense search engines can be used to handle semantic retrieval and conceptual queries. Conceptual queries seek explanations of concepts, subjective evaluations, or queries that require understanding and reasoning. Conceptual queries often lack standard answers and require retrieval of relevant information based on semantic understanding and conceptual associations. Examples include: "Analyze the personality traits of the main character in a TV series" or "How would you evaluate the artistic value of a TV series?". The characteristics of conceptual queries are that they require semantic understanding and conceptual reasoning; the answers may vary from person to person, and documents that support different viewpoints or provide comprehensive information need to be retrieved.
[0051] Optionally, the first retrieval unit further includes a retrieval unit constructed based on the sparse retrieval unit and ranking model, and a retrieval unit constructed based on the dense retrieval unit and ranking model, wherein the ranking model is used to rank the retrieval results. The retrieval unit constructed based on the sparse retrieval unit and ranking model is a two-stage retrieval unit combining keyword matching and ranking. It first recalls retrieval results based on keyword matching, and then re-ranks the retrieval results using the ranking model. The retrieval unit constructed based on the dense retrieval unit and ranking model is a two-stage retrieval unit integrating semantic understanding and ranking. It first recalls retrieval results based on semantic vectors, and then re-ranks the retrieval results using the ranking model. Both the retrieval unit constructed based on the sparse retrieval unit and ranking model and the retrieval unit constructed based on the dense retrieval unit and ranking model can improve the relevance and accuracy of the final results while ensuring retrieval efficiency through the ranking model.
[0052] Optionally, the ranking model includes a first ranking model and / or a second ranking model, wherein the first ranking model ranks the results based on the relevance score between the search results and the query text, and the second ranking model ranks the results based on the relevance score between the search results and the query text and the difference score between the current candidate search results and the selected search results.
[0053] The first ranking model sorts search results based on their relevance scores to the query text, used for precision reordering. It receives initial search results and query text, calculates the relevance score of each result to the query text, and sorts them in descending order of relevance score. This first ranking model retains the most relevant search results to the query text, filters out noise, and is suitable for factual queries requiring precise answers.
[0054] Precision Reordering: A specialized precision reordering model is invoked, designed to improve the accuracy of search results. The first ranking model receives the query text and a list of candidate documents, and performs deep semantic matching calculations on each query-document pair. Correlation calculation example: Search: "Which movies has Zhang XX starred in?"
[0055] Document 1: "The movie 'xxxx' starring Zhang xx was released in 2018."
[0056] Document 2: "Zhang xx is a member of xx, and also an actor and singer."
[0057] The first ranking model outputs: Document 1 relevance score 0.92, Document 2 relevance score 0.65.
[0058] Reordering results: Prioritize returning document 1 that directly answers the question.
[0059] The second ranking model sorts search results based on their relevance to the query text and their differences from existing search results (e.g., search results with differences less than a specified threshold are considered similar to existing results and filtered out during ranking), for diversity reordering. This second ranking model increases diversity while maintaining relevance. When selecting documents, it considers both relevance to the query and differences from existing results, avoiding over-concentration of results on a single topic or perspective. The model calculates not only query-document relevance but also differences between documents. Example of difference calculation: Search query: "Recommend a few Qing Dynasty dramas similar to 'xxxx'".
[0060] Candidate documents: Document A: "xxx is a classic palace intrigue drama" (relevance 0.88).
[0061] Document B: "《xxx》tells the story of the harem of Emperor xx" (relevance 0.85).
[0062] Document C: "《xxx》 tells the story of xx from an innocent girl to the Empress Dowager in the complex environment of the harem" (correlation 0.87).
[0063] The second sorting model is calculated as follows: Document A and Document C have a similarity of 0.75 (both are about xxx).
[0064] Document A and Document B have a similarity of 0.45 (different TV series).
[0065] Reordering results: Select document A and document B, filter out document C which is duplicated with document A but has a low relevance score, and ensure that the recommended results cover different series.
[0066] Optionally, the searcher in this embodiment of the application further includes a second searcher. The search scope of the second searcher is smaller than that of the first searcher. The search scope of the second searcher is an empty database or a sub-database of the first database.
[0067] In this embodiment, when the target retrieval tool is determined to be a second retrieval tool, if the retrieval scope of the second retrieval tool is configured as a sub-database, the query text is retrieved in the sub-database to obtain the retrieval results of the second retrieval tool. If the retrieval scope of the second retrieval tool is configured as an empty database, the query text is retrieved in the empty database, and the retrieval results of the second retrieval tool are empty. As an optional example, the sub-database can be an internal knowledge base associated with the large language model. When the target retrieval tool is the second retrieval tool, retrieval is only performed in the internal knowledge base, without needing to retrieve external information, effectively reducing the retrieval scope, thereby shortening the retrieval time, reducing retrieval costs, and lowering system latency. When the retrieval scope of the second retrieval tool is configured as an empty database, retrieval in the empty database is equivalent to skipping the retrieval step, further reducing system latency and saving resources. When the retrieval scope of the second retrieval tool is configured as an empty database, the large language model generates answers based on the knowledge and patterns learned during its training process.
[0068] Figure 2 A schematic diagram illustrating the routing model training process according to an embodiment of the present invention is shown. Figure 2 As shown, the process of training the routing model includes: Step S201: Obtain historical query text.
[0069] Step S202: Obtain the feature information corresponding to the historical query text. For example, obtain one or more of the following features: length, semantics, and type.
[0070] Step S203: For each search engine, use that search engine to search the historical query text and obtain the search results of that search engine.
[0071] Step S204: Generate answer text based on the search results of the search engine.
[0072] Step S205: Score the answer text.
[0073] Optionally, the scores of the answer text on multiple evaluation dimensions are determined, and a weighted sum of the scores on these dimensions is calculated. This weighted sum is then used as the score of the answer text. The evaluation dimensions include one or more of the following: factual accuracy (for evaluating the correctness of the answer text), completeness (for evaluating the comprehensiveness of the answer text), and fluency (for evaluating the naturalness of the answer text). As an optional example, answer texts corresponding to historical query texts can be manually evaluated to determine the scores of that portion of the answer text on each evaluation dimension (such as factual accuracy, completeness, and fluency). Alternatively, only answer texts corresponding to a portion of historical query texts can be manually evaluated. The manually evaluated historical query texts can then be used as samples to train an answer quality assessment model, which is then used to evaluate the scores of the remaining historical query texts on each evaluation dimension. The process of training the answer quality assessment model includes, for example, using the scores of historical query texts rated by human reviewers on each evaluation dimension as labels for the historical query texts, using (historical query text, answer text, labels) as samples, and using MES loss (Mean Squared Error Loss) as the loss function to train a natural language processing model (e.g., Transformer (a model based on attention mechanism), GPT-4 (a large language model)) until the training stopping condition is met (e.g., the loss function converges or the specified number of training iterations is reached).
[0074] Step S206: Calculate the relative utility gain of each retrieval tool based on the scores of the answer texts corresponding to each retrieval tool. The relative utility gain of a retrieval tool is the difference between its utility and its base utility. The relative utility gain characterizes the matching degree between historical query texts and each retrieval tool (or the matching degree between historical query texts and the retrieval strategies provided by each retrieval tool). A higher relative utility gain indicates a higher matching degree between historical query texts and retrieval tools. Retrieval tool utility is the score of the answer text generated based on the retrieval tool's search results and historical query texts. Base utility is the score of the answer text directly generated based on historical query texts. Generating answers directly based on historical query texts relies on the knowledge and patterns learned during the training of the large language model, while generating answers based on search results and historical query texts combines comprehensive and recent data retrieved from a specified database or the internet to support the generation process. This retrieval enhancement method can improve the accuracy and interpretability of the answers (e.g., explaining the causal logic of the answer based on the search results). As an optional example, the calculation of the relative utility gain of a retrieval tool is illustrated using a sparse retrieval tool as an example, as shown below: User query: "Who is the lead actor in 'xxxx'?" Regarding basic utility: Step 1: The large language model generates the answer based on its internal knowledge: "The main actors in 'xxxx' include Wu xx, Qin xx, Nie xx, etc." Step 2: Use an answer quality assessment model to score the generated answers. The assessment dimensions include: Factual accuracy: Is the answer correct? (Score: 0.9, mostly correct but incomplete) Completeness: Is the information comprehensive? (Score: 0.7, missing role correspondence) Fluency: How natural is the expression (Score: 0.9, fluent expression) Step 3: Utility Score Calculation: Basic utility = (Factual accuracy × 0.5 + Completeness × 0.3 + Fluency × 0.2) = (0.9 × 0.5 + 0.7 × 0.3 + 0.9 × 0.2) = 0.45 + 0.21 + 0.18 = 0.84 The calculation process for the retrieval utility of a sparse retrieval system includes: Step 1: The sparse search engine retrieves relevant documents from the specified knowledge base: Document 1: Cast list for "xxxx", including detailed information such as Wu xx as Wei xx, Qin xx as the Empress, and Nie xx as the Emperor.
[0075] Document 2: Synopsis of "xxxxx"
[0076] Document 3: Information on other works by the relevant actors.
[0077] Step 2: Generate answers by combining the searched documents.
[0078] Input: User query + retrieved document content.
[0079] The large-scale language model generated the answer: "The main cast of 'xxxx' includes: Wu xx as Wei xx, Qin xx as the Empress, Nie xx as the Emperor, She xx as the Concubine, Xu xx as the Grand Scholar, etc." Step 3: Use an answer quality assessment model to score the generated answers. The assessment dimensions include: Factual accuracy: The answer is completely correct (Score: 1.0) Completeness: Provided the main actors and their corresponding roles (Score: 0.95) Fluency: The expression is natural and fluent (score: 0.9) Step 4: Utility Score Calculation: Search engine utility = (fact accuracy × 0.5 + completeness × 0.3 + fluency × 0.2) = (1.0 × 0.5 + 0.95 × 0.3 + 0.9 × 0.2) = 0.5 + 0.285 + 0.18 = 0.965 The relative utility gain of the sparse searcher is 0.965 - 0.84 = 0.125.
[0080] Step S207: Construct training data. The training data includes historical query text, feature vectors of the historical query text, and relative utility gains corresponding to each retrieval device. The relative utility gains are the labels of the training data. The relative utility gain corresponding to each retrieval device is the difference between the retrieval device's utility and the base utility. The retrieval device's utility is the score of the answer text generated based on the retrieval device's search results and the historical query text. The base utility is the score of the answer text directly generated based on the historical query text.
[0081] Step S208: Train the initial routing model based on the training data to obtain the trained routing model.
[0082] In each round of training the routing model, at least one batch of training samples is input into the model to obtain the predicted utility gain of the model's output. The loss value is calculated based on the relative utility gain and predicted utility gain of each retrieval device, and a preset loss function. For example, the preset loss function is: Where max represents taking the larger value between, summation represents summing the larger values corresponding to each retrieval unit, and min represents minimization, that is, the training objective is for the loss function to converge.
[0083] Based on the loss value, the parameters of the routing model are updated so that the model learns the mapping relationship between historical query text and tags. For example, the gradient boosting decision tree algorithm can be used to update the parameters of the routing model.
[0084] Training stops when the preset loss function converges or reaches the preset number of iterations, resulting in the trained routing model.
[0085] Optionally, the initial routing model can be a Recurrent Neural Network (RNN), a Transformer (a deep learning model based on an attention mechanism), or BERT (Bidirectional Encoder Representations from Transformers).
[0086] In this embodiment of the invention, a relative utility gain metric is proposed when training the routing model. This metric directly evaluates the retrieval system's performance based on the quality of the final answer, overcoming the limitations of traditional retrieval evaluation methods. It achieves direct alignment between retrieval optimization and generation quality, significantly improving the overall performance of the question-answering system. The routing model is trained to directly optimize downstream generation tasks, rather than using traditional retrieval metrics, achieving optimal matching of query and retrieval strategies and avoiding the limitations of traditional heuristic methods.
[0087] Figure 3 A flowchart illustrating a question-and-answer method according to another embodiment of the present invention is shown. Figure 3 As shown, this question-and-answer method includes: Step S301: Receive query text.
[0088] Step S302: Perform word segmentation on the query text, determine the word units corresponding to the query text, and use the number of word units corresponding to the query text as the length feature of the query text.
[0089] Step S303: Input the query text as input data into the first language model, obtain the semantic information output by the first language model, and use the semantic information as the semantic features of the query text.
[0090] Step S304: Input the query text as input data into the second language model, obtain the probability distribution output by the second language model, and use the probability distribution as the type feature of the query text.
[0091] Step S305: Combine the length features, semantic features, and type features of the query text to obtain the feature information of the query text.
[0092] Step S306: Input the feature information of the query text into the routing model as input data, obtain the utility gain score corresponding to each retrieval machine output by the routing model, and use the utility gain score corresponding to each retrieval machine as the matching degree between the query text and each retrieval machine. Select the retrieval machine with the highest matching degree with the query text as the target retrieval machine.
[0093] As an optional example, embodiments of the present invention include seven retrievers, namely: Retrieval R0 (Second Retrieval): The retrieval scope is an empty database. That is, when the feature information of the query text is matched to this retrieval maker, the retrieval step is skipped.
[0094] Searcher R1 (first searcher): sparse searcher.
[0095] Retrieval R2 (first retrieval): It consists of a sparse retrieval and a first ranking model.
[0096] Retrieval R3 (first retrieval): It consists of a sparse retrieval and a second ranking model.
[0097] Searcher R4 (First Searcher): Dense Searcher.
[0098] Search engine R5 (first search engine): It consists of a dense search engine and a first ranking model.
[0099] Search engine R6 (first search engine): It consists of a dense search engine and a second ranking model.
[0100] The seven search engines provided in this embodiment are search engines with different characteristics. For example, search engines R3 and R6 are variant search engines based on sparse search engines, dense search engines, and processed by different optimization strategies (such as ranking strategies provided by different ranking models). Different search engines provide different retrieval strategies. For example, sparse search engines can be used to handle exact matches and factual queries, quickly locating documents containing specific entities or facts. The first ranking model sorts the search results based on their relevance scores to the query text for accuracy reordering. For search engine R3, the sparse search engine performs keyword searches on the query text and obtains initial search results. The first ranking model calculates the relevance score of each search result to the query text based on the initial search results obtained by the sparse search engine and the query text, and sorts the initial search results in descending order of relevance scores to obtain the final search results. The final search results output by search engine R3 retain the most relevant search results to the query text, filtering out noise information. Search engine R3 is suitable for factual queries requiring precise answers. Dense search engines can be used to handle semantic and conceptual queries. The dense search engine can handle query texts with conceptual query types. The second ranking model sorts the results based on their relevance scores to the query text and the difference scores between the current candidate search results and the selected search results, for diversity reordering. For search engine R6, the dense search engine obtains initial search results based on the semantic vector of the query text. The second ranking model, based on the initial search results obtained by the dense search engine and the query text, sorts the initial search results according to the relevance scores of each search result to the query text and the difference scores between the current candidate search results and the selected search results, thus obtaining the final search results. Compared to search engine R3, search engine R6 not only outputs search results in descending order of relevance scores but also filters out similar search results (e.g., filtering out similar search results based on the difference scores between candidate search results and the selected search results), preventing the output search results from being overly concentrated on a single topic or angle.
[0101] The embodiments of the present invention provide a variety of search engines with different characteristics to provide a variety of search strategy options with different characteristics, such as sparse search based on keyword matching, dense search based on semantic understanding, and variant search engines processed by different optimization strategies, thereby providing the most suitable search strategy for different types of queries and improving the system's adaptability to query diversity.
[0102] Step S307: If the target searcher is searcher R0, directly generate the answer text based on the query text.
[0103] Step S308: If the target searcher is one of searchers R1 to R6, the query text is searched based on the target searcher to obtain the search results of the target searcher, and the answer text corresponding to the query text is generated based on the search results of the target searcher.
[0104] In this embodiment of the invention, the target retrieval device with the highest matching degree with the query text is used to obtain accurate retrieval results. Based on the retrieval results, the answer is generated, which improves the quality and accuracy of the answer. Moreover, the method uses "no retrieval" as one of the routing options, and the system can intelligently determine whether external information is needed, reduce unnecessary retrieval operations, reduce system latency and computing costs, and improve user experience.
[0105] Figure 4 A schematic diagram of the question-and-answer device according to an embodiment of the present invention is shown. Figure 4 As shown, the question-and-answer device 400 includes: Feature extraction module 401 is used to extract feature information of the query text in response to receiving the query text; The matching module 402 is used to input the identification information of each retrieval in the retrieval pool and the feature information of the query text into the routing model as input data, obtain the utility gain score corresponding to each retrieval output by the routing model, use the utility gain score corresponding to each retrieval as the matching degree between the query text and each retrieval, and use the retrieval with the highest matching degree with the query text as the target retrieval. The retrieval module 403 is used to retrieve the query text from the first database based on the target retrieval tool and obtain the retrieval results of the target retrieval tool. The answer generation module 404 is used to generate the answer text corresponding to the query text based on the search results of the target searcher.
[0106] Optionally, the feature extraction module is further configured to: perform word segmentation on the query text, determine the word units corresponding to the query text, and use the number of word units corresponding to the query text as the length feature of the query text.
[0107] Optionally, the feature extraction module is further configured to: input the query text as input data into a first language model, obtain the semantic information output by the first language model, and use the semantic information as the semantic features of the query text.
[0108] Optionally, the feature extraction module is further configured to: input the query text as input data into a second language model, obtain the type probability output by the second language model, and use the type probability as the type feature of the query text.
[0109] Optionally, the matching module is further configured to: input the feature information of the query text as input data into the routing model, obtain the utility gain score corresponding to each retrieval machine output by the routing model, and use the utility gain score corresponding to each retrieval machine as the matching degree between the query text and each retrieval machine.
[0110] Optionally, the device further includes a training module for: Construct training data, which includes historical query texts and relative utility gains corresponding to each retrieval device, wherein the relative utility gains are the labels of the training data; divide the training data into multiple batches of training samples; in each round of training the routing model, input at least one batch of training samples as input data into the routing model to obtain the predicted utility gains output by the routing model; calculate the loss value based on the relative utility gains corresponding to each retrieval device, the predicted utility gains, and a preset loss function; update the parameters of the routing model based on the loss value so that the routing model learns the mapping relationship between the historical query texts and the labels; stop training when the preset loss function tends to converge or reaches a preset number of iterations, and obtain the trained routing model.
[0111] Optionally, the training module is further configured to: determine the score of the answer text on multiple evaluation dimensions, calculate the weighted sum of the scores of the answer text on multiple evaluation dimensions, and use the weighted sum as the score of the answer text; wherein the evaluation dimensions include one or more of the following: factual accuracy, completeness, and fluency.
[0112] Optionally, the retrieval system includes at least one first retrieval system, which is either a sparse retrieval system or a dense retrieval system. The retrieval module is used to: perform keyword retrieval on the query text based on the sparse retrieval when the target retrieval is the sparse retrieval; or, perform semantic retrieval on the query text based on the dense retrieval when the target retrieval is the dense retrieval.
[0113] Optionally, the searcher further includes a second searcher, the search scope of which is configured to be an empty database or a sub-database of the first database; the search module is used to: when the target searcher is the second searcher, search the query text in the sub-database to obtain the search results of the second searcher, or, search the query text in the empty database to obtain the search results of the second searcher, wherein the search results of the second searcher are empty.
[0114] The question-answering device provided in this embodiment of the invention, in response to receiving query text, extracts the feature information of the query text, and determines the target retrieval device with the highest matching degree with the query text from multiple retrieval devices based on the feature information of the query text, thereby obtaining the retrieval strategy that best matches the query text. The query text is then searched based on the target retrieval device to obtain search results, and the answer text corresponding to the query text is generated based on the search results of the target retrieval device. This method obtains accurate search results by using the target retrieval device with the highest matching degree with the query text, and generates answers based on these search results, thereby improving the quality and accuracy of the answers and significantly enhancing the overall performance of the question-answering system.
[0115] The above-described apparatus can execute the method provided in the embodiments of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the question-and-answer method provided in the embodiments of the present invention.
[0116] Figure 5 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention is shown. For example... Figure 5 As shown, the electronic device includes: The system includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504. The processor 501, communication interface 502, and memory 503 communicate with each other via the communication bus 504. Memory 503 is used to store computer programs; When processor 501 executes the program stored in memory 503, it performs the following steps: In response to receiving query text, extract the feature information of the query text; The identification information of each retrieval in the retrieval pool and the feature information of the query text are respectively input into the routing model as input data. The utility gain score corresponding to each retrieval output by the routing model is obtained. The utility gain score corresponding to each retrieval is used as the matching degree between the query text and each retrieval. The retrieval with the highest matching degree with the query text is used as the target retrieval. Based on the target search engine, the query text is retrieved from the first database to obtain the search results of the target search engine; Based on the search results of the target search engine, the answer text corresponding to the query text is generated.
[0117] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0118] The communication interface is used for communication between the aforementioned terminal and other devices.
[0119] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0120] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0121] In another embodiment of the present invention, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the question-and-answer methods described in the above embodiments.
[0122] In another embodiment of the present invention, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the question-and-answer methods described in the above embodiments.
[0123] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0124] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0125] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0126] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.
Claims
1. A question-and-answer method, characterized in that, include: In response to receiving query text, extract the feature information of the query text; The identification information of each retrieval in the retrieval pool and the feature information of the query text are respectively input into the routing model as input data. The utility gain score corresponding to each retrieval output by the routing model is obtained. The utility gain score corresponding to each retrieval is used as the matching degree between the query text and each retrieval. The retrieval with the highest matching degree with the query text is used as the target retrieval. Based on the target search engine, the query text is retrieved from the first database to obtain the search results of the target search engine; Based on the search results of the target search engine, the answer text corresponding to the query text is generated.
2. The method according to claim 1, characterized in that, The routing model determines the utility gain score for each retriever according to the following process: The routing model transforms the identification information into a first feature vector and the feature information into a second feature vector. Based on the mapping relationship learned during the training phase, it determines the utility gain score corresponding to the vector group composed of the first feature vector and the second feature vector.
3. The method according to claim 1 or 2, characterized in that, The feature information of the query text includes one or more of the following: the length feature of the query text, the semantic feature of the query text, and the type feature of the query text; wherein, the length feature is used to characterize the number of words included in the query text, the semantic feature is used to characterize the meaning expressed by the query text, and the type feature is used to characterize the probability that the query text belongs to each of the preset query types.
4. The method according to claim 3, characterized in that, The length feature is determined according to the following process: The query text is segmented to determine the corresponding word units, and the number of corresponding word units is used as the length feature of the query text.
5. The method according to claim 3, characterized in that, The semantic features are determined according to the following process: The query text is input into a first language model, and the semantic information output by the first language model is obtained. The semantic information is then used as the semantic features of the query text.
6. The method according to claim 3, characterized in that, The type characteristics are determined according to the following process, including: The query text is input into the second language model as input data, and the probability distribution output by the second language model is obtained. The probability distribution is used as the type feature of the query text, and the probability distribution includes the probability that the query text belongs to each of the preset multiple query types.
7. The method according to claim 1 or 2, characterized in that, The training methods for the routing model include: Construct training data, which includes historical query texts and relative utility gains corresponding to each search engine. The relative utility gains are the labels of the training data and are used to characterize the matching degree between historical query texts and search engines. Divide the training data into multiple batches of training samples. In each round of training the routing model, at least one batch of training samples is input into the routing model as input data to obtain the predicted utility gain output by the routing model; based on the relative utility gain corresponding to each retrieval device, the predicted utility gain and a preset loss function, a loss value is calculated; based on the loss value, the parameters of the routing model are updated so that the routing model learns the mapping relationship between the historical query text and the tags; Training stops when the preset loss function converges or reaches the preset number of iterations, resulting in the trained routing model.
8. The method according to claim 7, characterized in that, The relative utility gain corresponding to the retrieval tool is the difference between the retrieval tool utility and the base utility. The retrieval tool utility is used to characterize the score of the answer text generated based on the retrieval results and the historical query text, while the base utility is used to characterize the score of the answer text directly generated based on the historical query text.
9. The method according to claim 7, characterized in that, The method also includes determining a score for the answer text according to the following process: Determine the scores of the answer text on multiple evaluation dimensions, calculate the weighted sum of the scores of the answer text on multiple evaluation dimensions, and use the weighted sum as the score of the answer text; wherein, the evaluation dimensions include one or more of the following: factual accuracy, completeness, and fluency.
10. The method according to claim 1, characterized in that, The search engine includes at least one first search engine, which is either a sparse search engine or a dense search engine. Based on the target retrieval tool, the query text is retrieved, including: When the target searcher is the sparse searcher, keyword retrieval is performed on the query text based on the sparse searcher; or, When the target searcher is the dense searcher, semantic search is performed on the query text based on the dense searcher.
11. The method according to claim 10, characterized in that, The first retrieval device also includes a retrieval device constructed based on the sparse retrieval device and the ranking model, and a retrieval device constructed based on the dense retrieval device and the ranking model, wherein the ranking model is used to rank the retrieval results.
12. The method according to claim 11, characterized in that, The ranking model includes a first ranking model and / or a second ranking model. The first ranking model is used to rank the results based on the relevance score between the search results and the query text, and the second ranking model is used to rank the results based on the relevance score between the search results and the query text, as well as the difference score between the current candidate search results and the selected search results.
13. The method according to any one of claims 10-12, characterized in that, The searcher also includes a second searcher, the search scope of which is configured to be an empty database or a sub-database of the first database; Based on the target searcher, the query text is retrieved in the first database to obtain the search results of the target searcher, including: if the target searcher is a second searcher, the query text is retrieved in the sub-database to obtain the search results of the second searcher, or the query text is retrieved in the empty database to obtain the search results of the second searcher, wherein the search results of the second searcher are empty.
14. A question-and-answer device, characterized in that, include: The feature extraction module is used to extract feature information of the query text in response to receiving the query text; The matching module is used to input the identification information of each retrieval in the retrieval pool and the feature information of the query text into the routing model as input data, obtain the utility gain score corresponding to each retrieval output by the routing model, use the utility gain score corresponding to each retrieval as the matching degree between the query text and each retrieval, and use the retrieval with the highest matching degree with the query text as the target retrieval. The retrieval module is used to retrieve the query text from the first database based on the target retrieval tool, and obtain the retrieval results of the target retrieval tool; The answer generation module is used to generate the answer text corresponding to the query text based on the search results of the target searcher.
15. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method as described in any one of claims 1-13.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-13.