Knowledge recall method and device, storage medium and computer program product

By combining vector recall and index pruning on structured tables, the problem of low knowledge recall accuracy in multi-table scenarios is solved, the comprehensiveness and accuracy of multi-path recall results are achieved, and the overall recall effect is improved.

CN121958348APending Publication Date: 2026-05-01CHINA MERCHANTS BANK
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA MERCHANTS BANK
Filing Date
2026-01-06
Publication Date
2026-05-01

Smart Images

  • Figure CN121958348A_ABST
    Figure CN121958348A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge recall method and device, a storage medium and a computer program product, and relates to the technical field of information retrieval, and the method comprises the steps: obtaining a query problem input by a user, and carrying out the vector recall of a preset structured table based on the query problem, and obtaining a candidate knowledge data set; collecting a target first-level index corresponding to the candidate knowledge data set, and performing vector recall by taking a structured table corresponding to the target first-level index as a constraint condition to obtain a target second-level index; calling a pre-constructed large model to perform semantic pruning on the target secondary index, and performing index recall based on a metadata association relationship corresponding to the target secondary index after semantic pruning to obtain a knowledge recall result; and combining the knowledge recall result and the candidate knowledge data set to obtain a multi-path knowledge recall result. The knowledge recall accuracy in a multi-table joint scene is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Knowledge retrieval methods, devices, storage media, and computer program products Technical Field

[0001] This application relates to the field of information retrieval technology, and in particular to knowledge retrieval methods, devices, storage media, and computer program products. Background Technology

[0002] In data warehouses, a large amount of existing business data is stored in structured databases, lacking significant contextual relationships and semantic connections. Furthermore, many business problems involve scenarios that cannot be fully answered by a single data table, requiring the joint generation of answers from multiple tables. In this application scenario, a basic approach is to vectorize the data from multiple structured data tables and store them in a knowledge base, then retrieve the data separately during use. Various RAG (Research, Analysis, and Grammar) improvement strategies can be used to optimize the retrieval results. The problem with this approach is that when retrieving data from multiple tables separately, each table has its own accuracy rate, making accurate retrieval across all tables difficult. Moreover, the overall retrieval accuracy decreases sharply as the number of tables increases.

[0003] Therefore, improving the accuracy of knowledge retrieval in multi-table joint scenarios has become an urgent technical problem to be solved. Summary of the Invention

[0004] The main purpose of this application is to provide a knowledge retrieval method, device, storage medium, and computer program product, aiming to solve the technical problem of how to improve the accuracy of knowledge retrieval in multi-table joint scenarios.

[0005] To achieve the above objectives, this application proposes a knowledge retrieval method, which includes: obtaining a query question input by a user; performing vector retrieval on pre-set structured tables based on the query question to obtain a candidate knowledge dataset; collecting a target first-level index corresponding to the candidate knowledge dataset; performing vector retrieval using the structured table corresponding to the target first-level index as a constraint to obtain a target second-level index; calling a pre-built large model to perform semantic pruning on the target second-level index; and performing index retrieval based on the metadata association relationship corresponding to the semantically pruned target second-level index to obtain a knowledge retrieval result; and merging the knowledge retrieval result and the candidate knowledge dataset to obtain a multi-path knowledge retrieval result.

[0006] In one embodiment, before the step of obtaining the user-input query, the method further includes: analyzing the entity relationship diagram of a pre-set data warehouse, defining index hierarchy rules based on the entity relationship diagram; processing the metadata stored in the data warehouse to obtain standardized metadata, the standardized metadata including structured tables; and marking the corresponding first-level index and second-level index in the standardized metadata based on the index hierarchy rules.

[0007] In one embodiment, the step of performing vector recall on preset structured tables based on the query question to obtain a candidate knowledge dataset includes: vectorizing the structured tables to obtain vector results for each structured table, and storing the vector results in a vector library; converting the query question into a query vector with the same vector dimension as the vector library; calculating the cosine similarity between the query vector and each vector result in the vector library, and performing vector recall based on the cosine similarity to obtain a candidate knowledge dataset.

[0008] In one embodiment, the step of collecting the target first-level index corresponding to the candidate knowledge dataset and performing vector recall with the structured table corresponding to the target first-level index as a constraint to obtain the target second-level index includes: traversing the candidate knowledge dataset and extracting the first-level index corresponding to each structured table in the candidate knowledge dataset; selecting the target first-level index from the first-level indexes using a majority voting strategy; performing vector recall with the structured table corresponding to the target first-level index as a constraint to obtain a second candidate knowledge dataset; traversing the second candidate knowledge dataset and extracting the second-level index corresponding to each structured table in the second candidate knowledge dataset; and selecting the target second-level index from the second-level indexes using a majority voting strategy.

[0009] In one embodiment, the steps of invoking a pre-built large model to perform semantic pruning on the target secondary index and performing index retrieval based on the metadata association relationship corresponding to the semantically pruned target secondary index to obtain knowledge retrieval results include: invoking a pre-built large model to analyze the relevance between the target secondary index and the query question; performing semantic pruning on the target secondary index based on the relevance; and performing index retrieval based on the metadata association relationship corresponding to the semantically pruned target secondary index to obtain knowledge retrieval results.

[0010] In one embodiment, after the step of merging the knowledge recall result and the candidate knowledge dataset to obtain a multi-path knowledge recall result, the method further includes: integrating the knowledge recall result and the candidate knowledge dataset to obtain an initial multi-path knowledge recall result; and performing a deduplication operation on the initial multi-path knowledge recall result to obtain a multi-path knowledge recall result.

[0011] In one embodiment, after the step of merging the knowledge retrieval results and the candidate knowledge dataset to obtain multi-path knowledge retrieval results, the method further includes: determining the question type of the query question; if the question type is a structured query generation question, then inputting preset structured specification prompts and the multi-path knowledge retrieval results into the large model to generate an executable structured statement; if the question type is a factual query question, then inputting preset business knowledge prompts and the multi-path knowledge retrieval results into the large model to generate a natural language answer.

