Search path selection method, device and electronic equipment in search enhancement generation
By constructing a text block clustering tree and combining it with node value scores to select the retrieval path, the problem of information association and location difficulties in complex question retrieval in existing systems is solved, achieving more efficient and accurate information retrieval and improving the effect of answer generation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING SILICON INTELLIGENCE TECH CO LTD
- Filing Date
- 2026-06-08
- Publication Date
- 2026-07-07
AI Technical Summary
Existing search enhancement generation systems struggle to locate information that lacks a direct literal connection to the question in complex question retrieval, resulting in low retrieval efficiency and inaccurate answer generation.
By constructing a text block clustering tree and combining node value scores to determine the retrieval path, candidate text blocks with high relevance are selected, enabling multi-dimensional evaluation for comprehensive retrieval of related information.
It improves the coverage and accuracy of search results, ensuring that the generated answers are more effective.
Smart Images

Figure CN122346554A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus and electronic device for selecting retrieval paths in retrieval enhancement generation. Background Technology
[0002] With the rapid development of information technology, retrieval-enhanced generative intelligence (RAG) systems are widely used in enterprise services, education and tutoring, and other scenarios. These systems effectively improve information retrieval efficiency by retrieving relevant information from a pre-built knowledge base and then using a large language model to generate accurate and timely answers for users.
[0003] When performing a search, relevant RAG systems often rely on direct retrieval based on keyword similarity. This method can accurately find relevant information when searching for a specific question. However, when dealing with complex queries, it is often difficult to locate information that lacks a direct literal connection to the question based on keyword retrieval, thus failing to achieve the desired results.
[0004] Therefore, how to achieve comprehensive retrieval of related information in the process of searching for complex questions is an urgent problem to be solved. Summary of the Invention
[0005] To address the aforementioned problems, embodiments of this application provide a method, apparatus, and electronic device for selecting retrieval paths in retrieval enhancement generation. By combining node value scores to determine the retrieval path, it enables comprehensive retrieval of related information during complex question retrieval processes, thereby obtaining accurate and comprehensive target content. Specifically, embodiments of this application disclose the following technical solutions: The first aspect of this application provides a retrieval path selection method in retrieval enhancement generation. The method first determines multiple first candidate text blocks corresponding to the unanswered question based on user input and multiple preset text blocks, and determines the first contribution of each first candidate text block. Then, based on each first candidate text block, it determines the first child node and first parent node corresponding to each first candidate text block in a preset text block clustering tree. The text block clustering tree is constructed from multiple preset text blocks according to preset clustering labels, the clustering labels are obtained by a preset model based on the multiple preset text blocks, and the text block clustering tree includes multiple parent nodes, each parent node corresponding to multiple child nodes. The parent node is composed of clustering labels, and the child nodes are composed of preset text blocks. Next, based on each first candidate text block and each first candidate text block… Based on the first contribution score of the block and the text block clustering tree, a retrieval path selection is performed. The retrieval path selection includes: determining at least one second child node corresponding to the first parent node based on the node value score, and determining the second candidate text block corresponding to the second child node; and / or, determining the second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree based on the node value score, and determining the second candidate text block corresponding to the second child node; wherein, the node value score is used at least to characterize the degree of association between the second candidate text block and / or the first candidate text block and the degree of association between the second candidate text block and the question to be answered; each first child node corresponds to at least one second child node; finally, at least based on the second candidate text block and / or the first candidate text block, the target content corresponding to the question to be answered is determined.
[0006] In some embodiments, the node value score is determined at least based on the values of its child nodes and the values of its parent nodes; wherein the value of a child node is used at least to characterize the degree of association between a preset text block and the question to be answered, and the value of a parent node is determined based on the values of the child nodes of all the child nodes corresponding to the parent node.
[0007] In some embodiments, determining a node value score includes: determining an initial distribution probability of a child node based on the similarity between the preset text block corresponding to the child node and the question to be answered, wherein the initial distribution probability is used to characterize the probability that the child node is associated with the question to be answered; determining a jump conditional probability of a child node based on the association between child nodes, wherein the jump conditional probability is used to characterize the probability of jumping from a selected child node to the current child node during the retrieval path selection process; determining a retrieval distribution probability of a child node based on the initial distribution probability and the jump conditional probability, wherein the retrieval distribution probability is used to characterize the probability that the child node is selected during the retrieval path selection process after multiple rounds of retrieval; and determining a node value score corresponding to the child node based at least on the retrieval distribution probability.
[0008] In some embodiments, before determining the node value score, the method further includes: constructing a text block clustering graph based on the text block clustering tree; wherein the text block clustering graph consists of multiple child nodes and at least two association edges set between the child nodes, the association edges are used to represent that there is an association relationship between the corresponding two child nodes; the association edges include a first association edge and a second association edge, the first association edge is used to represent that the two child nodes belong to the same parent node in the text block clustering tree, and the second association edge is used to represent that the semantic similarity between the preset text blocks corresponding to the two child nodes is higher than a preset threshold; the first association edge corresponds to a first edge weight, and the second association edge corresponds to a second edge weight.
[0009] In some embodiments, determining the jump conditional probability of a child node based on the association between child nodes includes: determining the jump conditional probability of the fifth child node relative to the fourth child node based on the weight of the first edge and / or the weight of the second edge between the fourth child node and the fifth child node, and the weight of the first edge and / or the weight of the second edge between the fourth child node and its corresponding neighboring child nodes; wherein, the neighboring child nodes are used to represent one or more child nodes in the text block clustering graph that have an association edge with the fourth child node; wherein, the fourth child node and the fifth child node are any two child nodes in the text block clustering graph.
[0010] In some embodiments, the retrieval distribution probability of a child node is determined based on the initial distribution probability and the jump condition probability, including: determining the retrieval distribution probability corresponding to the fourth child node in round t based on the restart retrieval probability and the jump condition probability of the neighboring child nodes of the fourth child node in round t-1 jumping to the fourth child node; iterating in this way until the change in the retrieval distribution probability corresponding to the fourth child node is less than a preset threshold; wherein, the restart retrieval probability is determined based on a preset restart retrieval coefficient and the initial distribution probability, and the restart retrieval probability is used to characterize the probability of terminating the current retrieval path selection and re-retrieving based on the question to be answered.
[0011] In some embodiments, the method further includes: determining the distribution weight corresponding to the child node based on the retrieval distribution probability; determining the child node value corresponding to the child node based on the similarity between the preset text block corresponding to the child node and the question to be answered; and determining the parent node value based on the distribution weight and distribution reference value of each child node corresponding to the same parent node.
[0012] In some embodiments, determining a node value score further includes: determining the node value score based on the value of child nodes, the value of parent nodes, and the node coverage rate; wherein the node coverage rate is determined based on the number of selected child nodes in the current retrieval path and the total number of child nodes in the text block clustering tree.
[0013] In some embodiments, determining the target content corresponding to the question to be answered, at least based on the second candidate text block and / or the first candidate text block, includes: performing retrieval path selection based on each second candidate text block, the second contribution value corresponding to each second candidate text block, and the text block clustering tree; the retrieval path selection further includes: determining at least one third child node corresponding to the first parent node based on the node value score, and determining the third candidate text block corresponding to the third child node; and / or, determining at least one third child node corresponding to the second parent node based on the node value score, and determining the third candidate text block corresponding to the third child node; and / or, determining the third parent node and at least one third child node corresponding to the third parent node in the text block clustering tree based on the node value score, and determining the third candidate text block corresponding to the third child node; performing retrieval path selection based on the third candidate text block until the retrieval path selection meets a preset termination condition, thereby obtaining the target content corresponding to the question to be answered; wherein, the node value score is at least used to characterize the degree of association between the third candidate text block and / or the first candidate text block, the degree of association between the third candidate text block and / or the second candidate text block, and the degree of association between the third candidate text block and the question to be answered; each second child node corresponds to at least one third child node.
[0014] In some embodiments, a retrieval path selection is performed based on a third candidate text block until the retrieval path selection meets a preset termination condition to obtain the target content corresponding to the question to be answered. This includes: determining one or more candidate retrieval paths based at least on each first child node, each second child node, and each third child node; determining the cumulative value corresponding to each candidate retrieval path based on the first contribution of each first child node and the first decay weight corresponding to the first child node, the second contribution of each second child node and the second decay weight corresponding to the second child node, and the third contribution of each third child node and the third decay weight corresponding to the third child node; wherein the first decay weight, the second decay weight, and the third decay weight are determined according to the retrieval order of the first child node, the second child node, and the third child node in the corresponding candidate retrieval path, respectively; determining one or more target retrieval paths based on the cumulative value corresponding to each candidate retrieval path; and determining the target content corresponding to the question to be answered based on the candidate text blocks corresponding to each child node in the target retrieval path when the target retrieval path meets the preset termination condition.
[0015] In some embodiments, determining one or more target search paths based on the cumulative value corresponding to each candidate search path includes: determining candidate search paths whose cumulative value meets preset conditions as target search paths based on the cumulative value corresponding to each candidate search path; and / or, based on the growth rate of the cumulative value corresponding to each candidate search path during multiple consecutive search processes, determining candidate search paths whose growth rate is higher than a preset threshold as target search paths.
[0016] In some embodiments, the retrieval path selection is performed based on the third candidate text block until the retrieval path selection meets a preset termination condition to obtain the target content corresponding to the question to be answered. This further includes: if the target retrieval path does not meet the preset termination condition, performing retrieval path selection based on the third candidate text block corresponding to at least one third child node in each target retrieval path, the third contribution value corresponding to each third candidate text block, and the text block clustering tree; the retrieval path selection includes: determining at least one sixth child node corresponding to the parent node of the third child node based on the node value score, and determining the sixth candidate text block corresponding to the sixth child node; and / or, determining the fourth parent node and at least one sixth child node corresponding to the fourth parent node in the text block clustering tree based on the node value score, and determining the sixth candidate text block corresponding to the sixth child node; wherein the node value score is used at least to characterize the correlation between the sixth candidate text block and / or the third candidate text block, the third candidate text block and the second candidate text block, the second candidate text block and the first candidate text block, and the correlation between the sixth candidate text block and the question to be answered; each third child node corresponds to at least one sixth child node; the target content corresponding to the question to be answered is determined at least based on the sixth candidate text block, the second candidate text block, and / or the first candidate text block.
[0017] In some embodiments, determining the first child node and first parent node of each first candidate text block in a preset text block clustering tree based on each first candidate text block includes: querying the text block clustering tree based on the first candidate text block to obtain the first child node of the first candidate text block in the text block clustering tree; and querying the text block clustering tree based on the first child node to determine the first parent node of the first child node in the text block clustering tree.
[0018] In some embodiments, determining at least one second child node corresponding to a first parent node based on node value scores, and determining a second candidate text block corresponding to the second child node, includes: if the first contribution of the first candidate text block is within a first preset range, determining the child node with the highest node value score in the first parent node as the second child node; determining the second candidate text block corresponding to the second child node based on the second child node; determining a second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree based on node value scores, and determining the second candidate text block corresponding to the second child node, includes: if the first contribution of the first candidate text block is within a second preset range, obtaining the parent node values of multiple candidate parent nodes; determining the parent node with the highest parent node value among the candidate parent nodes as the second parent node; and determining the child node with the highest node value score among the second parent nodes as the second child node; determining the second candidate text block corresponding to the second child node based on the second child node; wherein, the candidate parent node is any parent node other than the first parent node in the text block clustering tree.
[0019] A second aspect of this application provides a retrieval path selection device in retrieval enhancement generation, comprising: a first determining module, a second determining module, a third determining module, and a content generation module. The first determining module is configured to: determine multiple first candidate text blocks corresponding to the unanswered question based on user input and multiple preset text blocks, and determine the first contribution of each first candidate text block; the second determining module is configured to: determine the first child node and first parent node corresponding to each first candidate text block in a preset text block clustering tree based on each first candidate text block; wherein the text block clustering tree is constructed from multiple preset text blocks according to preset clustering labels, the clustering labels are obtained by a preset model based on multiple preset text blocks, the text block clustering tree includes multiple parent nodes, each parent node corresponds to multiple child nodes, the parent node is composed of clustering labels, and the child nodes are composed of preset text blocks; the third determining module is configured to: determine the first child node and first parent node corresponding to each first candidate text block based on each first candidate text block and the first child node corresponding to each first candidate text block. The contribution score and text block clustering tree are used to perform retrieval path selection. The retrieval path selection includes: determining at least one second child node corresponding to the first parent node based on the node value score, and determining the second candidate text block corresponding to the second child node; and / or, determining the second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree based on the node value score, and determining the second candidate text block corresponding to the second child node; wherein, the node value score is used at least to characterize the degree of association between the second candidate text block and / or the first candidate text block and the degree of association between the second candidate text block and the question to be answered; each first child node corresponds to at least one second child node; the content generation module is configured to: determine the target content corresponding to the question to be answered based at least on the second candidate text block and / or the first candidate text block.
[0020] A third aspect of this application provides an electronic device, including: a processor and a memory, wherein the memory is used to store computer-executable instructions; and the processor is used to read the instructions from the memory and execute the instructions to implement the retrieval path selection method in the retrieval enhancement generation described in the first aspect above.
[0021] A fourth aspect of this application provides a computer-readable storage medium storing computer program instructions. When a computer reads the instructions, it executes the retrieval path selection method in the retrieval enhancement generation described in the first aspect above.
[0022] A fifth aspect of this application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions that, when executed by a computer, cause the computer to perform the retrieval path selection method in the retrieval enhancement generation described in the first aspect.
[0023] The sixth aspect of this application provides a computer program that, when executed by a processor, can implement the retrieval path selection method in the retrieval enhancement generation described in the first aspect.
[0024] The retrieval path selection method in the retrieval enhancement generation provided in this application embodiment firstly filters out first candidate text blocks and calculates a first contribution based on the matching degree between the user-input question and preset text blocks; then, these preset text blocks are mapped to corresponding child nodes in a text block clustering tree, and their parent nodes are traced; next, the retrieval path for the next retrieval is determined from the text block clustering tree based on the first candidate text blocks and the first contribution, and a second child node is determined based on the selected retrieval path combined with the node value score; wherein, the node value score is at least used to characterize the degree of association between the second candidate text block and / or the first candidate text block and the degree of association between the second candidate text block and the question to be answered; each first child node corresponds to at least one second child node; finally, target content is generated based on the second candidate text block corresponding to the second child node combined with the first candidate text block. The retrieval path selection method in the retrieval enhancement generation provided in this application is based on the comprehensive consideration of the degree of association between text blocks and the degree of association with the question based on the node value score. It realizes the transition from single similarity evaluation to multi-dimensional comprehensive evaluation, effectively conducts a comprehensive and accurate retrieval of text blocks in the knowledge base that may be related to the question, significantly improves the coverage and accuracy of the retrieval results, and thus ensures that the effect of answer generation is more ideal. Attached Figure Description
[0025] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 A schematic diagram illustrating a retrieval path selection method in retrieval enhancement generation provided in an embodiment of this application; Figure 2 A schematic diagram of a text block clustering tree provided in an embodiment of this application; Figure 3A schematic diagram illustrating another retrieval path selection method in retrieval enhancement generation provided in an embodiment of this application; Figure 4 A schematic diagram of a text block clustering graph provided in an embodiment of this application; Figure 5 A schematic diagram illustrating another method for selecting a search path in search enhancement generation provided in this application embodiment; Figure 6 A schematic diagram illustrating another method for selecting a search path in search enhancement generation provided in an embodiment of this application; Figure 7 A schematic diagram illustrating another method for selecting a search path in search enhancement generation provided in an embodiment of this application; Figure 8 A schematic diagram of a candidate retrieval path provided in an embodiment of this application; Figure 9 A schematic diagram of a retrieval path selection device in retrieval enhancement generation provided in an embodiment of this application; Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0027] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, and to make the above-mentioned objectives, features and advantages of the embodiments of the present invention more apparent and understandable, the technical solutions in the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0028] RAG (Retrieval-Augmented Generation) is a technical framework that combines information retrieval with text generation. It improves the accuracy, factuality, and relevance of the generated content by first retrieving relevant information from a knowledge base and then inputting the retrieval results as context into an LLM (Large Language Model).
[0029] The RAG workflow consists of three stages: 1) Retrieval: Based on the user's original question, the most relevant text chunks are semantically searched from the preset knowledge base.
[0030] 2) Augmentation: The retrieved text chunks are merged with the original question to construct a new prompt.
[0031] 3) Generation: Input the prompts obtained from the enhancement process into the LLM to generate the final answer.
[0032] LLM (Linguistic Programming) is a natural language processing model based on deep neural networks. Through self-supervised pre-training on massive amounts of text data, it learns the statistical patterns and semantic representations of language. Its parameter scale typically reaches billions to hundreds of billions, giving it powerful contextual understanding and text generation capabilities. In practical applications, this model can effectively process multiple retrieved text blocks, understand their semantic relationships and key information, and autoregressively generate coherent, accurate, and structured natural language responses based on user queries, achieving intelligent transformation from scattered information to complete answers.
[0033] Currently, in related technologies, RAG systems often rely on direct keyword similarity retrieval during the search process. While this method can accurately retrieve relevant information when searching for a specific question, it often fails to achieve ideal results when dealing with complex queries. This is because keyword-based retrieval struggles to locate information that lacks a direct literal connection to the question. Especially when handling complex queries involving multiple domains and levels of knowledge, multiple rounds of iterative retrieval are often required. Each round returns a large amount of data with scattered relevance, increasing computational overhead and hindering the effective integration of multi-source information across domains. This leads to reduced retrieval efficiency and a poor user experience. Furthermore, its node selection relies solely on the direct similarity between the question and the text block, making it difficult to discover implicit relevant information scattered across different clustering levels.
[0034] Taking the RAG system, built upon legal provisions, as an example, a user querying "A lent money to B, and B refused to repay the debt after it matured. What is the statute of limitations?" provides a clear query. The system can accurately locate the provisions on the statute of limitations in the Civil Code and relevant judicial interpretations, and generate a corresponding answer based on the text. However, in actual use, the questions queried by users in the RAG system are often more complex. For example, "A gave a car to B, and B refuses to return it. What should A do?" This action is based on the agreement between A and B. B's objective behavior and subjective purpose differ, potentially involving civil matters such as transfer of title or retention of title sale, or criminal matters such as embezzlement or fraud. If there are omissions in the search process, the generated answer will inevitably be incomplete. Furthermore, user queries such as "How does civil law achieve a transformation from formal equality to substantive equality?"—more macro-level questions—further complicate the RAG system's search process.
[0035] To address the aforementioned issues, the retrieval path selection method in the retrieval enhancement generation provided in this application can select a retrieval path based on the contribution of the first candidate text block determined in the previous round to the question, and by utilizing the hierarchical relationship of the text block clustering tree combined with the node value score. This determines the second child node and its corresponding second candidate text block for the next round, thereby identifying the target content corresponding to the question. This scheme can achieve comprehensive and accurate retrieval of related information during complex question retrieval processes.
[0036] The method for selecting the search path in the search enhancement generation provided in the embodiments of this application will be described below with reference to the accompanying drawings.
[0037] Figure 1 This is a schematic diagram illustrating a retrieval path selection method in retrieval enhancement generation provided in an embodiment of this application. For example... Figure 1 As shown, the method includes steps 110 to 140 as shown below.
[0038] Step 110: Based on the user-input question to be answered and multiple preset text blocks, determine multiple first candidate text blocks corresponding to the question to be answered, and determine the first contribution of each first candidate text block.
[0039] For example, based on the question to be answered, at least one first candidate text block can be determined from multiple preset text blocks, and the first contribution degree corresponding to the first candidate text block can be obtained based on the question to be answered and the first candidate text block.
[0040] In some examples, the user-inputted question is typically in natural language that the user commonly uses. Before using the question, it needs to be parsed to extract keywords. For example, keyword extraction strategies include: retaining nouns, verbs, and other content words; filtering stop words; identifying proper nouns and numerical information; and possibly applying relevant algorithms to weight and rank the keywords. Keyword extraction techniques include NLP (Natural Language Processing) techniques such as word segmentation, part-of-speech tagging, and named entity recognition. This application does not limit these techniques.
[0041] Among them, multiple preset text blocks are obtained by the preset model dividing the preset text according to preset rules.
[0042] In the RAG-related field, a pre-built text block is a text block in a pre-built knowledge base that stores external knowledge sets, typically including processed documents, data, or information resources. For example, a text block is multiple text blocks segmented from the original document according to semantic boundaries or a fixed length. Each text block contains complete contextual information and carries a unique identifier.
[0043] For example, the preset model can be a regular expression engine, LLM, traditional NLP tools, Sentence-BERT, and LlamaIndex, etc. The preset rules can be fixed-length block rules, natural boundary block rules, and semantic block rules, etc.
[0044] It should be noted that the LLM invoked in this embodiment can directly adopt any compliant existing LLM and achieve the relevant tasks based on the model capabilities of the existing LLM. Therefore, pre-training of the LLM is not required. For the execution of other steps, apart from invoking the LLM, no complex machine learning is involved, so pre-training is unnecessary.
[0045] In some examples, based on the user-input question and multiple preset text blocks, at least one first candidate text block corresponding to the question can be determined from the multiple preset text blocks. The first candidate text block is the preset text block with the highest matching degree to the question keywords among the multiple preset text blocks.
[0046] For example, the first candidate text block can be the text block obtained in the first round of retrieval after the user enters the question to be answered.
[0047] For example, the first round of retrieval uses the grep method, based on a text block clustering tree. After the user inputs a natural language question, the question is first parsed, keywords are extracted, and the standardized keywords are vectorized to obtain keyword vectors. Then, similarity matching is performed in the text block clustering tree to quickly locate the text blocks most semantically relevant to the question keywords. Finally, the text blocks output by grep undergo post-processing such as deduplication, sorting by matching degree, and extraction of contextual information, and the structured retrieval results are returned to the user or downstream processing modules. The text block clustering tree can be a tree-like index structure built using a hierarchical clustering algorithm on text blocks in the knowledge base, where each parent node represents a cluster label, and each child node corresponds to a specific preset text block. In this process, the construction of the text block clustering tree narrows the retrieval scope, improving the efficiency and accuracy of grep retrieval.
[0048] For example, the first candidate text block can also be a text block obtained in the second round or a subsequent round of retrieval. For instance, based on the question to be answered, candidate text blocks from the previous round are determined from multiple preset text blocks. The contribution, child nodes, and parent nodes of these candidate text blocks are then determined. Based on the contribution and parent node, the parent node to be queried in this round is determined. Next, the child nodes and their node value scores are determined based on the parent node to be queried in this round. Finally, the first candidate text block is determined based on the value score of the child node, thereby determining the target content corresponding to the question to be answered. Here, the child node in this round is the child node corresponding to the first candidate text block to be determined in this round in the text block clustering tree.
[0049] In some examples, the first contribution of a first candidate text block can be determined based on the user-input question and the first candidate text block.
[0050] For example, each first candidate text block corresponds to a first contribution, and each first contribution is determined based on each first candidate text block and the question to be answered.
[0051] For example, contribution can represent the degree to which a text block contributes to the question to be answered, and the degree of contribution of each text block to the question to be answered may be different. Contribution can be intuitively represented by a contribution score, which can be obtained through LLM (Limited Language Management). For example, by simultaneously inputting the question to be answered and the first candidate text block into the LLM, the first contribution score calculated by the LLM can be obtained directly. Example prompt: "Please evaluate the contribution of the following text block to the answer to the question, with a score range of 0-1." Another example is to use the embedding similarity method to calculate the first contribution score: convert the question to be answered and the first candidate text block into vectors respectively, calculate the cosine similarity as the basic contribution, and then calibrate and adjust the basic contribution using LLM to obtain the first contribution score. Yet another example is to design a comprehensive scoring system to evaluate contribution from multiple dimensions. The above methods are only illustrative examples; this application does not limit the specific methods or how they are used.
[0052] For example, a higher contribution score indicates that the text block is more effective for the question to be answered. For instance, the first contribution score is usually a value between 0 and 1. When the first contribution score is between 0.9 and 1 (inclusive), the search for the question to be answered ends, and the target content can be directly generated based on the current first candidate text block; while when the first contribution score is less than 0.9, the search for the question to be answered continues.
[0053] Step 120: Based on each first candidate text block, determine the first child node and first parent node corresponding to each first candidate text block in the preset text block clustering tree.
[0054] For example, if the first contribution value of the first candidate text block is 0.9-1 (inclusive of left and right values), the first candidate text block can directly generate the target content. However, if the first contribution value is 0-0.9 (inclusive of left and right values), it is necessary to continue the next round of retrieval based on the first candidate text block to obtain other candidate text blocks that are closer to the answer in order to generate the target content.
[0055] In some examples, the text block clustering tree is constructed from multiple preset text blocks based on preset clustering labels. The clustering labels are obtained by a preset model based on multiple preset text blocks. The text block clustering tree includes multiple parent nodes, each parent node corresponding to multiple child nodes. The parent nodes are composed of clustering labels, and the child nodes are composed of preset text blocks.
[0056] For example, the first candidate text block corresponds to the first child node in the text block clustering tree. The first child node belongs to one first parent node, or the first child node belongs to two different first parent nodes. Obviously, based on the correspondence between the first child node and the first parent node, we can know the correspondence between the first candidate text block and the cluster label; similarly, based on the correspondence between the first candidate text block and the cluster label, we can know the correspondence between the first child node and the first parent node.
[0057] In some examples, text block clustering trees can include directory clustering trees and community clustering trees.
[0058] For example, a directory clustering tree can be constructed based on a preset text block and the directory information corresponding to the preset text block; wherein, the directory parent node of the preset text block in the directory clustering tree is composed of the directory information corresponding to the preset text block.
[0059] For example, directory information can be obtained in the following way: extract the directory information of the text containing each preset text block from the pre-stored directory structure in the knowledge base, and directly use the directory information as the directory label of the corresponding preset text block. For preset text blocks that do not originally have directory information in the knowledge base, it is necessary to generate corresponding directory information based on the content of the text block using a Large Language Model (LLM) to ensure that each preset text block can obtain a corresponding directory label for building a directory clustering tree.
[0060] For example, directory information can be generated by an LLM (Local Management Module). The complete content or triple information (including entity words, summaries, and text block tags) of preset text blocks within the same directory cluster is input into the LLM. Combined with explicit generation instructions (such as requiring concise and accurate tags, limiting tag length, and standardizing expressions), the LLM analyzes the semantic information and outputs the corresponding directory information. This directory information can be dynamically updated based on changes in the directory cluster content. The system can also determine whether directory information needs to be merged to optimize the directory structure. Each directory parent node corresponds to multiple preset child nodes composed of preset text blocks. Finally, a directory clustering tree is constructed based on the preset child nodes and the directory parent node.
[0061] The directory tags originate from the directory structure of the original document (preset text), featuring clear hierarchy and precise positioning, faithfully preserving the document's organizational logic. The directory clustering tree generated by the directory tags is characterized by distinct levels and a regular structure, achieving systematic organization and precise navigation of preset text blocks through the hierarchical relationship between parent nodes and preset child nodes.
[0062] For example, a community clustering tree can be constructed based on a preset text block and the text block label corresponding to the preset text block; wherein, the community parent node of the preset text block in the community clustering tree is composed of the text block label corresponding to the preset text block.
[0063] The text block tags are obtained as follows: First, the preset text in the knowledge base is divided into blocks to obtain multiple preset text blocks. Then, each preset text block is input as an independent annotation unit into the Large Language Model (LLM). The LLM extracts the triple information of each preset text block, which includes the text block tag. The text block tag can be the core clue or keyword of the preset text block content, or it can be a summary of the content type of the preset text block, such as topic tags, genre tags, scene tags, etc. These tags will be used for subsequent community clustering tree construction.
[0064] Community tags are generated based on semantic clustering, featuring broad coverage and strong generalization, and can reveal the inherent connections between content from different fields. The community clustering tree generated by community tags has the characteristics of semantic aggregation and close association. Through the community parent node, semantically similar pre-defined text blocks are classified and integrated to form a macro framework and semantic navigation network of the knowledge system.
[0065] The two types of tags mentioned above can construct a multi-level knowledge organization structure. The text block clustering tree in this step establishes a clear hierarchical relationship between discrete tags and preset text blocks, forming a navigable knowledge map.
[0066] In some examples, step 120 includes: querying the text block clustering tree based on the first candidate text block to obtain the first child node corresponding to the first candidate text block in the text block clustering tree; and querying the text block clustering tree based on the first child node to determine the first parent node corresponding to the first child node in the text block clustering tree.
[0067] For example, based on the first candidate text block, the first child node corresponding to the first candidate text block is queried in the text block clustering tree. The first child node belongs to one first parent node, or the first child node belongs to two different first parent nodes. Based on the positional relationship of the first child node in the text block clustering tree, the first parent node corresponding to the first child node is determined, and this first parent node represents the cluster label corresponding to the first candidate text block.
[0068] Figure 2This is a schematic diagram of a text block clustering tree provided in an embodiment of this application. Figure 2 As shown, in the text block clustering tree, each preset text block corresponds to a child node; for example, the first candidate text block corresponds to the first child node A1. The parent node represents the clustering label of the preset text block; for example, a certain clustering label of the first candidate text block corresponds to the first parent nodes B1 and / or B2. The root node C1 corresponds to the preset text. Because the clustering methods for preset text blocks differ, the affiliation of child nodes also varies. Each child node belongs to at least one parent node; that is, a child node may belong to only a single parent node or simultaneously belong to multiple different parent nodes.
[0069] Step 130: Based on each first candidate text block, the first contribution score corresponding to each first candidate text block, and the text block clustering tree, perform retrieval path selection; the retrieval path selection includes: determining at least one second child node corresponding to the first parent node based on the node value score, and determining the second candidate text block corresponding to the second child node; and / or, determining the second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree based on the node value score, and determining the second candidate text block corresponding to the second child node.
[0070] For example, each first candidate text block and its corresponding first contribution can determine the retrieval path for the next round of the first candidate text block. Specifically, the retrieval path can be determined by combining the position of the first candidate text block in the text block clustering tree.
[0071] For example, each first child node corresponds to at least one second child node.
[0072] Figure 3 This is a schematic diagram illustrating another method for selecting a search path in search enhancement generation provided in an embodiment of this application. For example... Figure 3 As shown, in some examples, step 130 includes steps 310 to 320.
[0073] Step 310: If the first contribution of the first candidate text block is within the first preset range, the child node with the highest node value score in the first parent node is determined as the second child node.
[0074] For example, the determination of the scope of the first contribution can be used to narrow the scope of the next round of retrieval in order to improve the efficiency of the next round of retrieval; at the same time, since the first contribution can characterize the effectiveness of the first candidate text block for the question to be answered, narrowing the retrieval scope according to the first contribution helps to obtain more accurate retrieval results.
[0075] For example, if the first contribution is within a first preset range, it indicates that the first candidate text block is highly effective for the question to be answered, but has not yet reached the level of completely matching the answer. Therefore, the next round of retrieval can be instructed to continue under the cluster label to which the first candidate text block belongs.
[0076] For example, the first preset range can be 0.6-0.9 (inclusive). In the text block clustering tree, the first child node corresponding to the first candidate text block is found, and the corresponding first parent node is found based on the first child node. This first parent node is the cluster label to which the first candidate text block belongs. For example, when the first contribution is 0.8, it falls within the first preset range, indicating that although the first candidate text block is not the text block closest to the answer, its corresponding first candidate cluster label has a high probability of finding the text block closest to the answer. Therefore, it can be used as the range for the next search. That is, the cluster label of the first candidate text block is used as the cluster label for the next round of search to provide the range for the next round of search. In addition, to avoid duplicate searches, the first candidate text block should be excluded.
[0077] For example, a first parent node corresponds to at least one child node, and each child node corresponds to a preset text block. Among the child nodes corresponding to the first parent node, the child node with the highest node value score is selected as the second child node. The first child node and the second child node form a retrieval path.
[0078] For example, from at least one child node corresponding to the first parent node, two or more child nodes with higher node value scores can be selected as second child nodes based on the node value score of each child node. The second child node is different from the first child node.
[0079] For example, if there are two second child nodes, specifically, the multiple child nodes of the first parent node can be arranged in descending order of node value score, and the two child nodes at the top of the list can be selected as the second child nodes. The first child node and one second child node form one search path, and the next round of searching can be based on that second child node; the first child node and another second child node form another search path, and the next round of searching can be based on that second child node. When there are multiple second child nodes, the formation of search paths follows the same logic.
[0080] For example, the node value score is used at least to characterize the degree of association between the second candidate text block and / or the first candidate text block, as well as the degree of association between the second candidate text block and the question to be answered.
[0081] In some examples, the node value score is determined at least based on the values of its child nodes and its parent node.
[0082] For example, the node value score of a child node can be determined jointly based on the child node value and the parent node value of the parent node to which the child node belongs.
[0083] For example, the node value score of a child node can be calculated using the following formula (1): Score = α·S_node + β·S_parent, formula (1); Wherein, Score is the node value score of the child node; S_node is the child node value of the child node, which is used to characterize the degree of association between the preset text block corresponding to the child node and the question to be answered; S_parent is the parent node value of the parent node to which the child node belongs, which can be determined based on the child node values of all child nodes corresponding to the parent node; α is the child node value weight coefficient, which is used to adjust the contribution ratio of the degree of association between the child node and the question in the node value score, and its value range is usually between 0 and 1. The larger the value, the more emphasis is placed on the retrieval value of the node itself; β is the parent node value weight coefficient, which is used to adjust the contribution ratio of the parent node value in the node value score, and its value range is usually between 0 and 1. The larger the value, the more emphasis is placed on the value of the upper-level nodes in the knowledge hierarchy; the two weight coefficients satisfy the normalization condition, that is, α+β=1; the specific values of α and β can be determined through empirical setting or optimization based on the validation set. Technical personnel in the relevant technical field can adjust the parameter values according to the needs of the actual application scenario through conventional experimental methods so that the retrieval system can achieve optimal performance in a specific task.
[0084] For example, the value of a child node can be determined based on the similarity between the preset text block corresponding to that child node and the question to be answered. The child node value is used to characterize at least the degree of association between the preset text block and the question to be answered.
[0085] For example, the value of a child node can be calculated using the following formula (2): S_node=Similarity(Q, NodeEmbedding), formula (2); Where S_node is the value of the child node of the child node; Q is the retrieval object, i.e., the keyword or question embedding; NodeEmbedding is the embedding vector of the preset text block corresponding to the child node; Similarity refers to the similarity calculation.
[0086] For example, the specific methods for calculating similarity can be one or more combinations of vector cosine similarity, semantic fusion scoring, and language model-based matching scoring.
[0087] The similarity is calculated using several methods: Vector cosine similarity, which measures the cosine similarity between the embedding vectors of the retrieved object and the preset text block. The cosine of the angle between the vectors measures their similarity in the vector space, with a value ranging from -1 to 1; a higher value indicates greater similarity. Semantic fusion scoring considers multiple semantic feature dimensions (such as lexical overlap, syntactic similarity, and topic consistency) and performs a weighted fusion calculation to obtain a comprehensive semantic similarity score. Language model-based matching scoring uses BERT or similar algorithms to perform semantic matching between the retrieved object and the preset text block, using the matching probability or relevance score output by the model as the similarity score.
[0088] The models called above do not involve complex machine learning, so no pre-training is required.
[0089] For example, the value of a parent node can be obtained from the child nodes of all the child nodes corresponding to that parent node. That is, the value of a parent node is determined based on the values of the child nodes of all the child nodes corresponding to that parent node.
[0090] For example, the value of the parent node to which the child node belongs can be calculated using the following formula (3): S_parent=f(S_node_1, S_node_2...S_node_n), formula (3); Where S_parent is the value of the parent node; S_node_1, S_node_2...S_node_n are the values of all child nodes corresponding to the parent node; f can be one or more of the following: a maximum value function, a weighted average function, a decreasing decay function, and a language model estimation function. This application does not impose specific limitations on this.
[0091] In other examples, the node value score can be determined based on the retrieval distribution probability.
[0092] In some examples, a text block clustering graph is constructed based on the text block clustering tree before determining the node value score based on the retrieval distribution probability.
[0093] The text block clustering graph consists of multiple child nodes and at least two association edges between them. These association edges represent a relationship between the two child nodes. Each association edge includes a first association edge and a second association edge. The first association edge indicates that the two child nodes belong to the same parent node in the text block clustering tree, while the second association edge indicates that the semantic similarity between the corresponding text blocks of the two child nodes is higher than a preset threshold. The first association edge corresponds to a first edge weight, and the second association edge corresponds to a second edge weight.
[0094] Specifically, constructing a text block clustering graph based on a text block clustering tree includes: First, extracting all child nodes from the text block clustering tree as nodes in the text block clustering graph; then, based on the hierarchical structure of the text block clustering tree, establishing a first association edge between any two child nodes belonging to the same parent node (such as a directory parent node and / or a community parent node). The first association edge can be a structural edge, used to represent that the two child nodes have the same parent node relationship in the text block clustering tree, and assigning a first edge weight to the first association edge; next, calculating the semantic similarity between preset text blocks corresponding to each child node, and establishing a second association edge between any two child nodes whose semantic similarity is higher than a preset threshold. The second association edge can be a semantic edge, used to represent that the preset text blocks corresponding to these two child nodes have a high degree of similarity at the semantic level, and assigning a second edge weight to the second association edge; finally, forming a text block clustering graph composed of multiple child nodes and the first and second association edges set between the child nodes, wherein the association edge is used to represent that there is an association relationship between the corresponding two child nodes.
[0095] Figure 4 This is a schematic diagram of a text block clustering graph provided in an embodiment of this application, such as... Figure 4 As shown, in the text block clustering graph, there is a first association edge and a second association edge between node i and node j, a first association edge between node i and node k, and a second association edge between node i and node m.
[0096] Figure 5 This is a schematic diagram illustrating another method for selecting a search path in search enhancement generation provided in an embodiment of this application. For example... Figure 5 As shown, the node value score is determined based on the retrieval distribution probability, including steps 510 to 540.
[0097] Step 510: Determine the initial distribution probability of the child node based on the similarity between the preset text block corresponding to the child node and the question to be answered. The initial distribution probability is used to characterize the probability that the child node is associated with the question to be answered.
[0098] Taking node i as an example, based on the similarity between the preset text block corresponding to node i and the question to be answered, the initial probability distribution R of node i can be determined. i .
[0099] Specifically, using the above formula (2), the value scores of the child nodes of node i can be calculated. By normalizing the value scores of the child nodes, the initial distribution probability of node i can be obtained. For example, the normalization method can be any of the following: min-max normalization, standardization, and logarithmic normalization.
[0100] Step 520: Determine the jump condition probability of the child node based on the correlation between the child nodes; wherein, the jump condition probability is used to characterize the probability of jumping from the selected child node to the current child node during the retrieval path selection process.
[0101] For example, the association between child nodes can be obtained from the text block clustering graph. For instance, the first association edge and the second association edge in the text block clustering graph can represent the association between two nodes, that is, the association between child nodes.
[0102] In some examples, step 520 includes determining the jump conditional probability of the fifth child node relative to the fourth child node based on the first edge weight and / or the second edge weight between the fourth child node and the fifth child node, and the first edge weight and / or the second edge weight between the fourth child node and its corresponding neighboring child nodes.
[0103] For example, the fourth child node and the fifth child node are any two nodes in the text block clustering graph, corresponding to two child nodes in the text block clustering tree, and each corresponding to a preset text block.
[0104] For example, neighbor child nodes are used to represent one or more child nodes in the text block clustering graph that have an associated edge with the node. For example, Figure 4 In the example, the neighboring child nodes of node i are j, k, and m, the neighboring child node of node k is i, and node m is a non-neighboring child node of node k.
[0105] For example, the jump conditional probability can represent the probability of the fourth child node jumping to the fifth child node and the probability of the fifth child node jumping to the fourth child node. The jump probability between nodes actually corresponds to the jump probability between text blocks. The jump conditional probability can be represented by a matrix.
[0106] For example, the probability M of node i jumping to j ij It can be calculated using the following formula (4): , formula (4); Among them, M ij W represents the probability of jumping from node i to node j. ij Let W be the weight of the edge (i, j) between node i and node j; N(i) is the set of all neighboring child nodes of node i, where a neighboring child node is a node that has a direct connection with node i (i.e., there is a first associated edge and / or a second associated edge); k is a certain neighboring child node in the set of neighboring child nodes of node i; W is the weight of the edge between node i and node j. ik Let be the weight of the edge (i, k) between node k and node i in the neighboring child nodes. The denominator is ∑ k∈N(i) W ikThis represents the sum of the edge weights between node i and all its neighboring nodes.
[0107] In the process of obtaining the weights of edges, if there are both a first associated edge and a second associated edge between node i and node j, then the weight of edge (i, j) is the sum of the weights of the two edges. For example, in the calculation process, W ij Let (i, j) be the sum of the weights of the first and second edges of edge (i, j).
[0108] Here, node j can be either a neighboring child node of node i or a non-neighboring child node of node i. For non-neighboring nodes, W ij Since M is 0, ij It is 0.
[0109] Step 530: Determine the retrieval distribution probability of the child node based on the initial distribution probability and the jump condition probability; wherein, the retrieval distribution probability is used to characterize the probability that the child node will be selected in the retrieval path selection process after multiple rounds of retrieval.
[0110] In some examples, step 530 includes: determining the restart retrieval probability based on the preset restart retrieval coefficient and the initial distribution probability; determining the retrieval distribution probability corresponding to the fourth child node in the t-th round based on the restart retrieval probability and the jump condition probability of the neighboring child nodes of the fourth child node in the (t-1)th round jumping to the fourth child node; iterating in this way until the change in the retrieval distribution probability corresponding to the fourth child node is less than a preset threshold. The probability of restarting the search is used to characterize the probability of terminating the current search path selection and restarting the search based on the question to be answered.
[0111] For example, the retrieval probability P corresponding to the fourth child node in the t-th round i (t) can be calculated using the following formula (5): , formula (5); The meanings and methods of obtaining each parameter in formula (5) are as follows: 1. t represents the iteration round. The iteration here is not a true multi-round search, but a simulated search process performed before the formal search. Iteration continues until the P-value converges (i.e., P satisfies P...). i (t)-P i When (t-1) is less than the preset threshold, the iteration stops. Generally, depending on the number of nodes, t represents 50 to 200 iteration rounds.
[0112] 2. P i (t) represents the value of P corresponding to node i in the current round, where P i(t-1) represents the value of P corresponding to node i in the previous round of calculation. For example, when t=2, t-1=1, and the initial value of the retrieval probability distribution P is obtained. i (t)=P i (1) can be obtained from the aforementioned initial probability vector R i The initial probability distribution R is determined directly, based on the calculated and normalized similarity between the query and the text block. i As the initial steady-state probability value for the first round ( =R i ).
[0113] 3. c is the restart coefficient. During the retrieval process, there is a certain probability that the search will gradually deviate from the original question after multiple rounds of searching. Therefore, by setting the restart coefficient, a certain probability of randomly restarting is set based on experience, indicating that the search will start again from the original question. c represents the probability of continuing the search based on the current node, 1-c represents the probability of restarting, and c is a pre-set constant, such as 0.8.
[0114] 4. M ki M represents the probability that node i's neighbor node k will jump from node k to node i. ki Specifically, M can be calculated using the formula (4) above. ik Then perform matrix transpose, i.e., M ki =M ik T To obtain the probability M of jumping from node k to node i. ki .
[0115] In the above manner, during each round of calculating the retrieval distribution probability, (1-c) is used. R i The addition of this ensures that the initial relevant nodes are probabilistically replenished in each round.
[0116] Using the method described in the example above, before the actual retrieval, a multi-round retrieval process is simulated (i.e., t in the above formula). Based on this, the probability of each child node being selected after the simulated multi-round retrieval is calculated (i.e., the converged P-value in the above formula). This allows for the estimation of the probability that each child node might be retrieved during the actual retrieval process. It should be noted that the calculation of the above P-value does not involve calling LLM, allowing for rapid simulation, iteration, and calculation, thus not adversely affecting system response time or user experience.
[0117] Step 540: Determine the node value score corresponding to the child node based at least on the retrieval distribution probability.
[0118] For example, the node value score corresponding to a child node can be determined based on the retrieval probability and the value of the parent node.
[0119] In some examples, the value of a parent node can be determined as follows: the distribution weight of the child node is determined based on the retrieval distribution probability; the value of the child node is determined based on the similarity between the preset text block corresponding to the child node and the question to be answered; and the value of the parent node is determined based on the distribution weight and distribution reference value of each child node corresponding to the same parent node.
[0120] For example, the value of a parent node can be obtained from the child nodes of all the child nodes corresponding to that parent node.
[0121] For example, the value of the parent node to which the child node belongs can be calculated using the following formula (6): V_parent= W1 S_node_1+ W2 S_node_2+...+W n S_node_n, formula (6); Where V_parent is the value of the parent node; S_node_1, S_node_2...S_node_n are the values of all child nodes corresponding to the parent node, and the values of child nodes can be calculated in the same way as in formula (2) above; W1, W2...W n The distribution weights are obtained by normalizing the probabilities of the retrievals for all child nodes corresponding to the parent node.
[0122] In other words, formula (6) provides a method to determine the value of a parent node by multiplying and summing the distribution weights and distribution reference values of each child node corresponding to the same parent node.
[0123] For example, since P is calculated in the aforementioned steps i The process takes all child nodes as the calculation object; therefore, for child nodes under the same directory tag / community tag, their P... i The sum of the values will be less than 1, so it is necessary to check the P values corresponding to all child nodes under the same directory tag / community tag. i Perform normalization processing, and then use the normalized W... i The weights are used as distribution weights in the calculation. That is, P... i This represents the "global probability of being accessed". Therefore, within a certain tag, the sum of its probabilities is less than 1, and it needs to be normalized again before it can be used as the weight within that tag.
[0124] In some examples, the node value score of child node i can be calculated using the following formula (7): Score = α·P i + β·S_parent, Formula (7); Where Score is the node value score of the child node; P i V_parent represents the global probability of the child node being accessed; V_parent is the value of the parent node of the child node, which can be determined according to the above formula (6); α is the child node value weight coefficient, which is used to adjust the contribution ratio of the degree of association between the child node and the question in the node value score. Its value range is usually between 0 and 1. The larger the value, the more important the node's own retrieval value is; β is the parent node value weight coefficient, which is used to adjust the contribution ratio of the parent node value in the node value score. Its value range is usually between 0 and 1. The larger the value, the more important the value of the upper-level node in the knowledge hierarchy is; α and β are adjustable parameters. The two weight coefficients satisfy the normalization condition, that is, α + β = 1; The specific values of α and β can be determined by setting them through experience or by optimizing them based on the validation set. Technical personnel in the relevant technical field can adjust the parameter values according to the needs of the actual application scenario through conventional experimental methods so that the retrieval system can achieve optimal performance in a specific task.
[0125] In the above example, based on the association edge structure in the text block clustering graph, the node value score can identify and quantify the implicit semantic relationships between nodes, enabling the retrieval path to cross traditional clustering boundaries and discover information that is scattered across different knowledge regions but is semantically highly related. By introducing jump conditional probability, the node value score can simulate the dynamic evolution of the retrieval path, predicting the probability of jumping from a selected node to a candidate node, thus achieving forward-looking planning and real-time optimization of the retrieval path. Ultimately, the node value score efficiently allocates computing resources to nodes with high retrieval distribution probabilities, thereby achieving comprehensive and accurate retrieval of related information in the process of retrieving complex questions, significantly improving retrieval efficiency, and providing an efficient and accurate retrieval solution for complex question-answering scenarios.
[0126] In some of the examples above, the node value score not only integrates the direct relevance between child nodes and the question through the value of child nodes, but also integrates the aggregate value of parent nodes through the value of parent nodes, and introduces structured association information between nodes by constructing a text block clustering graph. In other examples, the node value score can also be determined based on the retrieval distribution probability, which is obtained from the initial distribution probability and the jump conditional probability. Therefore, the node value score in this method also comprehensively considers the relevance of the question and the association between nodes. Obviously, the introduction of node value scores enables value assessment to focus on both the direct matching degree between nodes and questions and the semantic propagation path in the knowledge network, realizing a leap from static similarity assessment to dynamic retrieval path value assessment.
[0127] In some examples, to avoid insufficient recall with optimal path, node coverage is introduced in the calculation of node value, so as to obtain an optimized node value score based on the above.
[0128] Among them, node coverage rate can characterize the proportion of the text block range covered or contained by the child node to the whole text set, reflecting the breadth and representativeness of the child node in the knowledge system.
[0129] In some examples, first, node coverage is determined based on the number of selected child nodes in the current retrieval path and the total number of child nodes in the text block clustering tree; then, node value scores are determined based on child node values, parent node values, and node coverage.
[0130] For example, node coverage can be calculated in real time during the retrieval process using the following formula (8): S_coverage = number of visited child nodes / total number of child nodes, formula (8); The number of visited child nodes refers to the number of preset text blocks that have been retrieved up to the current time, and the total number of child nodes refers to the total number of preset text blocks corresponding to a certain preset text.
[0131] For example, regarding the determination of node value scores based at least on the values of child nodes and parent nodes in the aforementioned embodiments, the optimized node value scores can be obtained using the following formula (9): Score = α·S_node + β·S_parent + γ·S_coverage, formula (9); Here, γ is the coverage weight coefficient, used to adjust the contribution ratio of node coverage or information completeness to the overall score. Its value is usually between 0 and 1, with a larger value indicating greater emphasis on the node's information coverage capability. The three weight coefficients α, β, and γ satisfy the normalization condition, i.e., α + β + γ = 1, to ensure that the evaluation indicators of each dimension maintain a reasonable weight distribution in the overall score. The specific values of α, β, and γ can be determined through empirical settings or optimization based on a validation set. Technical personnel can adjust the parameter values according to the needs of actual application scenarios through conventional experimental methods to enable the retrieval system to achieve optimal performance in specific tasks.
[0132] For example, regarding the determination of the node value score corresponding to the child node based at least on the retrieval distribution probability in steps 510 to 540 above, the optimized node value score can be obtained by the following formula (10): Score = α·P i + β·V_parent + γ·S_coverage, formula (10); Wherein, S_coverage is the node coverage rate, which can be calculated using the above formula (8) during the actual retrieval process.
[0133] Step 320: Determine the second candidate text block corresponding to the second child node based on the second child node.
[0134] For example, the second candidate text block corresponding to the second child node is determined based on the relationship between the child node and the preset text block.
[0135] For example, the second child node retrieved from the first child node forms a retrieval path. The first child node corresponds to the first candidate text block, and the second child node corresponds to the second candidate text block. This retrieval path reflects the association between the first candidate text and the second candidate text block in the text block clustering tree. Alternatively, the first candidate text block and the second candidate text block constitute a retrieval path, which is mapped in the text block clustering tree to the path relationship between the first child node and the corresponding second child node, where the first child node corresponds to the first candidate text block, and the second child node corresponds to the second candidate text block.
[0136] In the above examples, the method provided in this application comprehensively considers the degree of association between text blocks and the degree of association with the question based on the node value score, realizing the transition from single similarity evaluation to multi-dimensional comprehensive evaluation. It effectively performs a comprehensive and accurate retrieval of text blocks in the knowledge base that may be related to the question, significantly improving the coverage and accuracy of the retrieval results, thereby ensuring a more ideal effect in answer generation.
[0137] Figure 6 This is a schematic diagram illustrating another method for selecting a search path in search enhancement generation provided in an embodiment of this application. For example... Figure 6 As shown, in some examples, step 130 includes steps 610 to 640.
[0138] Step 610: If the first contribution corresponding to the first candidate text block is within a second preset range, obtain the parent node value of multiple candidate parent nodes; wherein, the candidate parent nodes are the other parent nodes in the text block clustering tree besides the first parent node.
[0139] For example, if the first contribution is within a second preset range, it indicates that the first candidate text block is less effective for the question to be answered. Therefore, the next round of retrieval can be instructed to be performed under other cluster labels besides the cluster label of the first candidate text block.
[0140] For example, the second preset range can be 0-0.6 (inclusive). In the text block clustering tree, find the first child node corresponding to the first candidate text block, and then find the corresponding first parent node based on the first child node. This first parent node is the cluster label to which the first candidate text block belongs. Other parent nodes besides the first parent node are then considered as candidate parent nodes.
[0141] For example, if the first contribution is 0.4, and the first contribution falls within a second preset range, then the cluster label information in the text block clustering tree, excluding the cluster label information corresponding to the first candidate text block, is used as the range for the next round of retrieval, and at least one second candidate text block is determined from this range. If the first contribution is 0.4, it means that it is very likely that no text block closest to the answer can be found in the cluster label corresponding to the first candidate text block, so it is necessary to search other ranges to determine a second candidate text block that better solves the answer.
[0142] In some examples, there are multiple candidate parent nodes. It is necessary to obtain the parent node value for each candidate parent node and select one as the second parent node. The parent node value can be calculated based on the child node values of all its corresponding child nodes.
[0143] For example, the value of the parent node can be obtained according to the method of formula (3) or formula (6) in the foregoing embodiments.
[0144] Step 620: Determine the parent node with the highest parent node value among the candidate parent nodes as the second parent node.
[0145] In some examples, if there is only one candidate parent node, then that candidate parent node can be determined as the second parent node.
[0146] In some examples, there are multiple candidate parent nodes. These candidate parent nodes are arranged in descending order of their parent node value, and one or more of the top-ranked parent nodes are selected as the second parent node. The second parent node determines the scope of the next round of retrieval.
[0147] Step 630: Determine the child node with the highest node value score in the second parent node as the second child node.
[0148] In some examples, a second parent node has multiple child nodes, each with a node value score. The multiple child nodes corresponding to the second parent node are arranged in descending order of their node value scores, and one or more child nodes at the beginning of the list are selected as the second child node.
[0149] In some examples, one or more child nodes with the highest node value score are determined from among multiple second parent nodes; the one or more child nodes determined from each second parent node are sorted from high to low according to the node value score of each child node, and the one or more child nodes at the top of the list are selected as the second child nodes.
[0150] Step 640: Determine the second candidate text block corresponding to the second child node based on the second child node.
[0151] For example, the second candidate text block corresponding to the second child node is determined based on the relationship between the child node and the preset text block.
[0152] In the above example, the node value score comprehensively evaluates the correlation between text blocks and their relevance to the question to be answered, providing a reasonable judgment criterion. On one hand, the node value score indicates the precise selection of the second child node with the highest value from the first parent node, ensuring that the retrieval direction is closely related to the question. On the other hand, the node value score indicates the identification of the second parent node with higher aggregation value in the text block clustering tree, and further determines its high-value second child nodes based on the value orientation of the parent node. Through this two-way selection mechanism, the node value score effectively achieves the precise selection of the retrieval path, avoids the waste of resources caused by blind expansion, and significantly improves retrieval efficiency and result quality.
[0153] Step 140: Determine the target content corresponding to the question to be answered, based at least on the second candidate text block and / or the first candidate text block.
[0154] For example, the target content can be an answer generated by a preset model, which corresponds to the question to be answered and can be directly presented to the user to answer the user's question. The preset model can be a large language model, a model based on LSTM (Long Short-Term Memory) or GRU (Gated Recurrent Unit) encoder-decoder architecture, etc.
[0155] For example, the first and second candidate text blocks are first concatenated to form complete context information, while ensuring that the concatenated context information does not exceed the input length limit of the preset model. During the concatenation process, duplicate content is removed to ensure the logical coherence of the context information and avoid information fragmentation. Then, the question to be answered and the context information are input into the preset model (such as a large language model, a model based on an encoder-decoder architecture of LSTM or GRU, etc.). The preset model understands and infers based on the domain knowledge in the target content to generate an answer to the question to be answered.
[0156] In some examples, in step 130, a retrieval path selection is performed based on each second candidate text block, the second contribution score corresponding to each second candidate text block, and the text block clustering tree. The retrieval path selection also includes: determining at least one third child node corresponding to the first parent node based on the node value score, and determining the third candidate text block corresponding to the third child node; and / or, determining at least one third child node corresponding to the second parent node based on the node value score, and determining the third candidate text block corresponding to the third child node; and / or, determining the third parent node and at least one third child node corresponding to the third parent node in the text block clustering tree based on the node value score, and determining the third candidate text block corresponding to the third child node. Finally, the retrieval path selection is performed based on the third candidate text block until the retrieval path selection meets the preset termination condition, and the target content corresponding to the question to be answered is obtained.
[0157] For example, since the first contribution values belong to different ranges, the second child node corresponding to the second candidate text block may be determined from the child nodes corresponding to the first parent node, and the second child node corresponding to the second candidate text block may also be determined from the child nodes corresponding to the second parent node. Therefore, the determination of the third child node is as follows: if the second child node corresponding to the second candidate text block comes from the first parent node and the second contribution value falls within the first preset range, the third child node can be determined from the child nodes corresponding to the first parent node; if the second child node corresponding to the second candidate text block comes from the second parent node and the second contribution value falls within the first preset range, the third child node can be determined from the child nodes corresponding to other parent nodes besides the first parent node; if the second child node corresponding to the second candidate text block comes from the second parent node and the second contribution value falls within the second preset range, the third child node can be determined from the child nodes corresponding to other parent nodes besides the second parent node.
[0158] For example, after determining the second child node, if the second candidate text block corresponding to the second child node has not yet reached the preset termination condition of the retrieval path, it is necessary to further obtain the third child node and its corresponding third candidate text block based on the second child node, so that the retrieval ends and the target content is generated when the third candidate text block reaches the preset termination condition of the retrieval path.
[0159] Among them, the node value score is used to characterize at least the degree of association between the third candidate text block and / or the first candidate text block, the degree of association between the third candidate text block and / or the second candidate text block, and the degree of association between the third candidate text block and the question to be answered; each second child node corresponds to at least one third child node.
[0160] Figure 7 This application provides another method for selecting a search path in search enhancement generation. In some examples, search path selection is performed based on a third candidate text block until the search path selection meets a preset termination condition, thereby obtaining the target content corresponding to the question to be answered, such as... Figure 7 As shown, steps 710 to 740 are included.
[0161] Step 710: Determine one or more candidate retrieval paths based on at least each first child node, each second child node, and each third child node.
[0162] For example, the first child node1 and its corresponding second child node12 form the first candidate search path, the first child node2 and its corresponding second child node22 form the second candidate search path, and the first child node3 and its corresponding second child node23 form the third candidate search path, and so on.
[0163] Step 720: Based on the first contribution of each first child node and the first decay weight corresponding to the first child node, the second contribution of each second child node and the second decay weight corresponding to the second child node, and the third contribution of each third child node and the third decay weight corresponding to the third child node, determine the cumulative value corresponding to each candidate retrieval path; wherein, the first decay weight, the second decay weight and the third decay weight are determined according to the retrieval order of the first child node, the second child node and the third child node in the corresponding candidate retrieval path.
[0164] For example, the decay weights of the first child nodes node1, node2 and node3, and the decay weights of the second child nodes node12, node22 and node23 are obtained respectively. Based on the node value scores of the first child nodes node1, node2 and node3 and the node value scores of the second child nodes node12, node22 and node23, the first cumulative value of the first candidate retrieval path, the second cumulative value of the second candidate retrieval path and the third cumulative value of the third candidate retrieval path are determined respectively.
[0165] For example, the cumulative value of a candidate retrieval path is calculated using the following formula: V=Σ(α k r_k), Formula (11); Where V represents the cumulative value of the candidate retrieval path, α represents the decay weight, k represents the k-th round of retrieval, and r_k represents the node value score of the child node selected in the k-th round.
[0166] For example, the decay weight α ranges from 0 to 1, and the α corresponding to the child node retrieved earlier is higher than the α corresponding to the child node retrieved later. That is, α decreases from the first round to the last round. For instance, in the first candidate retrieval path, the α corresponding to the second child node is lower than the α corresponding to the first child node. The specific value of α can be determined empirically or by tuning based on a validation set. Those skilled in the art can adjust the parameter value according to the needs of the actual application scenario through conventional experimental methods to enable the retrieval system to achieve optimal performance in a specific task.
[0167] For example, the first cumulative value of the first candidate retrieval path formed by node1 and node12 is calculated using formula (11): The first power of the decay weight of the first child node1 is determined, and the node value score of the first child node1 is determined; the first power of the decay weight of node1 is multiplied by the node value score of node1 as the first cumulative term in formula (11); the square power of the decay weight of the second child node12 is determined, and the node value score of the second child node12 is determined; the square power of the decay weight of node12 is multiplied by the node value score of node12 as the second cumulative term in formula (11); the first and second cumulative terms are added together to obtain the first cumulative value of the first candidate retrieval path. Similarly, the second cumulative value of the second candidate retrieval path formed by node2 and node22, and the third cumulative value of the third candidate retrieval path formed by node3 and node32 can be calculated.
[0168] Step 730: Based on the cumulative value corresponding to each candidate retrieval path, determine one or more target retrieval paths, including: Based on the cumulative value corresponding to the candidate search paths, candidate search paths whose cumulative value meets preset conditions are determined as target search paths; and / or, Based on the growth rate of the cumulative value corresponding to each candidate search path during multiple rounds of retrieval, the candidate search path with a growth rate higher than a preset threshold is selected as the target search path.
[0169] In some examples, candidate search paths whose cumulative value meets preset criteria are identified as target search paths.
[0170] Taking the three candidate search paths mentioned above as an example, the two candidate search paths with the highest cumulative value are determined as the target search paths. For example, if the first and second cumulative values are both greater than the third cumulative value, then L1 and L2, corresponding to the first and second cumulative values, are taken as the target search paths. This method can be used alone or in combination with the screening method based on the change in cumulative value described below.
[0171] In some examples, based on the growth rate of the cumulative value corresponding to each candidate search path during multiple rounds of retrieval, candidate search paths with a growth rate higher than a preset threshold are selected as target search paths. This includes: based on the change range of the cumulative value, recording the cumulative value obtained after each round of retrieval for each candidate search path, and further calculating the change range of each cumulative value after each round of retrieval, thereby filtering candidate search paths.
[0172] For example, if the cumulative value growth rate after multiple rounds of retrieval in a candidate retrieval path is higher than a preset threshold, then the retrieval path is determined as the retrieval path to be searched.
[0173] Figure 8 This is a schematic diagram illustrating a candidate retrieval path provided in an embodiment of this application. Taking the three candidate retrieval paths mentioned above as examples, such as... Figure 8As shown, the first, second, and third candidate search paths can involve four rounds of retrieval. Their corresponding third nodes are node13, node23, and node33, respectively, and their corresponding fourth nodes are node14, node24, and node34, respectively. After the second round of retrieval, the first candidate search path L1 is node1-node12 with a first cumulative value of V11; the second candidate search path L2 is node2-node22 with a second cumulative value of V21; and the third candidate search path L3 is node3-node32 with a third cumulative value of V31. After the third round of retrieval, the first candidate search path L1 is node1-node12-node13 with a first cumulative value of V12; the second candidate search path L2 is node2-node22-node23 with a second cumulative value of V22; and the third candidate search path L3 is node3-node32-node33 with a third cumulative value of V32. After the fourth round of retrieval, the first candidate retrieval path L1 is node1-node12-node13-node14, with a first cumulative value of V13; the second candidate retrieval path L2 is node2-node22-node23-node24, with a second cumulative value of V23; and the third candidate retrieval path L3 is node3-node32-node33-node34, with a third cumulative value of V33. After the third round of retrieval, the growth rates corresponding to the first, second, and third candidate retrieval paths are (V12-V11) / 1, (V22-V21) / 1, and (V32-V31) / 1, respectively. After the fourth round of retrieval, the growth rates corresponding to the first, second, and third candidate retrieval paths are (V13-V12) / 1, (V23-V22) / 1, and (V33-V32) / 1, respectively. If (V12-V11) / 1 and (V13-V12) / 1 are higher than preset thresholds, then the first candidate retrieval path L1 is taken as the target retrieval path. Other candidate retrieval paths can be determined in a similar way.
[0174] Step 740: If the target retrieval path meets the preset termination conditions, determine the target content corresponding to the question to be answered based on the candidate text blocks corresponding to each sub-node in the target retrieval path.
[0175] For example, the preset termination condition can be that if the contribution of the candidate text blocks retrieved in the current round reaches a third preset range, the retrieval is successful and the retrieval stops, and all candidate text blocks on the target retrieval path are input into the LLM to generate the target content corresponding to the question to be answered.
[0176] For example, if the third candidate text block's third contribution reaches the third preset range (e.g., 0.9-1), the retrieval is successful and the retrieval ends; the first, second, and third candidate text blocks are used as context inputs into the LLM, the result is output, and the result is presented to the user as the target content.
[0177] Therefore, this step, based on the overall accuracy and effectiveness of the retrieval path, accurately retains the target retrieval path with high accuracy and effectiveness, and generates target content based on each candidate text block on the target retrieval path; thus improving the accuracy and relevance of generating target content based on text blocks.
[0178] In some examples, if the target search path does not meet the preset termination criteria, the search needs to continue until the preset termination criteria are met. The path filtering in the preceding steps further narrows the scope of the next round of search, making the subsequent search process more efficient and accurate.
[0179] For example, if the third contribution of the third candidate text block does not fall within the third preset range, then it is still necessary to perform a search based on the third candidate text block. If at least one sixth candidate text block obtained in the next round of search meets the preset termination condition (i.e., the sixth contribution of at least one sixth candidate text block falls within the third preset range), then the current round of search can end and the search can be stopped, and the target content can be output.
[0180] For example, step 740 includes: if the target retrieval path does not meet the preset termination conditions, performing retrieval path selection based on the third candidate text block corresponding to at least one third child node in each target retrieval path, the third contribution value corresponding to each third candidate text block, and the text block clustering tree; the retrieval path selection includes: determining at least one sixth child node corresponding to the parent node of the third child node according to the node value score, and determining the sixth candidate text block corresponding to the sixth child node; and / or, determining the fourth parent node and at least one sixth child node corresponding to the fourth parent node in the text block clustering tree according to the node value score, and determining the sixth candidate text block corresponding to the sixth child node; determining the target content corresponding to the question to be answered based at least on the sixth candidate text block, the second candidate text block, and / or the first candidate text block.
[0181] Among them, the node value score is used to characterize at least the degree of association between the sixth candidate text block and / or the third candidate text block, the third candidate text block and the second candidate text block, the second candidate text block and the first candidate text block, and the degree of association between the sixth candidate text block and the question to be answered; each third child node corresponds to at least one sixth child node.
[0182] For example, if the third contribution score of the third candidate text block is within a first preset range, the child node with the highest node value score among the parent nodes corresponding to the third child node is determined as the sixth child node; and the corresponding sixth candidate text block is determined based on the sixth child node. For example, the aforementioned retrieval path selection indicates that the third child node may correspond to the first parent node, the second parent node, or the third parent node. Therefore, if the third contribution score is between 0.6 and 0.9, the next round of retrieval can continue under the parent node corresponding to the third child node to determine the sixth child node.
[0183] For example, when the third contribution is within a second preset range, the parent node values of multiple candidate parent nodes are obtained; the parent node with the highest candidate parent node value among the candidate parent nodes is determined as the fourth parent node, and the child node with the highest node value score among the child nodes corresponding to the fourth parent node is determined as the sixth child node, and the sixth candidate text block corresponding to the sixth child node is determined. For example, when the third contribution is between 0 and 0.6, other parent nodes besides the parent node corresponding to the third child node can be used as candidate parent nodes, the parent node with the highest parent node value among the candidate parent nodes can be determined as the fourth parent node, and the child node with the highest node value score among the child nodes corresponding to the fourth parent node can be determined as the sixth child node.
[0184] For example, if the contribution of the sixth candidate text block reaches the third preset range, the retrieval is successful and the retrieval stops. The first, second, third and sixth candidate text blocks on the target retrieval path are used as context inputs into the LLM, the result is output, and the result is presented to the user as the target content.
[0185] This step is performed after the target retrieval path has been filtered in step 730. In other words, the sixth candidate text block is determined based on the third candidate text block in the target retrieval path identified from the candidate paths. For example, using the first candidate retrieval path L1 as the target retrieval path, the corresponding sixth candidate text blocks are determined based on the third candidate text blocks node13 and node23 in L1 and L2, respectively. Filtering the retrieval path narrows the retrieval scope, reduces the amount of data retrieved subsequently, and facilitates efficient and accurate retrieval.
[0186] The method provided in this application not only effectively filters low-value nodes and improves the accuracy of search results, but also ensures that only high-value nodes are expanded through path selection based on value scores, avoiding the data explosion problem caused by indiscriminate expansion in traditional methods and significantly improving resource utilization efficiency. At the same time, the text block clustering tree structure enables knowledge scattered in different fields to be associated through parent nodes, realizing the rapid integration of cross-domain information, providing a hierarchical knowledge organization foundation for node value assessment, reducing the computational overhead caused by multi-round retrieval, and providing a more efficient solution for the application of retrieval enhancement generation technology in complex question-answering scenarios. Figure 9 This is a schematic diagram of a retrieval path selection device in retrieval enhancement generation provided in an embodiment of this application. For example... Figure 9 As shown, the retrieval path selection device 900 in the retrieval enhancement generation includes: a first determining module 910, a second determining module 920, a third determining module 930, and a content generation module 940. Wherein: The first determining module 910 is configured to: determine multiple first candidate text blocks corresponding to the unanswered question based on the user input and multiple preset text blocks, and determine the first contribution of each first candidate text block.
[0187] The second determining module 920 is configured to: determine the first child node and the first parent node of each first candidate text block in a preset text block clustering tree based on each first candidate text block; wherein, the text block clustering tree is constructed by multiple preset text blocks according to preset clustering labels, the clustering labels are obtained by a preset model based on multiple preset text blocks, the text block clustering tree includes multiple parent nodes, each parent node corresponds to multiple child nodes, the parent node is composed of clustering labels, and the child nodes are composed of preset text blocks.
[0188] The third determining module 930 is configured to: perform retrieval path selection based on each first candidate text block, the first contribution corresponding to each first candidate text block, and the text block clustering tree; the retrieval path selection includes: determining at least one second child node corresponding to the first parent node based on the node value score, and determining the second candidate text block corresponding to the second child node; and / or, determining the second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree based on the node value score, and determining the second candidate text block corresponding to the second child node; wherein, the node value score is at least used to characterize the degree of association between the second candidate text block and / or the first candidate text block and the degree of association between the second candidate text block and the question to be answered; each first child node corresponds to at least one second child node.
[0189] The content generation module 940 is configured to determine the target content corresponding to the question to be answered, based at least on the second candidate text block and / or the first candidate text block.
[0190] In some embodiments, the third determining module 930 is configured to: determine the node value score based at least on the values of child nodes and the values of parent nodes; wherein the value of a child node is used at least to characterize the degree of association between a preset text block and the question to be answered, and the value of a parent node is determined based on the values of the child nodes of all the child nodes corresponding to the parent node.
[0191] In some embodiments, the third determining module 930 is configured to: determine the initial distribution probability of a child node based on the similarity between the preset text block corresponding to the child node and the question to be answered, wherein the initial distribution probability is used to characterize the probability that the child node is associated with the question to be answered; determine the jump condition probability of a child node based on the association between child nodes, wherein the jump condition probability is used to characterize the probability of jumping from a selected child node to the current child node during the retrieval path selection process; determine the retrieval distribution probability of a child node based on the initial distribution probability and the jump condition probability, wherein the retrieval distribution probability is used to characterize the probability that the child node is selected during the retrieval path selection process after multiple rounds of retrieval; and determine the node value score corresponding to the child node based at least on the retrieval distribution probability.
[0192] In some embodiments, the third determining module 930 is configured to: construct a text block clustering graph based on the text block clustering tree; wherein the text block clustering graph consists of multiple child nodes and at least two associated edges between the child nodes, the associated edges being used to characterize the association relationship between the corresponding two child nodes; the associated edges include a first associated edge and a second associated edge, the first associated edge being used to characterize that the two child nodes belong to the same parent node in the text block clustering tree, and the second associated edge being used to characterize that the semantic similarity between the preset text blocks corresponding to the two child nodes is higher than a preset threshold; the first associated edge corresponds to a first edge weight, and the second associated edge corresponds to a second edge weight.
[0193] In some embodiments, the third determining module 930 is configured to: determine the jump conditional probability of the fifth child node relative to the fourth child node based on the weight of the first edge and / or the weight of the second edge between the fourth child node and the fifth child node, and the weight of the first edge and / or the weight of the second edge between the fourth child node and its corresponding neighboring child nodes; wherein, the neighboring child nodes are used to represent one or more child nodes in the text block clustering graph that have an associated edge with the fourth child node; wherein, the fourth child node and the fifth child node are any two child nodes in the text block clustering graph.
[0194] In some embodiments, the third determining module 930 is configured to: determine the retrieval distribution probability corresponding to the fourth child node in the t-th round based on the restart retrieval probability and the jump condition probability of the neighboring child nodes of the fourth child node in the (t-1)-th round jumping to the fourth child node; iterate in this manner until the change in the retrieval distribution probability corresponding to the fourth child node is less than a preset threshold; wherein, the restart retrieval probability is determined based on a preset restart retrieval coefficient and the initial distribution probability, and the restart retrieval probability is used to characterize the probability of terminating the current retrieval path selection and re-retrieving based on the question to be answered.
[0195] In some embodiments, the third determining module 930 is configured to: determine the distribution weight corresponding to the child node based on the retrieval distribution probability; determine the child node value corresponding to the child node based on the similarity between the preset text block corresponding to the child node and the question to be answered; and determine the parent node value based on the distribution weight and distribution reference value of each child node corresponding to the same parent node.
[0196] In some embodiments, the third determining module 930 is configured to: determine a node value score based on the child node value, the parent node value, and the node coverage rate; wherein the node coverage rate is determined based on the number of selected child nodes in the current retrieval path and the total number of child nodes in the text block clustering tree.
[0197] In some embodiments, the third determining module 930 is configured to: perform retrieval path selection based on each second candidate text, the second contribution value corresponding to each second candidate text block, and the text block clustering tree; the retrieval path selection further includes: determining at least one third child node corresponding to the first parent node based on the node value score, and determining the third candidate text block corresponding to the third child node; and / or, determining at least one third child node corresponding to the second parent node based on the node value score, and determining the third candidate text block corresponding to the third child node; and / or, determining the third parent node and at least one third child node corresponding to the third parent node in the text block clustering tree based on the node value score, and determining the third candidate text block corresponding to the third child node; performing retrieval path selection based on the third candidate text block until the retrieval path selection meets a preset termination condition, thereby obtaining the target content corresponding to the question to be answered; wherein, the node value score is at least used to characterize the degree of association between the third candidate text block and / or the first candidate text block, the degree of association between the third candidate text block and / or the second candidate text block, and the degree of association between the third candidate text block and the question to be answered; each second child node corresponds to at least one third child node.
[0198] In some embodiments, the third determining module 930 is configured to: determine one or more candidate retrieval paths based at least on each first child node, each second child node, and each third child node; determine the cumulative value corresponding to each candidate retrieval path based on the first contribution of each first child node and the first decay weight corresponding to the first child node, the second contribution of each second child node and the second decay weight corresponding to the second child node, and the third contribution of each third child node and the third decay weight corresponding to the third child node; wherein the first decay weight, the second decay weight, and the third decay weight are determined according to the retrieval order of the first child node, the second child node, and the third child node in the corresponding candidate retrieval path, respectively; determine one or more target retrieval paths based on the cumulative value corresponding to each candidate retrieval path; and, if the target retrieval path meets a preset termination condition, determine the target content corresponding to the question to be answered based on the candidate text blocks corresponding to each child node in the target retrieval path.
[0199] In some embodiments, the third determining module 930 is configured to: determine the candidate retrieval path whose cumulative value meets the preset conditions as the target retrieval path based on the cumulative value corresponding to the candidate retrieval path; and / or, based on the growth rate of the cumulative value corresponding to each candidate retrieval path in a continuous multi-round retrieval process, determine the candidate retrieval path whose growth rate is higher than the preset threshold as the target retrieval path. In some embodiments, the third determining module 930 is configured to: when the target retrieval path does not meet the preset termination conditions, perform retrieval path selection based on the third candidate text block corresponding to at least one third child node in each target retrieval path, the third contribution degree corresponding to each third candidate text block, and the text block clustering tree; the retrieval path selection includes: determining at least one sixth child node corresponding to the parent node of the third child node according to the node value score, and determining the sixth candidate text block corresponding to the sixth child node; and / or, determining the fourth parent node and at least one sixth child node corresponding to the fourth parent node in the text block clustering tree according to the node value score, and determining the sixth candidate text block corresponding to the sixth child node; wherein, the node value score is used at least to characterize the degree of association between the sixth candidate text block and / or the third candidate text block, the third candidate text block and the second candidate text block, the second candidate text block and the first candidate text block, and the degree of association between the sixth candidate text block and the question to be answered; each third child node corresponds to at least one sixth child node; and at least based on the sixth candidate text block, the second candidate text block, and / or the first candidate text block, determine the target content corresponding to the question to be answered.
[0200] In some embodiments, the second determining module 920 is configured to: query the text block clustering tree based on the first candidate text block to obtain the first child node corresponding to the first candidate text block in the text block clustering tree; and query the text block clustering tree based on the first child node to determine the first parent node corresponding to the first child node in the text block clustering tree.
[0201] In some embodiments, the third determining module 930 is configured to: determine the child node with the highest node value score among the first parent nodes as the second child node when the first contribution of the first candidate text block is within a first preset range; determine the second candidate text block corresponding to the second child node based on the second child node; determine the second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree according to the node value score, and determine the second candidate text block corresponding to the second child node, including: obtaining the parent node value of multiple candidate parent nodes when the first contribution of the first candidate text block is within a second preset range; determining the parent node with the highest parent node value among the candidate parent nodes as the second parent node; and determining the child node with the highest node value score among the second parent nodes as the second child node; and determining the second candidate text block corresponding to the second child node based on the second child node; wherein, the candidate parent node is any parent node other than the first parent node in the text block clustering tree.
[0202] Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of this application. In some embodiments, the electronic device includes one or more processors and a memory. The memory is configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the retrieval path selection method in the retrieval enhancement generation described in the above embodiments.
[0203] like Figure 10 As shown, the electronic device 1000 includes a processor 1001 and a memory 1002. Exemplarily, the electronic device 1000 may further include a communication interface 1003 and a communication bus 1004. The processor 1001, memory 1002, and communication interface 1003 communicate with each other via the communication bus 1004. The communication interface 1003 is used to communicate with other network elements such as clients or other servers.
[0204] In some embodiments, the processor 1001 is used to execute program 1005, specifically performing the relevant steps in the search path selection method embodiment of the search enhancement generation described above. Specifically, program 1005 may include program code, which includes computer-executable instructions.
[0205] For example, processor 1001 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. Electronic device 1000 may include one or more processors, which may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs.
[0206] In some embodiments, memory 1002 is used to store program 1005. Memory 1002 may include high-speed RAM memory and may also include non-volatile memory (NVM), such as at least one disk storage device. Specifically, program 1005 may be invoked by processor 1001 to cause electronic device 1000 to perform the operation of the retrieval path selection method in retrieval enhancement generation.
[0207] This application provides a computer-readable storage medium storing at least one executable instruction. When the executable instruction is executed on an electronic device 1000, the electronic device 1000 performs the retrieval path selection method in the retrieval enhancement generation described in the above embodiments.
[0208] Specifically, the executable instructions can be used to cause the electronic device 1000 to perform the operation of the search path selection method in the search enhancement generation.
[0209] For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, a floppy disk, and an optical data storage device, etc.
[0210] In some embodiments, this application provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions that, when executed by a computer, cause the computer to perform the retrieval path selection method in retrieval enhancement generation as described in any of the above embodiments.
[0211] In some embodiments, this application also provides a computer program that, when executed by a processor, can implement the retrieval path selection method in retrieval enhancement generation as described in any of the above embodiments.
[0212] The beneficial effects that the retrieval path selection device, electronic device, computer-readable storage medium, computer program product, and computer program provided in the embodiments of this application can achieve can be referred to the beneficial effects of the retrieval path selection method in the retrieval enhancement generation provided above, and will not be repeated here.
[0213] It should be noted that in this application, 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 the element.
[0214] 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 apparatus 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.
[0215] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).
[0216] For the purposes of this specification, "computer-readable medium" can mean any means that can contain, store, communicate, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0217] More specific examples of computer-readable media (a non-exhaustive list) include the following: electrical connections having one or more wires (electronic devices), portable computer disks (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM).
[0218] Furthermore, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory. It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof.
[0219] In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.
[0220] The embodiments described above do not constitute a limitation on the scope of protection of this application.
Claims
1. A method for selecting a retrieval path in retrieval enhancement generation, characterized in that, The method includes: Based on the user-input question to be answered and multiple preset text blocks, multiple first candidate text blocks corresponding to the question to be answered are determined, and the first contribution of each first candidate text block is determined. Based on each first candidate text block, determine the first child node and first parent node corresponding to each first candidate text block in a preset text block clustering tree; wherein, the text block clustering tree is constructed by the plurality of preset text blocks according to preset clustering labels, the clustering labels are obtained by a preset model based on the plurality of preset text blocks, the text block clustering tree includes a plurality of parent nodes, each parent node corresponds to a plurality of child nodes, the parent node is composed of the clustering labels, and the child nodes are composed of the preset text blocks; Based on each first candidate text block, the first contribution value corresponding to each first candidate text block, and the text block clustering tree, a retrieval path selection is performed; the retrieval path selection includes: determining at least one second child node corresponding to the first parent node based on the node value score, and determining the second candidate text block corresponding to the second child node; and / or, determining the second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree based on the node value score, and determining the second candidate text block corresponding to the second child node; wherein, the node value score is at least used to characterize the degree of association between the second candidate text block and / or the first candidate text block and the degree of association between the second candidate text block and the question to be answered; each first child node corresponds to at least one second child node; The target content corresponding to the question to be answered is determined based at least on the second candidate text block and / or the first candidate text block.
2. The method according to claim 1, characterized in that, The node value score is determined at least based on the values of child nodes and the values of parent nodes; wherein, the value of a child node is used at least to characterize the degree of association between the preset text block and the question to be answered, and the value of a parent node is determined based on the values of the child nodes of all the child nodes corresponding to the parent node.
3. The method according to claim 1, characterized in that, Determining the node value score includes: Based on the similarity between the preset text block corresponding to the child node and the question to be answered, the initial distribution probability of the child node is determined, wherein the initial distribution probability is used to characterize the probability that the child node is associated with the question to be answered; Based on the correlation between the child nodes, the jump condition probability of the child node is determined; wherein, the jump condition probability is used to characterize the probability of jumping from the selected child node to the current child node during the retrieval path selection process; The retrieval distribution probability of the child node is determined based on the initial distribution probability and the jump condition probability; wherein, the retrieval distribution probability is used to characterize the probability that the child node will be selected during the retrieval path selection process after multiple rounds of retrieval; The node value score corresponding to the child node is determined based at least on the retrieval distribution probability.
4. The method according to claim 3, characterized in that, Before determining the node value score, the method further includes: Construct a text block clustering graph based on the text block clustering tree; The text block clustering graph consists of multiple child nodes and at least two association edges between the child nodes. The association edges are used to represent the association relationship between the two corresponding child nodes. The association edges include a first association edge and a second association edge. The first association edge is used to represent that the two child nodes belong to the same parent node in the text block clustering tree. The second association edge is used to represent that the semantic similarity between the preset text blocks corresponding to the two child nodes is higher than a preset threshold. The first association edge corresponds to a first edge weight, and the second association edge corresponds to a second edge weight.
5. The method according to claim 4, characterized in that, The step of determining the jump condition probability of a child node based on the association between the child nodes includes: Based on the weights of the first and / or second edges between the fourth and fifth child nodes, and the weights of the first and / or second edges between the fourth child node and its corresponding neighboring child nodes, the jump conditional probability of the fifth child node relative to the fourth child node is determined; wherein, the neighboring child nodes are used to represent one or more child nodes in the text block clustering graph that have an associated edge with the fourth child node; wherein, the fourth and fifth child nodes are any two child nodes in the text block clustering graph.
6. The method according to claim 5, characterized in that, Determining the retrieval distribution probability of the child node based on the initial distribution probability and the jump conditional probability includes: Based on the restart retrieval probability and the jump condition probability of the neighboring child nodes of the fourth child node in the (t-1)th round, the retrieval distribution probability corresponding to the fourth child node in the tth round is determined; this process is iterated until the change in the retrieval distribution probability corresponding to the fourth child node is less than a preset threshold. The restart retrieval probability is determined based on a preset restart retrieval coefficient and the initial distribution probability. The restart retrieval probability is used to characterize the probability of terminating the current retrieval path selection and restarting the retrieval based on the question to be answered.
7. The method according to claim 3, characterized in that, The method further includes: The distribution weight corresponding to the child node is determined based on the retrieval distribution probability. The value of the child node is determined based on the similarity between the preset text block corresponding to the child node and the question to be answered. The value of the parent node is determined based on the distribution weights and distribution reference values of each child node corresponding to the same parent node.
8. The method according to claim 2 or 7, characterized in that, Determining the node value score also includes: The node value score is determined based on the value of the child node, the value of the parent node, and the node coverage rate; wherein, the node coverage rate is determined based on the number of selected child nodes in the current retrieval path and the total number of child nodes in the text block clustering tree.
9. The method according to any one of claims 2 to 7, characterized in that, The step of determining the target content corresponding to the question to be answered, based at least on the second candidate text block and / or the first candidate text block, includes: Based on each second candidate text block, the second contribution value corresponding to each second candidate text block, and the text block clustering tree, the retrieval path selection is performed; the retrieval path selection further includes: Based on the node value score, at least one third child node corresponding to the first parent node is determined, and a third candidate text block corresponding to the third child node is determined; and / or, Based on the node value score, at least one third child node corresponding to the second parent node is determined, and a third candidate text block corresponding to the third child node is determined; and / or, Based on the node value score, a third parent node and at least one third child node corresponding to the third parent node are determined in the text block clustering tree, and a third candidate text block corresponding to the third child node is determined. The retrieval path selection is performed based on the third candidate text block until the retrieval path selection meets the preset termination condition, thereby obtaining the target content corresponding to the question to be answered. The node value score is used to characterize at least the degree of association between the third candidate text block and / or the first candidate text block, the degree of association between the third candidate text block and / or the second candidate text block, and the degree of association between the third candidate text block and the question to be answered; each second child node corresponds to at least one third child node.
10. The method according to claim 9, characterized in that, The process of selecting a retrieval path based on the third candidate text block until the selected retrieval path meets a preset termination condition, thereby obtaining the target content corresponding to the question to be answered, includes: One or more candidate retrieval paths are determined based on at least each of the first child nodes, each of the second child nodes, and each of the third child nodes; Based on the first contribution of each first child node and the first decay weight corresponding to the first child node, the second contribution of each second child node and the second decay weight corresponding to the second child node, and the third contribution of each third child node and the third decay weight corresponding to the third child node, the cumulative value corresponding to each candidate retrieval path is determined; wherein, the first decay weight, the second decay weight, and the third decay weight are determined according to the retrieval order of the first child node, the second child node, and the third child node in the corresponding candidate retrieval path; Based on the cumulative value corresponding to each of the candidate retrieval paths, one or more target retrieval paths are determined; If the target retrieval path meets the preset termination condition, the target content corresponding to the question to be answered is determined according to the candidate text blocks corresponding to each sub-node in the target retrieval path.
11. The method according to claim 10, characterized in that, The step of determining one or more target retrieval paths based on the cumulative value corresponding to each of the candidate retrieval paths includes: Based on the cumulative value corresponding to the candidate search paths, the candidate search paths whose cumulative value meets the preset conditions are determined as the target search paths; and / or, Based on the growth rate of the cumulative value corresponding to each candidate search path during multiple rounds of retrieval, the candidate search path with a growth rate higher than a preset threshold is selected as the target search path.
12. The method according to claim 10, characterized in that, The step of performing the retrieval path selection based on the third candidate text block until the retrieval path selection meets the preset termination condition to obtain the target content corresponding to the question to be answered also includes: If the target retrieval path does not meet the preset termination condition, a retrieval path selection is performed based on the third candidate text block corresponding to at least one third child node in each target retrieval path, the third contribution degree corresponding to each third candidate text block, and the text block clustering tree. The retrieval path selection includes: determining at least one sixth child node in the parent node corresponding to the third child node according to the node value score, and determining the sixth candidate text block corresponding to the sixth child node; and / or, determining the fourth parent node and at least one sixth child node corresponding to the fourth parent node in the text block clustering tree according to the node value score, and determining the sixth candidate text block corresponding to the sixth child node. The node value score is used at least to characterize the degree of association between the sixth candidate text block and / or the third candidate text block, the third candidate text block and the second candidate text block, the second candidate text block and the first candidate text block, and the degree of association between the sixth candidate text block and the question to be answered. Each third child node corresponds to at least one sixth child node. The target content corresponding to the question to be answered is determined based at least on the sixth candidate text block, the second candidate text block, and / or the first candidate text block.
13. The method according to any one of claims 1 to 7, characterized in that, The step of determining the first child node and first parent node of each first candidate text block in a preset text block clustering tree based on each first candidate text block includes: Based on the first candidate text block, the text block clustering tree is queried to obtain the first child node corresponding to the first candidate text block in the text block clustering tree; Based on the first child node, query the text block clustering tree to determine the first parent node corresponding to the first child node in the text block clustering tree.
14. The method according to any one of claims 1 to 7, characterized in that, The step of determining at least one second child node corresponding to the first parent node based on the node value score, and determining the second candidate text block corresponding to the second child node, includes: If the contribution score corresponding to the first candidate text block is within a first preset range, the child node with the highest node value score in the first parent node is determined as the second child node; the second candidate text block corresponding to the second child node is determined based on the second child node; The step of determining a second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree based on the node value score, and determining a second candidate text block corresponding to the second child node, includes: When the contribution of the first candidate text block is within a second preset range, the parent node values of multiple candidate parent nodes are obtained; the parent node with the highest parent node value among the candidate parent nodes is determined as the second parent node; and the child node with the highest node value score among the second parent nodes is determined as the second child node; the second candidate text block corresponding to the second child node is determined based on the second child node; wherein, the candidate parent node is any other parent node in the text block clustering tree other than the first parent node.
15. A retrieval path selection device in retrieval enhancement generation, characterized in that, include: The first determining module is configured to: determine multiple first candidate text blocks corresponding to the unanswered question based on the user input of the unanswered question and multiple preset text blocks, and determine the first contribution of each first candidate text block; The second determining module is configured to: determine, based on each of the first candidate text blocks, the first child node and the first parent node corresponding to each of the first candidate text blocks in a preset text block clustering tree; wherein, the text block clustering tree is constructed by the plurality of preset text blocks according to preset clustering labels, the clustering labels are obtained by a preset model based on the plurality of preset text blocks, the text block clustering tree includes a plurality of parent nodes, each of the parent nodes corresponds to a plurality of child nodes, the parent nodes are composed of the clustering labels, and the child nodes are composed of the preset text blocks; The third determining module is configured to: perform retrieval path selection based on each first candidate text block, the first contribution value corresponding to each first candidate text block, and the text block clustering tree; the retrieval path selection includes: determining at least one second child node corresponding to the first parent node based on the node value score, and determining the second candidate text block corresponding to the second child node; and / or, determining the second parent node and at least one second child node corresponding to the second parent node in the text block clustering tree based on the node value score, and determining the second candidate text block corresponding to the second child node; wherein, the node value score is at least used to characterize the degree of association between the second candidate text block and / or the first candidate text block and the degree of association between the second candidate text block and the question to be answered; each first child node corresponds to at least one second child node; The content generation module is configured to: determine the target content corresponding to the question to be answered based at least on the second candidate text block and / or the first candidate text block.
16. An electronic device, characterized in that, include: One or more processors; and The memory is configured to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the retrieval path selection method in retrieval enhancement generation according to any one of claims 1-14.
17. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the retrieval path selection method in retrieval enhancement generation according to any one of claims 1-14.