[0012] In addition, to achieve the above objectives, this application also proposes a knowledge retrieval device, the device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the knowledge retrieval method as described above.

[0013] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps of the knowledge retrieval method described above.

[0014] In addition, to achieve the above objectives, this application also provides a computer program product, which includes a computer program that, when executed by a processor, implements the steps of the knowledge retrieval method described above.

[0015] The proposed technical solutions in this application have at least the following technical effects: Firstly, candidate knowledge datasets are obtained through vector recall for each structured table, providing a foundation for subsequent related retrieval. Secondly, the target first-level index corresponding to the candidate set is collected, and its influence is used to constrain the recall scope of the target second-level index, narrowing the retrieval boundary and avoiding the problem of insufficient accuracy caused by the lack of related guidance in multi-table separate recall. Thirdly, semantic pruning of the target second-level index is performed through a large model to further filter irrelevant indexes and improve the accuracy of index recall. Fourthly, knowledge is recalled based on the pruned index and combined with metadata related relationships. Finally, the index recall results are merged with the candidate set from vector recall to form a multi-path recall, which retains the comprehensiveness of vector recall while supplementing the accuracy of multi-table related data through index recall. This effectively solves the defect that the accuracy of multi-table separate recall drops sharply with the increase of table size, ultimately achieving a significant improvement in knowledge recall accuracy in multi-table joint scenarios. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 is a flowchart illustrating the first embodiment of the knowledge recall method of this application; Figure 2 is a flowchart illustrating the second embodiment of the knowledge recall method of this application; Figure 3 is a flowchart illustrating the third embodiment of the knowledge recall method of this application; Figure 4 is a flowchart illustrating the sixth embodiment of the knowledge recall method of this application; Figure 5 is a schematic diagram of index design and data combination provided in this application; Figure 6 is a schematic diagram of multi-channel recall and recall result application provided in this application; Figure 7 is a schematic diagram of the module structure of the knowledge recall device in the embodiment of this application; Figure 8 is a schematic diagram of the device structure of the hardware operating environment involved in the knowledge recall method in the embodiment of this application.

[0019] The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0020] It should be understood that the specific embodiments described herein are merely illustrative of the technical solutions of this application and are not intended to limit this application.

[0021] To better understand the technical solution of this application, a detailed description will be provided below in conjunction with the accompanying drawings and specific implementation methods.

[0022] The main solution of this application embodiment is as follows: First, obtain the query question input by the user; second, perform vector recall on pre-set structured tables based on the query question to obtain a candidate knowledge dataset; third, collect the target first-level index corresponding to the candidate knowledge dataset, and perform vector recall using the structured table corresponding to the target first-level index as a constraint to obtain a target second-level index; fourth, call a pre-built large model to perform semantic pruning on the target second-level index, and perform index recall based on the metadata association relationship corresponding to the semantically pruned target second-level index to obtain a knowledge recall result; fifth, merge the knowledge recall result and the candidate knowledge dataset to obtain a multi-path knowledge recall result.

[0023] In this embodiment, for ease of description, the following description uses a knowledge retrieval system as the executing entity.

[0024] This application's embodiments take into account that, in the field of knowledge retrieval, Retrieval-Augmented Generation (RAG) is a mainstream technical solution. This strategy typically stores the knowledge to be recalled in vector form in a knowledge base. During the recall phase, the input query is converted into a vector, and its similarity to the knowledge base vector is calculated using metrics such as cosine similarity, thereby recalling the corresponding knowledge. Typical application scenarios for existing RAG solutions are textual content with significant contextual relationships (such as product manuals, literary works, and academic papers). To improve recall accuracy, various improvement schemes have emerged, including expanding contextual information, hybrid vector and keyword retrieval, and multi-path recall using sparse and dense vectors.

[0025] In industrial data warehouse scenarios, a large amount of business data is stored in structured databases. This type of data often lacks significant contextual relationships and semantic connections, and most business questions require combining data from multiple tables to generate answers. The existing basic approach for this scenario is to vectorize the structured data from multiple tables separately and store them in a knowledge base. When needed, a recall operation is performed on each table individually, while an improved RAG strategy is used to optimize the recall results for each table. However, this method has a core drawback: when recalling data from multiple tables separately, the recall accuracy of each table is independently limited, making it difficult to achieve accurate recall across all tables. Furthermore, the overall recall accuracy drops sharply as the number of tables involved increases, making it difficult to meet the needs of scenarios such as multi-table combined business knowledge question answering and SQL statement generation.

[0026] Therefore, this application provides a solution to obtain candidate knowledge datasets by vector recall for each structured table, providing a foundation for subsequent related retrieval. Furthermore, it collects the target first-level index corresponding to the candidate set and uses it to constrain the recall scope of the target second-level index, narrowing the retrieval boundary and avoiding the problem of insufficient accuracy caused by the lack of association guidance in multi-table separate recall. Secondly, it performs semantic pruning on the target second-level index through a large model to further filter irrelevant indexes and improve the accuracy of index recall. Based on the pruned index and combined with metadata association relationships, it recalls knowledge. Finally, it merges the index recall results with the candidate set from vector recall to form a multi-path recall, which retains the comprehensiveness of vector recall while supplementing the accuracy of multi-table related data through index recall. This effectively solves the defect that the accuracy of multi-table separate recall drops sharply with the increase in table size, ultimately achieving a significant improvement in knowledge recall accuracy in multi-table joint scenarios.

[0027] It should be noted that the executing entity in this embodiment can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device or knowledge retrieval system capable of performing the above functions. The following description uses a knowledge retrieval system as an example to illustrate this embodiment and the subsequent embodiments.

[0028] Based on this, this application provides a knowledge retrieval method. Referring to Figure 1, which is a flowchart of the first embodiment of the knowledge retrieval method of this application, this application provides a knowledge retrieval method.

[0029] In this embodiment, the knowledge retrieval method includes steps S10 to S40: Step S10, obtaining the query question input by the user, and performing vector retrieval on the preset structured tables based on the query question to obtain a candidate knowledge dataset; the query question input by the user refers to the text content entered by the user when they want to obtain information or solve a problem; the preset structured table refers to a data table with a fixed structure and format that is stored in the system in advance, such as a job information table, a table structure source data table, a code value table, etc.; the candidate knowledge dataset refers to the set of preliminary relevant data obtained from each structured table through vector retrieval.

[0030] Initially, candidate knowledge related to the query question is obtained from multiple structured tables, providing basic data for subsequent index-based recall. By performing vector recall on each structured table separately, information from multiple data sources can be covered, avoiding the limitations of single-table recall, while also providing data support for the first-level index of the statistical target.

[0031] Specifically, the system first receives the query question input by the user, converts it into vector form, and then uses vector matching algorithms such as cosine similarity to calculate the similarity between the query question vector and each data vector in the table for each pre-set structured table. Data with similarity higher than a preset threshold are selected and these data are aggregated to form a candidate knowledge dataset.

[0032] Step S20: Collect the target first-level index corresponding to the candidate knowledge dataset, and perform vector recall using the structured table corresponding to the target first-level index as a constraint to obtain the target second-level index; the target first-level index corresponding to the candidate knowledge dataset refers to the most relevant first-level index among the data annotations in the candidate knowledge dataset, and the first-level index refers to the high-level index (such as the data area name) that connects the data of each table; the structured table corresponding to the target first-level index refers to all the structured tables associated with the first-level index.

[0033] A target secondary index refers to a secondary index related to a target primary index obtained through vector retrieval. A secondary index refers to a low-level index (such as a table name or field name) that subdivides the data.

[0034] By identifying the target primary index and obtaining the target secondary index under its constraints, the subsequent recall scope is narrowed, improving accuracy. Furthermore, determining the target primary index through majority voting avoids interference from irrelevant data. Using the structured table corresponding to this index as a constraint for vector recall can focus on relevant tables, improving the recall accuracy of the secondary index.

[0035] Specifically, the system traverses the candidate knowledge dataset to collect the first-level index of each data item, counts the number of occurrences, and determines the target first-level index by majority vote; then it determines the structured tables associated with the first-level index, uses these tables as constraints to conduct vector recall on the query question again, and selects the relevant second-level indexes as the target second-level indexes.

[0036] Additionally, it should be noted that in one possible implementation, when the system statistically analyzes the primary index, it will combine the data similarity weight for weighted statistics, with primary indexes of data with high similarity having higher weights; when recalling data based on the structured table corresponding to the target primary index, the data in the table will be sorted by priority, and secondary indexes corresponding to high-priority data will be recalled first.

[0037] Step S30: Call the pre-built large model to perform semantic pruning on the target secondary index, and perform index retrieval based on the metadata association relationship corresponding to the semantically pruned target secondary index to obtain the knowledge retrieval result; the pre-built large model refers to the artificial intelligence model that the system has pre-trained for processing natural language tasks; semantic pruning refers to the process of performing semantic analysis on the target secondary index through the large model to remove irrelevant indexes; metadata association relationship refers to the primary and foreign key association relationship between tables in the metadata.

[0038] Semantic pruning optimizes the target secondary index, and then index recall retrieves accurate knowledge, balancing accuracy and relevance. Semantic pruning leverages the semantic understanding capabilities of a large model to remove irrelevant indexes, while index recall accurately retrieves information from multiple tables based on relationships, avoiding the accuracy degradation problem of separate recalls from multiple tables.

[0039] Specifically, the system calls the large model, inputs the query question and target secondary index into the model, the model judges the relevance of each secondary index to the question, removes low-relevance indexes to obtain pruned secondary indexes; then, based on the pruned indexes, it queries the metadata association table to retrieve relevant metadata information, and summarizes it to form knowledge retrieval results.

[0040] Additionally, it should be noted that in one possible implementation, when the large model performs semantic pruning, it will filter secondary indexes based on query intent classification (e.g., query type, SQL generation type). For example, SQL generation type indexes will preferentially retain indexes related to table structure. During index retrieval, the retrieved metadata will be sorted by relevance. For instance, in a specific implementation, the target secondary indexes include "Job Information Table.Job Status Field" and "Table Structure Source Data Table.Field Type Field". The large model determines that the latter has low relevance to "Querying the job completion status in October 2023" and removes it. The system retrieves the job completion status data for October 2023 from the Job Information Table based on the pruned indexes, forming the knowledge retrieval result.

[0041] Step S40: Merge the knowledge retrieval results and the candidate knowledge dataset to obtain multi-path knowledge retrieval results.

[0042] Multi-path knowledge recall results refer to a unified dataset after merging the two recall results. The purpose of this step is to merge index-based and vector-based recall results, balancing accuracy and comprehensiveness. Merging the two results avoids the limitations of a single recall method, ensuring the accuracy of index-based recall while retaining the comprehensiveness of vector-based recall, thus improving the overall recall performance.

[0043] Specifically, the system first deduplicates the knowledge retrieval results and the candidate knowledge dataset to remove duplicate data; then it merges the two deduplicated datasets to form a unified dataset; finally, it sorts the data according to their relevance to the query question to obtain multi-path knowledge retrieval results.

[0044] This embodiment provides a knowledge retrieval method. It obtains candidate knowledge datasets by vector recall for each structured table, providing a foundation for subsequent related retrieval. Furthermore, it collects the target first-level index corresponding to the candidate set and uses it to constrain the recall scope of the target second-level index, narrowing the retrieval boundary and avoiding the accuracy problem caused by insufficient correlation guidance in multi-table separate recall. Secondly, it performs semantic pruning on the target second-level index through a large model to further filter irrelevant indexes and improve the accuracy of index recall. Knowledge is recalled based on the pruned index and combined with metadata correlation relationships. Finally, it merges the index recall results with the candidate set from vector recall to form a multi-path recall, preserving the comprehensiveness of vector recall while supplementing the accuracy of multi-table related data through index recall. This effectively solves the defect that the accuracy of multi-table separate recall drops sharply with the increase in table size, ultimately achieving a significant improvement in knowledge recall accuracy in multi-table joint scenarios.

[0045] In one feasible implementation, step S10 may include steps S11 to S13: Step S11, the structured table is vectorized to obtain the vector result of each structured table, and the vector result is stored in the vector library; the system first reads each data record in the structured table, preprocesses the text fields (such as job name, field description, etc.) in the record (including word segmentation, removal of special characters, etc.), and normalizes the numerical fields (such as job ID, field length); then, a pre-trained language model (such as BERT) is used to encode the preprocessed text fields to obtain text vectors, and the normalized numerical fields are concatenated to the end of the text vectors to form complete vector results; finally, the vector results of each structured table are stored in the vector library according to the table category.

[0046] Additionally, it should be noted that in one possible implementation, during vectorization, a weight is assigned to each data entry based on the business priority of the structured table. The weight value is incorporated into the vector normalization process, making it easier for high-priority data to be matched first in subsequent retrievals. Alternatively, the vector library may adopt a distributed storage architecture, storing vector results from different structured tables on different nodes to improve concurrent processing capabilities during retrieval.

[0047] Step S12: The query question is transformed into a query vector with the same vector dimension as the vector library; the user's natural language question is transformed into a form that can be used to calculate similarity with the vectors in the vector library, ensuring that the dimension is consistent to avoid calculation errors, while accurately capturing the semantic information of the user's question, laying the foundation for subsequent similarity calculation.

[0048] The system first receives the query input from the user and performs preprocessing operations on the query, including removing stop words, correcting typos, and word segmentation. Then, using the same pre-trained language model and encoding method as the structured table vectorization process, the preprocessed query is transformed into a fixed-dimensional vector. Finally, the system checks whether the dimension of the vector is consistent with the dimension of the vector in the vector library. If they are inconsistent, the system adjusts them to be consistent by padding with zeros or truncating (according to business rules) to obtain the final query vector.

[0049] Step S13: Calculate the cosine similarity between the query vector and the vector results in the vector library, and perform vector recall based on the cosine similarity to obtain a candidate knowledge dataset.

[0050] First, iterate through all vector results in the vector library and calculate the cosine similarity between each vector result and the query vector. Then, set a preset similarity threshold and filter out vector results with a cosine similarity higher than the threshold. Finally, based on the structured table data records corresponding to the filtered vector results, summarize them to form a candidate knowledge dataset.

[0051] Additionally, it should be noted that in one possible implementation, when calculating cosine similarity, a weighting coefficient is set for the vector results based on the business type of the structured table. This weighting coefficient is multiplied by the cosine similarity score, making it easier to recall vector results that match the business type. Alternatively, a phased filtering strategy can be adopted for vector recall, first sorting the internal similarity of each structured table and taking the top N data, and then sorting the top N data of all tables globally to further improve recall efficiency.

[0052] Based on the first embodiment of this application, a second embodiment of this application is proposed. In the second embodiment of this application, content that is the same as or similar to that in the first embodiment described above can be referred to the above description and will not be repeated hereafter.

[0053] Based on this, please refer to Figure 2, which is a schematic diagram of the second embodiment provided in this application. As shown in Figure 2, before step S10, the knowledge retrieval method further includes steps S01 to S03: Step S01, analyze the entity relationship diagram of the pre-built data warehouse, and define index hierarchy rules based on the entity relationship diagram; the pre-built data warehouse refers to a warehouse system that is pre-built and stores business data, including structured tables and unstructured data; the entity relationship diagram (ER diagram) refers to a graphical tool that describes entities (such as tables, fields), attributes and relationships between entities in the data warehouse; the index hierarchy rules refer to the rules that specify how many levels the index is divided into, the content corresponding to each level of the index and the association method.

[0054] By analyzing the entity relationship graph, we can make full use of the primary and foreign key relationships between tables, define hierarchical rules to allow indexes to link data from multiple tables, and solve the problem that the recall accuracy of multiple tables decreases sharply as the number of tables increases in existing technologies.

[0055] Specifically, the entity relationship diagram of the pre-built data warehouse is read to identify the entity types (such as job information tables and table structure source data tables), entity attributes (such as job IDs and field descriptions), and relationships between entities (such as foreign key relationships between job information tables and table structure source data tables). Then, the index hierarchy is divided according to the business hierarchy of the entities (such as data areas, tables, and fields), and the content corresponding to each level of index is determined (such as the data area name corresponding to the first-level index, and the table name or field name corresponding to the second-level index). Finally, an index hierarchy rule document containing the hierarchy division, the content of each level of index, and the relationship logic is generated.

[0056] Additionally, it should be noted that in one possible implementation, when defining index hierarchy rules, the system, in addition to referencing the primary and foreign key relationships in the entity relationship diagram, will also adjust the weight of the index hierarchy based on the priority of the business scenario. For example, the weight of the index hierarchy corresponding to frequently queried business data will be increased, so that the index at that level can be matched preferentially during subsequent retrieval. For instance, in a specific implementation, the system analyzes the entity relationship diagram of the data warehouse and finds that the job information table, the table structure source data table, and the code value table belong to different data areas and have primary and foreign key relationships; based on this, the index hierarchy rules are defined as follows: the first-level index is the data area name (such as the job data area, the table structure data area, and the code value data area), and the second-level index is the table name or field name (such as the job information table and the job status field).

[0057] Step S02: Process the metadata stored in the data warehouse to obtain standardized metadata, which includes structured tables. Metadata refers to data that describes the structure, attributes, and relationships of data in the data warehouse. Data processing refers to the process of cleaning and structuring the metadata. Standardized metadata refers to metadata that conforms to a unified standard after processing.

[0058] The system first collects metadata from the data warehouse, including structured tables (such as job information tables) and unstructured data (such as business knowledge); then it processes the data: the cleaning stage handles missing values, duplicate data, and abnormal data; the structuring stage transforms unstructured data into structured tables according to business rules, and sorts the structured data by priority; finally, it outputs standardized metadata containing the processed structured tables.

[0059] For example, in one specific implementation, the data warehouse metadata collected by the system includes a job information table (with duplicate records) and unstructured business knowledge documents; during data processing, the cleaning stage deletes duplicate job records and handles missing values ​​in the job status field; the structuring stage splits the business knowledge documents into three fields: "knowledge topic," "knowledge content," and "applicable scenario," and stores them in a structured business knowledge table; finally, standardized metadata including the cleaned job information table, the structured business knowledge table, etc., is obtained.

[0060] Step S03: Based on the index hierarchy rules, mark the corresponding first-level index and second-level index in the standardized metadata.

[0061] Specifically, the index hierarchy rules are loaded; then each piece of data in the standardized metadata is traversed, and the corresponding first-level and second-level indexes are marked according to the association logic in the rules (such as the data area corresponding to the first-level index and the table name corresponding to the second-level index); finally, the marked metadata is stored to form a table of association between indexes and metadata.

[0062] In this embodiment, by analyzing the entity relationship diagram of the data warehouse to define index hierarchy rules, processing metadata to obtain standardized metadata, and labeling first-level and second-level indexes, an association system between indexes and standardized metadata is constructed. This solves the defects of not being able to fully utilize the inter-table relationships when recalling multiple tables separately, and the accuracy dropping sharply as the number of tables increases. It provides a foundation for subsequent multi-way recall based on indexes, and can fully utilize the inter-table relationships to improve the accuracy and efficiency of multi-table joint recall, supporting the implementation of business knowledge retrieval and SQL generation applications.

[0063] Based on the first and / or second embodiments of this application, a third embodiment of this application is proposed. In the third embodiment of this application, content that is the same as or similar to the first and / or second embodiments described above can be referred to the above description and will not be repeated hereafter.

[0064] Based on this, please refer to Figure 3, which is a flowchart of the third embodiment provided in this application. As shown in Figure 3, step S20, which involves collecting the target first-level index corresponding to the candidate knowledge dataset and performing vector recall using the structured table corresponding to the target first-level index as a constraint, to obtain the target second-level index, may include steps S21 to S25: Step S21, traversing the candidate knowledge dataset and extracting the first-level index corresponding to each structured table in the candidate knowledge dataset; the first-level index refers to the first-level index (such as the data region name) designed based on the ER diagram of the data warehouse structured table. The purpose of this step is to comprehensively collect the first-level index corresponding to each structured table in the candidate knowledge dataset, providing a data foundation for subsequently selecting the target first-level index using a majority voting strategy. By traversing all candidate data to extract the index, it can be ensured that no relevant index is missed, thereby improving the objectivity and accuracy of the subsequent voting results.

[0065] The system iterates through each data record in the candidate knowledge dataset, extracts the corresponding first-level index from the data's annotation information based on the structured table to which each data record belongs, and summarizes all the extracted first-level indexes to form a first-level index list.

[0066] Additionally, it should be noted that in one possible implementation, when the system extracts the first-level index, it will simultaneously record the frequency of each first-level index and the business priority of the corresponding structured table, so that the subsequent majority voting strategy can make a more accurate selection based on the priority.

[0067] Step S22: Select a target first-level index from the first-level indexes using a majority voting strategy. The majority voting strategy refers to the strategy of counting the number of times each first-level index appears and selecting the index that appears the most. The target first-level index refers to the first-level index that is finally selected through the majority voting strategy and is used to constrain the range of the structured table in the future.

[0068] The system counts the frequency of each index in the primary index list, compares the frequencies, and selects the index with the highest frequency as the target primary index. If multiple indexes have the same frequency, the primary index corresponding to the index with the higher priority is selected based on the business priority of the structured table.

[0069] Additionally, it should be noted that in one possible implementation, when multiple first-level indexes have the same frequency, the system will introduce the user's historical query preferences (such as the business areas that the user frequently queries) to assist in selecting the target first-level index.

[0070] Step S23 involves performing vector recall using the structured table corresponding to the target first-level index as a constraint to obtain a second candidate knowledge dataset. The structured table corresponding to the target first-level index refers to all structured tables belonging to the data area of ​​that target first-level index. The second candidate knowledge dataset refers to a more precise set of candidate data obtained through the constrained vector recall. The purpose of this step is to narrow the recall range by constraining the structured table range through the target first-level index, improve the recall accuracy, avoid interference from irrelevant tables, and provide a more relevant data foundation for subsequent extraction of the second-level index.

[0071] The system first identifies all structured tables corresponding to the target primary index, then transforms the query question into a vector form, performs vector recall on the data in these structured tables (calculates the similarity between the query vector and the data vectors in the table, and filters data that exceeds a preset threshold), and summarizes these data to form a second candidate knowledge dataset.

[0072] Step S24: Traverse the second candidate knowledge dataset and extract the secondary indexes corresponding to each structured table in the second candidate knowledge dataset. Secondary indexes refer to the second-level indexes (such as table names and field names) designed based on the ER diagram of the data warehouse structured tables. The purpose of this step is to comprehensively collect the secondary indexes corresponding to each structured table in the second candidate dataset, providing a data foundation for subsequently selecting the target secondary index using a majority voting strategy. Traversing and extracting these indexes ensures that no relevant secondary indexes are missed, improving the accuracy of the voting results.

[0073] Specifically, the system iterates through each data record in the second candidate knowledge dataset, extracts the corresponding secondary index from the data's annotation information based on the structured table to which each data record belongs, and summarizes all the extracted secondary indexes to form a secondary index list.

[0074] In one possible implementation, when extracting secondary indexes, the system records the frequency of each secondary index occurrence and the business importance of the corresponding field, so that the subsequent majority voting strategy can be selected based on importance.

[0075] Step S25: Select the target secondary index from the secondary indexes using the majority voting strategy.

[0076] The system counts the frequency of each index in the secondary index list, compares the frequencies, and selects the index with the highest frequency as the target secondary index. If multiple indexes have the same frequency, the index with higher importance is selected based on the business importance of the field.

[0077] In this embodiment, a hierarchical index filtering mechanism is constructed by extracting the first-level index of candidate data and selecting the target first-level index by majority vote, recalling the second candidate set using the constraint vector of the target first-level index, and extracting the second-level index and selecting the target second-level index by majority vote. This mechanism solves the defect of existing technologies where recalling multiple tables separately cannot utilize inter-table relationships, resulting in a sharp decrease in accuracy as the number of tables decreases. By narrowing the recall scope through hierarchical constraints, the recall accuracy is improved, providing a reliable foundation for subsequent index pruning and multi-way recall, and supporting the efficient implementation of business knowledge retrieval and SQL generation applications.

[0078] Based on the above embodiments of this application, a fourth embodiment of this application is proposed. In this fourth embodiment, content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter.

[0079] In this embodiment, step S30, which involves calling a pre-built large model to perform semantic pruning on the target secondary index and performing index retrieval based on the metadata association relationship corresponding to the semantically pruned target secondary index to obtain the knowledge retrieval result, may include steps S31 to S32: Step S31, calling the pre-built large model to analyze the relevance between the target secondary index and the query question; performing semantic pruning on the target secondary index based on the relevance; utilizing the semantic understanding capability of the large model to accurately select the target secondary index most relevant to the query question, removing irrelevant or weakly relevant indexes, reducing redundant data in subsequent retrieval, and improving retrieval accuracy.

[0080] Specifically, the system calls a pre-built large model, takes the target secondary index and the query question as input, and lets the large model calculate the relevance score between each target secondary index and the query question; then sets a preset relevance threshold, filters out target secondary indexes with scores below the threshold, and keeps indexes with scores above the threshold, thus completing semantic pruning.

[0081] Additionally, it should be noted that, in one possible implementation, when calculating relevance, the large model will combine the business scenario information (such as the purpose of the table and the business meaning of the fields) of the structured table corresponding to the target secondary index for comprehensive analysis, rather than relying solely on literal matching; or, the relevance threshold can be dynamically adjusted according to the user's query history, for example, the threshold can be increased when the user has high requirements for the accuracy of the results.

[0082] Step S32: Based on the metadata association relationship corresponding to the target secondary index after semantic pruning, perform index retrieval to obtain knowledge retrieval results.

[0083] Metadata association refers to the correspondence between an index and metadata (such as structured tables and fields) in a data warehouse; index recall refers to the process of retrieving corresponding metadata based on the association between the index and the metadata.

[0084] Specifically, based on the target secondary index retained after semantic pruning, the pre-established metadata association table is queried to obtain all metadata corresponding to the index (including data records and field information in the structured table); then, this metadata is aggregated to form the knowledge retrieval result.

[0085] In this embodiment, target secondary indexes related to the query question are filtered and pruned through large-scale model semantic analysis. Then, knowledge is recalled based on the association relationship of the pruned indexes, which solves the problem of low recall efficiency caused by index redundancy, improves recall accuracy, and provides a high-quality knowledge foundation for subsequent business knowledge retrieval and SQL generation.

[0086] Based on the above embodiments of this application, a fifth embodiment of this application is proposed. In this fifth embodiment, content that is the same as or similar to the above embodiments can be referred to the above description, and will not be repeated hereafter.

[0087] In this embodiment, step S40, which merges the knowledge recall results and the candidate knowledge dataset to obtain multi-path knowledge recall results, may include steps S41-S42: Step S41, integrating the knowledge recall results and the candidate knowledge dataset to obtain initial multi-path knowledge recall results; the initial multi-path knowledge recall results refer to the set after merging the results of the two recall methods. The purpose of this step is to combine the advantages of index recall and vector recall to form more comprehensive and accurate initial recall results, solving the problem of incomplete coverage or insufficient accuracy of a single recall method, and providing a foundation for subsequent deduplication.

[0088] Specifically, the system merges the knowledge recall results and the candidate knowledge dataset, retaining all data records without deduplication, to form the initial multi-path knowledge recall results; during the merging process, the source of each data item (index recall or vector recall) is recorded for subsequent analysis.

[0089] Step S42: Perform a deduplication operation on the initial multi-path knowledge retrieval results to obtain the multi-path knowledge retrieval results.

[0090] The system performs uniqueness verification on each data record in the initial multi-path knowledge retrieval results (e.g., through unique identifier ID, content hash value); after identifying duplicate records, it retains one of them (e.g., retaining the record with the higher source weight); finally, it obtains the deduplicated multi-path knowledge retrieval results.

[0091] Additionally, it should be noted that in one possible implementation, deduplication may combine data relevance scores and sources, prioritizing the retention of records with high relevance and those retrieved from the index; or, records with similar but not identical content may be merged.

[0092] In this embodiment, by integrating the results of index recall and vector recall and deduplicating them, a comprehensive and non-redundant multi-path recall result is formed, which solves the defects of incomplete coverage or insufficient accuracy of a single recall method, makes full use of the inter-table relationships, and supports the efficient implementation of business knowledge Q&A and SQL generation applications.

[0093] Based on the above embodiments of this application, a sixth embodiment of this application is proposed. In this sixth embodiment, content that is the same as or similar to that in the first embodiment described above can be referred to the above description and will not be repeated hereafter.

[0094] Based on this, please refer to Figure 4, which is a flowchart of the sixth embodiment provided in this application. As shown in Figure 4, after step S40, the knowledge retrieval method further includes steps S50 to S70: Step S50, determine the question type of the query question; the system analyzes the query question through a rule matching library to identify whether the question contains instructions for generating structured statements (such as keywords such as "generate SQL" or "query statement") or features of factual inquiries (such as "what is" or "what are there"), thereby determining the question type.

[0095] Additionally, it should be noted that in one possible implementation, the system's problem classification logic will be dynamically adjusted in conjunction with the user's historical query records. For example, if the user has frequently generated SQL statements recently, then questions containing relevant keywords will be prioritized as structured query generation questions. Alternatively, when the confidence level of the classification model is lower than a preset threshold, the system will confirm the problem type with the user through multiple rounds of interaction.

[0096] Step S60: If the question type is a structured query generation question, then the preset structured specification prompts and the multi-way knowledge retrieval results are input into the large model to generate an executable structured statement; a structured query generation question refers to a question that needs to be answered by generating an executable structured query statement (such as an SQL statement); the preset structured specification prompts refer to pre-set text instructions used to guide the large model to generate a structured statement that conforms to business specifications.

[0097] Specifically, after determining that the question type is a structured query generation question, the pre-set structured specification prompt words are retrieved, and the prompt words and multi-way knowledge retrieval results are passed as input parameters to the large model. The large model generates the corresponding executable structured statement based on the guidance of the prompt words and the metadata information in the retrieval results.

[0098] Additionally, it should be noted that in one possible implementation, the pre-defined structured specification prompts will include the syntax rules of the business database (such as the syntax differences between MySQL and Oracle) and field naming conventions to ensure that the generated statements are directly compatible with the target database; or, the system will perform syntax validation and business logic verification on the structured statements generated by the large model, and if errors are found, it will be fed back to the large model for regeneration.

[0099] Step S70: If the question type is a factual query question, then the preset business knowledge prompts and the multi-path knowledge retrieval results are input into the large model to generate a natural language answer.

[0100] Factual query questions refer to questions that require answers based on objective facts or business knowledge; pre-set business knowledge prompts refer to pre-defined text instructions used to guide the large model to generate natural language answers that conform to the business context.

[0101] After determining that the question type is a factual query question, the system retrieves pre-set business knowledge prompts and passes these prompts and multi-path knowledge retrieval results as input parameters to the large model. The large model generates the corresponding natural language answer based on the guidance of the prompts and the business knowledge information in the retrieval results.

[0102] Additionally, it should be noted that in one possible implementation, the pre-set business knowledge prompts may include rules for explaining business terms, such as automatically adding a brief explanation when a technical term appears in the answer; or, the system may perform redundancy detection on the natural language answers generated by the large model, removing unnecessary information before returning it to the user.

[0103] In this embodiment, by accurately determining the type of query question, pre-defined standard prompts are used to generate executable structured statements for structured query generation questions, combined with multi-path recall results. For factual query questions, business knowledge prompts are used to generate natural language answers, thereby achieving accurate and efficient business knowledge question answering and SQL generation, supporting the implementation of related applications.

[0104] To better understand the knowledge retrieval method based on index structure proposed in this application, the following explanation is provided in conjunction with Figures 5 and 6. Figure 5 is a schematic diagram of the index design and data combination provided in this application; Figure 6 is a schematic diagram of the multi-path retrieval and retrieval result application provided in this application.

[0105] As shown in Figure 5, the metadata includes three structured tables: a job information table, a table structure source data table, and a code value table; and one unstructured dataset: business knowledge. Based on the primary and foreign key information and relationships of the above data tables and dataset, two levels of indexes are set up. The first-level index is the data area name, and the second-level index is the table name and field name.

[0106] Data processing comprises three stages: data cleaning, data structuring, and index labeling. In the data cleaning stage, metadata is cleaned to address the following issue: missing data, i.e., missing values ​​generated during metadata collection.

[0107] Duplicate data refers to duplicate data generated during the metadata collection process due to network problems or duplicate statistics.

[0108] Errors and abnormal data refer to erroneous data present in the metadata or abnormal data determined based on development specifications.

[0109] In the data structuring stage, unstructured data is processed into structured data according to business rules and stored in structured tables. For structured data, if the data volume is too large, the data is prioritized according to business rules and rearranged so that higher-priority data can be retrieved first during data retrieval. In the index labeling stage, each data record in the cleaned and structured data table is labeled with an index, ultimately forming the relationship between indexes and metadata as shown in Figure 5.

[0110] As shown in Figure 6, for the content to be retrieved, data from each table is first recalled using the RAG strategy, and the corresponding first-level indexes are statistically analyzed. The first-level indexes are then obtained using a majority voting rule. Next, the second-level indexes and the data range of each table are limited based on the first-level indexes, and the same recall and voting rules are used to obtain the second-level indexes. Subsequently, a large model is used for index pruning, pruning the recalled second-level indexes according to semantics. Based on the pruned indexes, the data from each table is retrieved by referring to the relationship between the indexes and metadata; this is the index-based recall result. The above results are combined with the RAG recall results to form a multi-path recall result.

[0111] The recall result application process is as follows: First, it is determined whether the input question is an SQL generation question. If so, the SQL generation specification prompt words are used as the basis, and the above multi-path recall results are used as the context. If not, the business basic knowledge prompt words are used as the basis, and the above multi-path recall results are used as the context. Then, the large model combines the context and the question to generate the answer.

[0112] This application also provides a knowledge retrieval device, as shown in Figure 7. The knowledge retrieval device includes: an acquisition module 10, used to acquire a query question input by a user, and perform vector retrieval on a pre-set structured table based on the query question to obtain a candidate knowledge dataset; a retrieval module 20, used to collect the target first-level index corresponding to the candidate knowledge dataset, and perform vector retrieval using the structured table corresponding to the target first-level index as a constraint condition to obtain a target second-level index; an indexing module 30, used to call a pre-built large model to perform semantic pruning on the target second-level index, and perform index retrieval based on the metadata association relationship corresponding to the semantically pruned target second-level index to obtain a knowledge retrieval result; and a merging module 40, used to merge the knowledge retrieval result and the candidate knowledge dataset to obtain a multi-path knowledge retrieval result.

[0113] The knowledge retrieval device provided in this application, employing the knowledge retrieval method described in the above embodiments, can solve the technical problem of knowledge retrieval. Compared with the prior art, the beneficial effects of the knowledge retrieval device provided in this application are the same as those of the knowledge retrieval method described in the above embodiments, and other technical features in the knowledge retrieval device are the same as those disclosed in the methods of the above embodiments, and will not be repeated here.

[0114] This application provides a knowledge retrieval device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the knowledge retrieval method in Embodiment 1 above.

[0115] Referring to Figure 8 below, a schematic diagram of a structure suitable for implementing the knowledge retrieval device in the embodiments of this application is shown. The knowledge retrieval device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. The knowledge retrieval device shown in Figure 8 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0116] As shown in Figure 8, the knowledge retrieval device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the knowledge retrieval device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows the knowledge retrieval device to communicate wirelessly or wiredly with other devices to exchange data. While the figures show knowledge retrieval devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0117] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0118] The knowledge retrieval device provided in this application, employing the knowledge retrieval method described in the above embodiments, can solve the technical problem of knowledge retrieval. Compared with the prior art, the beneficial effects of the knowledge retrieval device provided in this application are the same as those of the knowledge retrieval method described in the above embodiments, and other technical features of the knowledge retrieval device are the same as those disclosed in the method of the previous embodiment, and will not be repeated here.

[0119] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0120] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0121] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the knowledge retrieval method described in the above embodiments.

[0122] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0123] The aforementioned computer-readable storage medium may be included in the knowledge retrieval device; or it may exist independently and not be assembled into the knowledge retrieval device.

[0124] The aforementioned computer-readable storage medium carries one or more programs. When these programs are executed by a knowledge retrieval device, the knowledge retrieval device performs the following actions: It acquires a query input by a user; performs vector retrieval on pre-set structured tables based on the query to obtain candidate knowledge datasets; it collects the target first-level index corresponding to the candidate knowledge datasets, performs vector retrieval using the structured tables corresponding to the target first-level indexes as constraints, and obtains target second-level indexes; it calls a pre-built large model to perform semantic pruning on the target second-level indexes, and performs index retrieval based on the metadata associations corresponding to the semantically pruned target second-level indexes, obtaining knowledge retrieval results; and it merges the knowledge retrieval results and the candidate knowledge datasets to obtain multi-path knowledge retrieval results.

[0125] Computer program code for performing the operations of this application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0126] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0127] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0128] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., a computer program) for executing the above-described knowledge retrieval method, thereby solving the technical problem of knowledge retrieval. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the knowledge retrieval method provided in the above embodiments, and will not be repeated here.

[0129] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the knowledge retrieval method described above.

[0130] The computer program product provided in this application can solve the technical problem of knowledge retrieval. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the knowledge retrieval method provided in the above embodiments, and will not be repeated here.

[0131] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A knowledge retrieval method, characterized in that, The knowledge retrieval method includes: obtaining a query question input by the user; performing vector retrieval on pre-set structured tables based on the query question to obtain a candidate knowledge dataset; collecting the target first-level index corresponding to the candidate knowledge dataset; performing vector retrieval using the structured table corresponding to the target first-level index as a constraint to obtain a target second-level index; calling a pre-built large model to perform semantic pruning on the target second-level index; and performing index retrieval based on the metadata association relationship corresponding to the semantically pruned target second-level index to obtain a knowledge retrieval result; and merging the knowledge retrieval result and the candidate knowledge dataset to obtain a multi-path knowledge retrieval result.

2. The knowledge retrieval method as described in claim 1, characterized in that, Before the step of obtaining the user's input query question, the method further includes: analyzing the entity relationship diagram of a pre-set data warehouse, defining index hierarchy rules based on the entity relationship diagram; processing the metadata stored in the data warehouse to obtain standardized metadata, the standardized metadata including structured tables; and marking the corresponding first-level index and second-level index in the standardized metadata based on the index hierarchy rules.

3. The knowledge retrieval method as described in claim 1, characterized in that, The step of performing vector recall on the preset structured tables based on the query question to obtain a candidate knowledge dataset includes: vectorizing the structured tables to obtain vector results for each structured table, and storing the vector results in a vector library; converting the query question into a query vector with the same vector dimension as the vector library; calculating the cosine similarity between the query vector and each vector result in the vector library, and performing vector recall based on the cosine similarity to obtain a candidate knowledge dataset.

4. The knowledge retrieval method as described in claim 1, characterized in that, The steps of collecting the target first-level index corresponding to the candidate knowledge dataset and performing vector recall with the structured table corresponding to the target first-level index as a constraint to obtain the target second-level index include: traversing the candidate knowledge dataset and extracting the first-level index corresponding to each structured table in the candidate knowledge dataset; selecting the target first-level index from the first-level indexes using a majority voting strategy; performing vector recall with the structured table corresponding to the target first-level index as a constraint to obtain a second candidate knowledge dataset; traversing the second candidate knowledge dataset and extracting the second-level index corresponding to each structured table in the second candidate knowledge dataset; and selecting the target second-level index from the second-level indexes using the majority voting strategy.

5. The knowledge retrieval method as described in claim 1, characterized in that, The steps of calling a pre-built large model to perform semantic pruning on the target secondary index and performing index retrieval based on the metadata association relationship corresponding to the semantically pruned target secondary index to obtain knowledge retrieval results include: calling a pre-built large model to analyze the relevance between the target secondary index and the query question; performing semantic pruning on the target secondary index based on the relevance; and performing index retrieval based on the metadata association relationship corresponding to the semantically pruned target secondary index to obtain knowledge retrieval results.

6. The knowledge retrieval method as described in claim 1, characterized in that, The step of merging the knowledge recall results and the candidate knowledge dataset to obtain multi-path knowledge recall results includes: integrating the knowledge recall results and the candidate knowledge dataset to obtain initial multi-path knowledge recall results; and performing a deduplication operation on the initial multi-path knowledge recall results to obtain multi-path knowledge recall results.

7. The knowledge retrieval method as described in claim 1, characterized in that, After the step of merging the knowledge retrieval results and the candidate knowledge dataset to obtain multi-path knowledge retrieval results, the method further includes: determining the question type of the query question; if the question type is a structured query generation question, then inputting the preset structured specification prompts and the multi-path knowledge retrieval results into the large model to generate an executable structured statement; if the question type is a factual query question, then inputting the preset business knowledge prompts and the multi-path knowledge retrieval results into the large model to generate a natural language answer.

8. A knowledge retrieval device, characterized in that, The device includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, the computer program being configured to implement the steps of the knowledge retrieval method as described in any one of claims 1 to 7.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, it implements the steps of the knowledge retrieval method as described in any one of claims 1 to 7.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the steps of the knowledge retrieval method as described in any one of claims 1 to 7.