Document knowledge retrieval method and system based on bidirectional quantity library hybrid architecture

By constructing a hybrid architecture of FAQ vector library and document vector library, and combining similarity algorithm and dynamic threshold decision mechanism, the problems of response latency and poor consistency of traditional RAG system are solved, realizing efficient and low-cost document knowledge retrieval, and improving system performance and user experience.

CN121456097APending Publication Date: 2026-02-03KEXUN JIALIAN INFORMATION TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511593654.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-03
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

Traditional RAG knowledge retrieval systems suffer from problems such as delayed response to frequently repeated questions, high costs, and poor answer consistency due to indiscriminate processing.

Method used

A document knowledge retrieval method based on a dual-vector library hybrid architecture is adopted. By constructing a FAQ vector library and a document vector library, and using similarity algorithms and dynamic threshold decision mechanisms, intelligent hierarchical processing of user queries is achieved. High-frequency and simple questions can achieve millisecond-level response through the FAQ channel, and unnecessary calls to large models are reduced.

Benefits of technology

It significantly improved system response speed and user experience, reduced computing costs, ensured high consistency in answers to frequently asked questions, optimized the allocation of computing resources, and improved system throughput and service performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121456097A_ABST
    Figure CN121456097A_ABST
Patent Text Reader

Abstract

The invention provides a document knowledge retrieval method and system based on a two-way quantity library hybrid architecture, relates to the technical field of crossing of artificial intelligence and knowledge engineering, and solves the technical problems that a traditional RAG knowledge retrieval system is delayed in response to high-frequency repeated problems, high in cost and poor in answer consistency due to indifference processing. The method comprises the steps of obtaining a user query request and historical document data; constructing an FAQ vector library and a document vector library based on the historical document data; calculating the matching similarity between the user query request and the FAQ vector library through a similarity algorithm to obtain an FAQ similarity score; comparing the FAQ similarity score with a preset similarity threshold value; when the FAQ similarity score is greater than or equal to a similarity threshold value, marking a standard answer corresponding to the FAQ similarity score as a query result; when the FAQ similarity score is smaller than the similarity threshold value, the document vector library is retrieved, and a big language model is called for TOP-M related fragments to generate answers to serve as query results. The method and device are used in the knowledge retrieval process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the interdisciplinary field of artificial intelligence and knowledge engineering, and in particular to a document knowledge retrieval method and system based on a dual-vector library hybrid architecture. Background Technology

[0002] Current knowledge retrieval systems based on large language models commonly employ a Retrieval Augmentation (RAG) architecture to handle user queries. This architecture requires indiscriminately performing multiple steps, including document fragment retrieval, reordering, and large model generation, for all query requests. This results in the system still having to handle the entire processing chain even when dealing with high-frequency, simple questions, leading to significant response latency and high computational costs. Furthermore, the large model generates inconsistent answers, potentially returning different responses for the same question. While existing keyword-matching FAQ solutions can improve response speed, they lack semantic understanding capabilities and struggle to effectively handle diverse natural language expressions from users. Traditional RAG architectures, on the other hand, cannot intelligently differentiate question complexity, resulting in a severe waste of computational resources. Summary of the Invention

[0003] This application provides a document knowledge retrieval method and system based on a dual-vector library hybrid architecture, which solves the technical problems of traditional RAG knowledge retrieval systems, such as delayed response to high-frequency repetitive questions, high cost, and poor answer consistency due to indiscriminate processing.

[0004] To achieve the above objectives, this application adopts the following technical solution: Firstly, a document knowledge retrieval method based on a dual-vector library hybrid architecture is provided, including: Obtain user query requests and historical document data; wherein, the historical document data includes document content and historical query logs; A FAQ vector library and a document vector library are constructed based on historical document data; wherein, the FAQ vector library includes several sets of standard questions and corresponding standard answers, and the document vector library includes several document fragments; The similarity score is obtained by calculating the matching similarity between the user's query request and the FAQ vector library through a similarity algorithm. The FAQ similarity score is compared with a preset similarity threshold. When the FAQ similarity score is greater than or equal to the similarity threshold, the standard answer corresponding to the FAQ similarity score is marked as the query result. When the FAQ similarity score is less than the similarity threshold, the matching similarity between the user's query request and the document vector library is calculated using a similarity algorithm to obtain several document similarity scores and sort them. Based on the large language model, answers are generated for the document fragments corresponding to the first M document similarity scores to obtain the query results. Here, M is a positive integer.

[0005] Based on the above technical solutions, the document knowledge retrieval method based on a dual-vector library hybrid architecture provided in this application effectively overcomes the inherent defects of traditional RAG systems by constructing a dual-vector library hybrid architecture and a dynamic threshold decision mechanism. It achieves intelligent hierarchical processing of user queries, enabling millisecond-level responses to high-frequency, simple questions through a high-precision matching FAQ channel, significantly improving system response speed and user experience. By reducing unnecessary calls to large models, it drastically reduces computational costs and operational expenses. The standardized answers provided by the FAQ channel ensure high consistency in responses to high-frequency questions, eliminating answer fluctuations. Simultaneously, this method optimizes the allocation of computational resources, concentrating saved resources on processing truly complex queries, thereby improving overall system throughput and service efficiency, achieving a balanced optimization of efficiency, cost, and quality.

[0006] In conjunction with the first aspect above, in one possible implementation, the steps for constructing the FAQ vector library include: Clustering analysis of historical query logs was performed using a clustering algorithm combined with semantic similarity calculation to obtain a set of high-frequency questions; Candidate question-answer pairs are obtained by associating and matching high-frequency question sets and document content through a key fragment extraction model; wherein, the key fragment extraction model is constructed based on the extractive model of RoBERTa; Candidate question-answer pairs are standardized by combining a FAQ generation model with manual sorting to obtain standard FAQ pairs; wherein, the FAQ generation model is constructed based on the LLM question-answer generation model; The standard FAQ pairs are vectorized and encoded using a pre-trained vector model to obtain a FAQ vector library; wherein the pre-trained vector model is constructed based on Sentence-BERT.

[0007] In conjunction with the first aspect above, in one possible implementation, the method for obtaining the candidate question-answer pairs includes: The core semantics of the high-frequency question set are extracted by using a cluster center calculation tool to obtain the core semantic set of the questions; The document content is split into paragraphs based on document formatting rules to obtain a set of paragraph units; The initial question-answer pairs are obtained by associating and matching the core semantic set of the question and the paragraph unit set based on the distance metric. The initial question-answer pair is precisely extracted using a key fragment extraction model to obtain candidate question-answer pairs.

[0008] In conjunction with the first aspect above, in one possible implementation, the steps for constructing the document vector library include: The document parser performs format parsing on the document content to obtain the document structure tree; The document structure tree is semantically segmented using a semantic slicing algorithm to obtain a set of document fragments; A document vector library is obtained by vectorizing a collection of document fragments using a pre-trained vector model.

[0009] In conjunction with the first aspect above, in one possible implementation, the method for obtaining the FAQ similarity score includes: The user query request is transformed into a query request vector by using a pre-trained vector model. Several standard questions were integrated to obtain a FAQ question vector library; The similarity between the query request vector and the FAQ question vector library is calculated pairwise using a similarity algorithm to obtain the FAQ score set. Select the top N FAQ scores from the FAQ score set and label them as the top N score set; where N is an integer; Calculate the variance of the top N score sets and compare it with a preset variance threshold. When the variance is greater than or equal to the variance threshold, mark the maximum FAQ score in the top N score sets as the FAQ similarity score. When the variance is less than the variance threshold, filter the top N score sets through a multi-dimensional filtering mechanism to obtain the FAQ similarity score.

[0010] In conjunction with the first aspect above, in one possible implementation, the filtering of the top N score set through a multi-dimensional filtering mechanism includes: Multidimensional feature set is obtained by extracting multidimensional features from the top N score set based on historical query logs. Perform deep semantic matching on user query requests and the standard answers corresponding to the top N score sets to obtain answer relevance scores; The top N score set, the multidimensional feature set, and the answer relevance score are weighted and summed to obtain several comprehensive scores. The FAQ score corresponding to the highest score among several comprehensive scores is marked as the FAQ similarity score.

[0011] In conjunction with the first aspect above, in one possible implementation, the method for obtaining the document similarity score includes: The similarity algorithm is used to calculate pairwise similarity between the query request vector and the document vector library to obtain a set of document scores; Select the document segments corresponding to the top K document scores from the document score set and label them as the top K document set; where K is an integer; Based on the Rerank model, the semantic relevance of the query request vector and the top K document set is reordered to obtain document similarity scores and then sorted.

[0012] In conjunction with the first aspect above, in one possible implementation, the step of generating answers based on the document fragments corresponding to the similarity scores of the first M documents using a large language model includes: The document fragments corresponding to the similarity scores of the top M documents are marked as candidate document fragments; The prompt text is obtained by assembling the user's query request and candidate document fragments using the prompt word engineering tool. The answer is generated from the Prompt text based on a large language model, and the query results are obtained.

[0013] In conjunction with the first aspect mentioned above, in one possible implementation, the similarity threshold is dynamically adjustable; based on historical query logs, user-satisfied FAQ matching cases are filtered and their FAQ scores are extracted, and the scores at a preset proportion position are selected as the initial threshold; historical query hit rate, user feedback negative review rate, and system average load are statistically analyzed in real time at a preset fixed period to obtain feedback data; adjustment coefficients are calculated by assigning different weights to the feedback data; the initial threshold and the adjustment coefficients are summed to obtain the dynamic similarity threshold.

[0014] Secondly, an electronic device is provided, comprising: a communication unit and a processing unit; the communication unit is used to acquire user query requests and historical document data; the processing unit is used to construct a FAQ vector library and a document vector library based on the historical document data; calculate the matching similarity between the user query request and the FAQ vector library using a similarity algorithm to obtain a FAQ similarity score; compare the FAQ similarity score with a preset similarity threshold; when the FAQ similarity score is greater than or equal to the similarity threshold, mark the standard answer corresponding to the FAQ similarity score as the query result; when the FAQ similarity score is less than the similarity threshold, calculate the matching similarity between the user query request and the document vector library using a similarity algorithm to obtain several document similarity scores and sort them; and generate answers for the document fragments corresponding to the top M document similarity scores based on a large language model to obtain the query result.

[0015] Thirdly, this application provides an electronic device, including: a processor and a storage medium; the storage medium includes instructions, and the processor is configured to execute the instructions to implement the methods described in the first aspect and any possible implementation thereof. This electronic device may be an electronic device or a chip within an electronic device.

[0016] Fourthly, this application provides a document knowledge retrieval system based on a dual-vector library hybrid architecture, comprising: a query receiving and scheduling module, a calculation and decision engine module, a data storage and vector library module, and a large model generation and result return module; wherein, the query receiving and scheduling module is used to acquire user query requests and historical document data; the calculation and decision engine module is used to calculate the matching similarity between the user query request and the FAQ vector library using a similarity algorithm to obtain a FAQ similarity score; compare the FAQ similarity score with a preset similarity threshold; when the FAQ similarity score ≥ the similarity threshold, mark the standard answer corresponding to the FAQ similarity score as the query result; when the FAQ similarity score < the similarity threshold, calculate the matching similarity between the user query request and the document vector library using a similarity algorithm to obtain several document similarity scores and sort them; generate answers for the document fragments corresponding to the first M document similarity scores based on a large language model to obtain query results; the data storage and vector library module is used to construct an FAQ vector library and a document vector library based on historical document data; the large model generation and result return module is used to generate the final answer based on the decision result and return it to the user.

[0017] Fifthly, this application provides a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the methods described in the first aspect and any possible implementation thereof.

[0018] In a sixth aspect, this application provides a computer program product containing instructions that, when run on an electronic device, cause the electronic device to perform the methods described in the first aspect and any possible implementation thereof.

[0019] This application provides a document knowledge retrieval method and system based on a dual-vector library hybrid architecture. By constructing a dual-vector library hybrid architecture and a dynamic threshold decision mechanism, it effectively overcomes the inherent defects of traditional RAG systems. It achieves intelligent hierarchical processing of user queries, with high-frequency, simple questions receiving millisecond-level responses through a high-precision matching FAQ channel, significantly improving system response speed and user experience. By reducing unnecessary calls to large models, it drastically reduces computational costs and operational overhead. The standardized answers provided by the FAQ channel ensure high consistency in responses to high-frequency questions, eliminating answer fluctuations. Simultaneously, this method optimizes the allocation of computational resources, concentrating saved resources on processing truly complex queries, thereby improving overall system throughput and service performance, achieving a balanced optimization of efficiency, cost, and quality.

[0020] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description

[0021] Figure 1 A system architecture diagram of a document knowledge retrieval method based on a dual-vector library hybrid architecture provided for embodiments of this application; Figure 2 A flowchart illustrating a document knowledge retrieval method based on a dual-vector library hybrid architecture, provided for an embodiment of this application; Figure 3 A flowchart illustrating another document knowledge retrieval method based on a dual-vector library hybrid architecture provided in this application embodiment; Figure 4 A flowchart illustrating another document knowledge retrieval method based on a dual-vector library hybrid architecture provided in this application embodiment; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0022] In the description of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. The "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, "at least one" means one or more, and "multiple" means two or more. The terms "first," "second," etc., do not limit the quantity or order of execution, and "first," "second," etc., do not necessarily imply differences.

[0023] It should be noted that, in this application, the terms "exemplary" or "for example" are used to indicate that something is being described as an example, illustration, or illustration. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0024] The document knowledge retrieval method based on a dual-vector library hybrid architecture provided in this application can be applied to, for example... Figure 1 In the document knowledge retrieval system 100 based on a dual-vector library hybrid architecture shown, such as Figure 1 As shown, the communication system includes: a query receiving and scheduling module 10, a calculation and decision engine module 20, a data storage and vector library module 30, and a large model generation and result return module 40.

[0025] The query receiving and scheduling module 10 is used to obtain user query requests and historical document data.

[0026] The calculation and decision engine module 20 is used to calculate the matching similarity between the user's query request and the FAQ vector library using a similarity algorithm to obtain a FAQ similarity score; compare the FAQ similarity score with a preset similarity threshold; when the FAQ similarity score is greater than or equal to the similarity threshold, mark the standard answer corresponding to the FAQ similarity score as the query result; when the FAQ similarity score is less than the similarity threshold, calculate the matching similarity between the user's query request and the document vector library using a similarity algorithm to obtain several document similarity scores and sort them; and generate answers for the document fragments corresponding to the top M document similarity scores based on a large language model to obtain the query result.

[0027] The data storage and vector library module 30 is used to build FAQ vector libraries and document vector libraries based on historical document data.

[0028] The large model generation and result return module 40 is used to generate the final answer based on the decision results and return it to the user.

[0029] To address the technical problems of traditional RAG knowledge retrieval systems, such as delayed response to frequently repeated questions, high costs, and poor answer consistency due to indiscriminate processing, this application provides a document knowledge retrieval method based on a dual-vector library hybrid architecture. This method includes: Obtain user query requests and historical document data; wherein, the historical document data includes document content and historical query logs; A FAQ vector library and a document vector library are constructed based on historical document data; wherein, the FAQ vector library includes several sets of standard questions and corresponding standard answers, and the document vector library includes several document fragments; The similarity score is obtained by calculating the matching similarity between the user's query request and the FAQ vector library through a similarity algorithm. The FAQ similarity score is compared with a preset similarity threshold. When the FAQ similarity score is greater than or equal to the similarity threshold, the standard answer corresponding to the FAQ similarity score is marked as the query result. When the FAQ similarity score is less than the similarity threshold, the matching similarity between the user's query request and the document vector library is calculated using a similarity algorithm to obtain several document similarity scores and sort them. Based on the large language model, answers are generated for the document fragments corresponding to the first M document similarity scores to obtain the query results. Here, M is a positive integer.

[0030] Based on this, the technical problems of traditional RAG knowledge retrieval systems, such as delayed response to high-frequency repetitive questions, high cost, and poor answer consistency due to indiscriminate processing, are solved.

[0031] like Figure 2 As shown in the embodiments of this application, the document knowledge retrieval method based on a dual-vector library hybrid architecture includes: S201. Obtain user query requests and historical document data.

[0032] The historical document data includes document content and historical query logs.

[0033] For example, the system receives user query requests (such as "how to apply for annual leave") from the web front-end or mobile application in real time through the API gateway interface deployed on the cloud server. At the same time, it periodically synchronizes unstructured document content such as product manuals and company policies from the enterprise's internal document management system (such as Confluence or SharePoint) as historical documents, and extracts user search log records from the database of the log analysis platform (such as ELK Stack) over the past year. This data is uniformly pushed to the data preprocessing platform to prepare data for the subsequent construction of the dual vector library.

[0034] S202. Construct a FAQ vector library and a document vector library based on historical document data.

[0035] The FAQ vector library includes several sets of standard questions and corresponding standard answers, and the document vector library includes several document fragments.

[0036] In some implementations, the steps for constructing the FAQ vector library are as follows: Figure 3 As shown, it includes: Clustering analysis of historical query logs was performed using a clustering algorithm combined with semantic similarity calculation to obtain a set of high-frequency questions; Candidate question-answer pairs are obtained by associating and matching high-frequency question sets and document content through a key fragment extraction model; wherein, the key fragment extraction model is constructed based on the extractive model of RoBERTa; Candidate question-answer pairs are standardized by combining a FAQ generation model with manual sorting to obtain standard FAQ pairs; wherein, the FAQ generation model is constructed based on the LLM question-answer generation model; The standard FAQ pairs are vectorized and encoded using a pre-trained vector model to obtain a FAQ vector library; wherein the pre-trained vector model is constructed based on Sentence-BERT.

[0037] For example, firstly, the DBSCAN clustering algorithm is used to perform semantic clustering on hundreds of thousands of historical user query logs, automatically summarizing high-frequency question categories such as "annual leave application," "salary inquiry," and "system login failure." Next, a key fragment extraction model fine-tuned based on the RoBERTa model scans the company's knowledge base documents, locating and extracting the most relevant answer text for each question category, forming initial candidate question-answer pairs. Then, these candidate pairs are input into a FAQ generation model composed of large language models like GPT-4 for grammatical simplification and expression standardization, and finally reviewed and corrected by domain experts to generate standard FAQ pairs such as "Q: What is the company's annual leave application process? A: Employees need to submit their applications in the OA system 3 days in advance…". Finally, the Sentence-BERT model is used to transform these standard questions into 768-dimensional semantic vectors, which, along with their standard answers, are stored in a vector database, thus completing the construction of a high-quality FAQ vector library.

[0038] In some implementations, the steps for constructing the document vector library include: The document parser performs format parsing on the document content to obtain the document structure tree; The document structure tree is semantically segmented using a semantic slicing algorithm to obtain a set of document fragments; A document vector library is obtained by vectorizing a collection of document fragments using a pre-trained vector model.

[0039] For example, firstly, the uploaded PDF product manual is parsed using the Apache Tika document parser to extract text content and structural information such as titles and paragraphs to generate a document structure tree. Next, a sliding window algorithm based on semantic boundaries is used to semantically segment the structure tree, ensuring that each segment revolves around a core theme (such as "installation steps" or "error code explanation"), forming a semantically complete set of document segments. Finally, each document segment is converted into a 768-dimensional semantic vector using a Sentence-BERT pre-trained model and stored in the Milvus vector database, thereby establishing an efficient document vector library for retrieval.

[0040] S203. Calculate the matching similarity between the user's query request and the FAQ vector library using a similarity algorithm to obtain the FAQ similarity score.

[0041] In some implementations, the methods for obtaining the FAQ similarity score include: The user query request is transformed into a query request vector by using a pre-trained vector model. Several standard questions were integrated to obtain a FAQ question vector library; The similarity between the query request vector and the FAQ question vector library is calculated pairwise using a similarity algorithm to obtain the FAQ score set. Select the top N FAQ scores from the FAQ score set and label them as the top N score set; where N is an integer; Calculate the variance of the top N score sets and compare it with a preset variance threshold. When the variance is greater than or equal to the variance threshold, mark the maximum FAQ score in the top N score sets as the FAQ similarity score. When the variance is less than the variance threshold, filter the top N score sets through a multi-dimensional filtering mechanism to obtain the FAQ similarity score.

[0042] For example, firstly, the user query "how to apply for annual leave" is transformed into a query vector using the same Sentence-BERT model as in the construction phase. Then, the system retrieves the stored FAQ question vector library from the Milvus vector database and uses a cosine similarity algorithm to calculate the similarity between the query vector and all question vectors in the library, obtaining an initial FAQ score set. Next, the top three (N=3) candidate question scores with the highest scores are selected to form the top N score set, and their variance is calculated. If the variance is greater than a preset threshold (e.g., 0.1), it indicates a significant best match, and the highest score (e.g., 0.92) is directly used as the final FAQ similarity score. If the variance is less than the threshold, a multi-dimensional filtering mechanism is activated, comprehensively considering features such as the historical click-through rate and keyword overlap rate of each candidate question for weighted ranking, thereby determining the optimal FAQ similarity score.

[0043] S204. Compare the FAQ similarity score with a preset similarity threshold; when the FAQ similarity score is greater than or equal to the similarity threshold, mark the standard answer corresponding to the FAQ similarity score as the query result; when the FAQ similarity score is less than the similarity threshold, calculate the matching similarity between the user's query request and the document vector library using a similarity algorithm, obtain several document similarity scores, and sort them; generate answers for the document fragments corresponding to the first M document similarity scores based on the large language model, and obtain the query result.

[0044] Where M is a positive integer.

[0045] In some implementations, the document similarity score is obtained in the following ways: The similarity algorithm is used to calculate pairwise similarity between the query request vector and the document vector library to obtain a set of document scores; Select the document segments corresponding to the top K document scores from the document score set and label them as the top K document set; where K is an integer; Based on the Rerank model, the semantic relevance of the query request vector and the top K document set is reordered to obtain document similarity scores and then sorted.

[0046] For example, firstly, the system uses a cosine similarity algorithm to quickly compare the user's query "how to apply for a special budget for an overseas project" with all the fragment vectors in the document vector library, initially filtering out the top 50 (K=50) most relevant document fragments and their scores, forming an initial candidate set. Then, the system calls a Rerank model fine-tuned based on a Cross-Encoder architecture to perform deeper semantic interaction calculations on the query text and the top 50 candidate document fragments, thereby re-ranking the true relevance of the candidate fragments and outputting the final list of document similarity scores arranged from highest to lowest relevance. This "rapid initial screening + fine-grained re-ranking" mechanism significantly improves the quality of the document fragments ultimately used for answer generation while ensuring retrieval efficiency.

[0047] In some implementations, the step of generating answers based on the document fragments corresponding to the similarity scores of the first M documents using a large language model includes: The document fragments corresponding to the similarity scores of the top M documents are marked as candidate document fragments; The prompt text is obtained by assembling the user's query request and candidate document fragments using the prompt word engineering tool. The answer is generated from the Prompt text based on a large language model, and the query results are obtained.

[0048] For example, firstly, the system marks the top 5 document fragments (M=5) with the highest scores after reordering as candidate document fragments; then, it assembles these fragments with the user query "How to apply for a special budget for an overseas project" through a prompt word template engine to form a structured Prompt text that includes role settings, query content, candidate fragments, and generation requirements (such as "Please explain the application process step by step based on the above information"); finally, the Prompt text is input into a GPT-4 model deployed on a GPU cluster for inference generation to obtain a final answer with a clear structure that includes application conditions, approval process, and precautions as the query result.

[0049] In some implementations, the similarity threshold is dynamically adjustable; based on historical query logs, user-satisfied FAQ matching cases are filtered and their FAQ scores are extracted, and the scores at a preset proportion position are selected as the initial threshold; historical query hit rate, user feedback negative review rate, and system average load are statistically analyzed in real time at a preset fixed period to obtain feedback data; adjustment coefficients are calculated by assigning different weights to the feedback data; the initial threshold and adjustment coefficients are summed to obtain the dynamic similarity threshold.

[0050] For example, the system first extracts the matching scores of FAQ matching records marked as "satisfactory" by users within the past month and calculates the P90 quantile as the initial threshold of 0.85. Subsequently, the system automatically calculates three indicators on a daily basis: the query hit rate of the FAQ channel, the negative rating rate of user FAQ answers, and the average CPU load, and assigns them weights of 0.5, 0.3, and 0.2 respectively. An adjustment coefficient is calculated through linear weighting. If the hit rate is high and the negative rating rate and load are low in the current period, a positive adjustment coefficient (e.g., +0.02) is generated to appropriately relax the threshold to improve FAQ coverage. Conversely, a negative adjustment coefficient (e.g., -0.03) is generated to tighten the threshold. Finally, the initial threshold and the adjustment coefficient are added to obtain a dynamically updated new threshold (e.g., 0.87), realizing adaptive optimization of the threshold according to the system's operating status.

[0051] As an example, such as Figure 4 As shown, the document knowledge retrieval method based on a dual-vector library hybrid architecture provided in this application can be mainly divided into two major modules: a knowledge base construction and management line and a user query response line. The knowledge base construction and management line is used to parse historical document data and construct the FAQ vector library and the document vector library, respectively. The user query response line is used to perform parallel dual-path retrieval of user query requests. When the FAQ channel is hit, the answer is quickly output through the FAQ channel, and the operating system-level instructions for actively terminating the document library calculation task are terminated. When the FAQ channel is not hit, a more accurate answer is generated for complex questions through a large language model and returned to the customer.

[0052] Based on the above technical solutions, the document knowledge retrieval method based on a dual-vector library hybrid architecture provided in this application effectively overcomes the inherent defects of traditional RAG systems by constructing a dual-vector library hybrid architecture and a dynamic threshold decision mechanism. It achieves intelligent hierarchical processing of user queries, with high-frequency, simple questions receiving millisecond-level responses through a high-precision matching FAQ channel, significantly improving system response speed and user experience. By reducing unnecessary calls to large models, it significantly reduces computational costs and operational expenses. The standardized answers provided by the FAQ channel ensure high consistency in responses to high-frequency questions, eliminating answer fluctuations. Simultaneously, this method optimizes the allocation of computational resources, concentrating saved resources on processing truly complex queries, thereby improving overall system throughput and service efficiency, achieving a balanced optimization of efficiency, cost, and quality.

[0053] In one possible implementation of this application embodiment, the above-mentioned S202 can be specifically implemented by the following S301, which will be described in detail below: S301. The key fragment extraction model is used to match the high-frequency question set and document content to obtain candidate question-answer pairs.

[0054] The key fragment extraction model is constructed based on the RoBERTa extraction model.

[0055] In some implementations, the method for obtaining the candidate question-answer pairs includes: The core semantics of the high-frequency question set are extracted by using a cluster center calculation tool to obtain the core semantic set of the questions; The document content is split into paragraphs based on document formatting rules to obtain a set of paragraph units; The initial question-answer pairs are obtained by associating and matching the core semantic set of the question and the paragraph unit set based on the distance metric. The initial question-answer pair is precisely extracted using a key fragment extraction model to obtain candidate question-answer pairs.

[0056] For example, firstly, the system uses the BERTopic topic model to extract core semantics from the clustered high-frequency question set (such as "reimbursement approval time" and "invoice submission requirements"), generating topic keywords for each question category as the core semantic set of the question; then, based on regular expressions and heading level rules, the PDF-format financial policy document is segmented into paragraphs to form a structured set of paragraph units; next, the BM25 algorithm is used to calculate the correlation between the core semantics of the question and each paragraph unit, initially matching the most relevant document paragraphs to form initial question-answer pairs; finally, through a key fragment extraction model finely tuned based on the RoBERTa architecture, the core statements that directly answer the questions (such as "reimbursement approval usually takes 3-5 working days") are accurately extracted from the matched document paragraphs to generate high-quality candidate question-answer pairs, providing a foundation for subsequent FAQ standardization.

[0057] Based on the above technical solution, a two-stage matching mechanism of "coarse screening + fine extraction" effectively solves the problem of automatically constructing high-quality FAQs from massive documents. This solution first achieves efficient initial screening through rapid matching of core semantics and document structure via clustering, and then relies on the deep semantic understanding capabilities of the RoBERTa model for precise answer localization. This significantly improves the generation efficiency of candidate question-answer pairs while ensuring a high degree of relevance between answer fragments and question intent, thus laying a reliable data foundation for building an accurate FAQ vector library and greatly reducing the reliance on manual processing in traditional methods.

[0058] In one possible implementation of this application embodiment, the above-mentioned S203 can be specifically implemented by the following S401, which will be described in detail below: S401. The top N score sets are filtered through a multi-dimensional screening mechanism to obtain the FAQ similarity score.

[0059] In some implementations, the filtering of the top N score set through a multi-dimensional filtering mechanism includes: Multidimensional feature set is obtained by extracting multidimensional features from the top N score set based on historical query logs. Perform deep semantic matching on user query requests and the standard answers corresponding to the top N score sets to obtain answer relevance scores; The top N score set, the multidimensional feature set, and the answer relevance score are weighted and summed to obtain several comprehensive scores. The FAQ score corresponding to the highest score among several comprehensive scores is marked as the FAQ similarity score.

[0060] It should be noted that the multi-dimensional feature set includes interaction features and literal features; the interaction features include historical click-through rate, user satisfaction rating, and the number of calls in the past 30 days; the literal features are the keyword overlap rate between the corresponding standard question and the user's query request. This multi-dimensional screening mechanism retains a comprehensive evaluation of N highly similar candidates while reducing the bias of a single similarity indicator through hierarchical features (interaction behavior, literal matching, and deep semantics). Simultaneously, controlling the upper limit of N (e.g., N≤5) balances accuracy and efficiency, ensuring accurate location of the optimal FAQ even in multi-candidate scenarios.

[0061] For example, when the variance of the top 3 candidate FAQ scores for the query "How to apply for annual leave" is small, the system first extracts multidimensional features of each candidate, including interaction features (such as the historical click rate of the candidate question "Annual Leave Application Process" being 95%, user satisfaction rating of 4.8 / 5, and 150 calls in the past 30 days) and literal features (overlap rate with the query keywords being 80%). Simultaneously, a BERT-based deep semantic matching model is used to calculate the semantic relevance score between the query and each candidate answer. Subsequently, the initial similarity score (weight 0.6), the normalized value of the multidimensional features (weight 0.25), and the answer relevance score (weight 0.15) are weighted and summed to obtain the comprehensive score for each candidate. Finally, the candidate with the highest comprehensive score, "Annual Leave Application Process," with an initial similarity score of 0.88, is selected as the final FAQ similarity score, effectively solving the selection problem when candidate quality is close and relying solely on vector similarity.

[0062] Based on the above technical solution, the accuracy and stability of FAQ matching are effectively improved by introducing a multi-dimensional screening mechanism. This mechanism constructs a multi-level evaluation system by integrating interaction features (historical click-through rate, user satisfaction, etc.), literal features (keyword overlap rate), and deep semantic matching scores, significantly reducing the random bias of a single vector similarity index. This comprehensive evaluation method retains a thorough examination of the highly similar candidate set while accurately identifying the optimal match through a weighted strategy. Thus, while ensuring response efficiency (by controlling the size of the candidate set), it significantly improves the hit quality of the FAQ channel, enhances the system's adaptability to diverse user expressions, and ultimately achieves synergistic optimization of answer accuracy, user satisfaction, and system resource utilization.

[0063] The foregoing mainly describes the solutions of the embodiments of this application from the perspective of device implementation. It is understood that each device, such as an electronic device, includes at least one of the hardware structures and software modules corresponding to the execution of each function in order to achieve the above-mentioned functions. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software-driven hardware manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0064] This application embodiment can divide the electronic device into functional units according to the above method example. For example, each function can be divided into a separate functional unit, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional unit. It should be noted that the unit division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.

[0065] When using integrated units, Figure 5 A possible structural schematic diagram of the electronic device (denoted as electronic device 50) involved in the above embodiments is shown. The electronic device 50 includes a processing unit 501 and a communication unit 502, and may also include a storage unit 503. Figure 5 The structural diagram shown can be used to illustrate the structure of the electronic device involved in the above embodiments.

[0066] when Figure 5 The schematic diagram shown is used to illustrate the structure of the electronic device involved in the above embodiments. The processing unit 501 is used to control and manage the operation of the electronic device, the communication unit 502 is used for the electronic device to communicate with other devices, and the storage unit 503 is used to store the program code and data of the electronic device.

[0067] For example, communication unit 502 is used to acquire user query requests and historical document data; Processing unit 501 is used to construct a FAQ vector library and a document vector library based on historical document data; calculate the matching similarity between the user's query request and the FAQ vector library using a similarity algorithm to obtain a FAQ similarity score; compare the FAQ similarity score with a preset similarity threshold; when the FAQ similarity score is greater than or equal to the similarity threshold, mark the standard answer corresponding to the FAQ similarity score as the query result; when the FAQ similarity score is less than the similarity threshold, calculate the matching similarity between the user's query request and the document vector library using a similarity algorithm to obtain several document similarity scores and sort them; and generate answers for the document fragments corresponding to the top M document similarity scores based on a large language model to obtain the query result.

[0068] The processing unit 501 can be a processor or a controller, and the communication unit 502 can be a communication interface, transceiver, transceiver circuit, transceiver device, etc. The term "communication interface" is a general term and may include one or more interfaces. The storage unit 503 can be a memory. When the electronic device 50 is a chip, the processing unit 501 can be a processor or a controller, and the communication unit 502 can be an input interface and / or an output interface, pins, or circuits, etc. The storage unit 503 can be a storage unit within the chip (e.g., a register, cache, etc.) or a storage unit located outside the chip (e.g., read-only memory (ROM), random access memory (RAM, etc.).

[0069] The communication unit can also be called a transceiver unit. The antenna and control circuit with transceiver functions in the electronic device 50 can be considered as the communication unit 502 of the electronic device 50, and the processor with processing functions can be considered as the processing unit 501 of the electronic device 50. Optionally, the device in the communication unit 502 used to implement the receiving function can be considered as the communication unit. The communication unit is used to execute the receiving steps in the embodiments of this application, and the communication unit can be a receiver, a receiver circuit, etc. The device in the communication unit 502 used to implement the transmitting function can be considered as the transmitting unit. The transmitting unit is used to execute the transmitting steps in the embodiments of this application, and the transmitting unit can be a transmitter, a transmitter, a transmitting circuit, etc.

[0070] Figure 5If the integrated units in the process are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. Storage media for storing computer software products include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.

[0071] Figure 5 The units in the process can also be called modules; for example, a processing unit can be called a processing module.

[0072] This application also provides a hardware structure diagram of an electronic device (denoted as electronic device 60), see [link to diagram]. Figure 6 The electronic device 60 includes a processor 601, and optionally, a memory 602 connected to the processor 601.

[0073] In the first possible implementation, see Figure 6 The electronic device 60 also includes a transceiver 603. The processor 601, memory 602, and transceiver 603 are connected via a bus. The transceiver 603 is used to communicate with other devices or communication networks. Optionally, the transceiver 603 may include a transmitter and a receiver. The device in the transceiver 603 that implements the receiving function can be considered as a receiver, which is used to perform the receiving steps in the embodiments of this application. The device in the transceiver 603 that implements the transmitting function can be considered as a transmitter, which is used to perform the transmitting steps in the embodiments of this application.

[0074] Based on the first possible implementation method Figure 6 The structural diagram shown can be used to illustrate the structure of the electronic device involved in the above embodiments.

[0075] in, Figure 6 This can also be illustrated by a system chip in an electronic device. In this case, the actions performed by the aforementioned electronic device can be implemented by this system chip; the specific actions performed can be found above and will not be repeated here.

[0076] In implementation, each step of the method provided in this embodiment can be completed by integrated logic circuits in the processor or by instructions in software form. The steps of the method disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.

[0077] The processor in this application may include, but is not limited to, at least one of the following: a central processing unit (CPU), a microprocessor, a digital signal processor (DSP), a microcontroller unit (MCU), or an artificial intelligence processor, etc., which are various computing devices that run software. Each computing device may include one or more cores for executing software instructions to perform calculations or processing. The processor may be a separate semiconductor chip or integrated with other circuits into a single semiconductor chip. For example, it may be integrated with other circuits (such as encoding / decoding circuits, hardware acceleration circuits, or various bus and interface circuits) to form a SoC (System-on-a-Chip), or it may be integrated as a built-in processor within an ASIC. The ASIC with the integrated processor may be packaged separately or together with other circuits. In addition to the cores for executing software instructions to perform calculations or processing, the processor may further include necessary hardware accelerators, such as field-programmable gate arrays (FPGAs), PLDs (programmable logic devices), or logic circuits that implement dedicated logic operations.

[0078] The memory in the embodiments of this application may include at least one of the following types: read-only memory (ROM) or other types of static storage devices capable of storing static information and instructions; random access memory (RAM) or other types of dynamic storage devices capable of storing information and instructions; or electrically erasable programmable-only memory (EEPROM). In some scenarios, the memory may also be a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but is not limited thereto.

[0079] This application also provides a computer-readable storage medium including instructions that, when run on a computer, cause the computer to perform any of the methods described above.

[0080] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to perform any of the methods described above.

[0081] This application also provides a chip including a processor and an interface circuit. The interface circuit is coupled to the processor. The processor is used to run computer programs or instructions to implement the above-described method. The interface circuit is used to communicate with other modules outside the chip.

[0082] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented using software programs, implementation can be, in whole or in part, in the form of a computer program product. This computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device containing one or more servers, data centers, etc., that can be integrated with the medium. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state disks (SSDs)).

[0083] Although this application has been described herein in conjunction with various embodiments, those skilled in the art, by reviewing the accompanying drawings, disclosure, and appended claims, will understand and implement other variations of the disclosed embodiments in carrying out the claimed application. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple instances. A single processor or other unit can implement several functions listed in the claims. While different dependent claims may recite certain measures, this does not mean that these measures cannot be combined to produce good results.

[0084] Although this application has been described in conjunction with specific features and embodiments, it is obvious that various modifications and combinations can be made thereto without departing from the spirit and scope of this application. Accordingly, this specification and drawings are merely exemplary illustrations of this application as defined by the appended claims, and are considered to cover any and all modifications, variations, combinations, or equivalents within the scope of this application. Clearly, those skilled in the art can make various alterations and modifications to this application without departing from the spirit and scope of this application. Thus, if such modifications and modifications of this application fall within the scope of the claims of this application and their equivalents, this application is also intended to include such modifications and modifications.

Claims

1. A document knowledge retrieval method based on a dual-vector library hybrid architecture, characterized in that, include: Obtain user query requests and historical document data; wherein, the historical document data includes document content and historical query logs; A FAQ vector library and a document vector library are constructed based on historical document data; wherein, the FAQ vector library includes several sets of standard questions and corresponding standard answers, and the document vector library includes several document fragments; The similarity score is obtained by calculating the matching similarity between the user's query request and the FAQ vector library through a similarity algorithm. The FAQ similarity score is compared with a preset similarity threshold. When the FAQ similarity score is greater than or equal to the similarity threshold, the standard answer corresponding to the FAQ similarity score is marked as the query result. When the FAQ similarity score is less than the similarity threshold, the matching similarity between the user's query request and the document vector library is calculated using a similarity algorithm to obtain several document similarity scores and sort them. Based on the large language model, answers are generated for the document fragments corresponding to the first M document similarity scores to obtain the query results. Here, M is a positive integer.

2. The method according to claim 1, characterized in that, The steps for constructing the FAQ vector library include: Clustering analysis of historical query logs was performed using a clustering algorithm combined with semantic similarity calculation to obtain a set of high-frequency questions; Candidate question-answer pairs are obtained by associating and matching high-frequency question sets and document content through a key fragment extraction model; wherein, the key fragment extraction model is constructed based on the extractive model of RoBERTa; Candidate question-answer pairs are standardized by combining a FAQ generation model with manual sorting to obtain standard FAQ pairs; wherein, the FAQ generation model is constructed based on the LLM question-answer generation model; The standard FAQ pairs are vectorized and encoded using a pre-trained vector model to obtain a FAQ vector library; wherein the pre-trained vector model is constructed based on Sentence-BERT.

3. The method according to claim 2, characterized in that, The methods for obtaining the candidate question-answer pairs include: The core semantics of the high-frequency question set are extracted by using a cluster center calculation tool to obtain the core semantic set of the questions; The document content is split into paragraphs based on document formatting rules to obtain a set of paragraph units; The initial question-answer pairs are obtained by associating and matching the core semantic set of the question and the paragraph unit set based on the distance metric. The initial question-answer pair is precisely extracted using a key fragment extraction model to obtain candidate question-answer pairs.

4. The method according to claim 2, characterized in that, The steps for constructing the document vector library include: The document parser performs format parsing on the document content to obtain the document structure tree; The document structure tree is semantically segmented using a semantic slicing algorithm to obtain a set of document fragments; A document vector library is obtained by vectorizing a collection of document fragments using a pre-trained vector model.

5. The method according to claim 2, characterized in that, The methods for obtaining the FAQ similarity score include: The user query request is transformed into a query request vector by using a pre-trained vector model. Several standard questions were integrated to obtain a FAQ question vector library; The similarity between the query request vector and the FAQ question vector library is calculated pairwise using a similarity algorithm to obtain the FAQ score set. Select the top N FAQ scores from the FAQ score set and label them as the top N score set; where N is an integer; Calculate the variance of the top N score sets and compare it with a preset variance threshold. When the variance is greater than or equal to the variance threshold, mark the maximum FAQ score in the top N score sets as the FAQ similarity score. When the variance is less than the variance threshold, filter the top N score sets through a multi-dimensional filtering mechanism to obtain the FAQ similarity score.

6. The method according to claim 5, characterized in that, The process of filtering the top N score sets through a multi-dimensional screening mechanism includes: Multidimensional feature set is obtained by extracting multidimensional features from the top N score set based on historical query logs. Perform deep semantic matching on user query requests and the standard answers corresponding to the top N score sets to obtain answer relevance scores; The top N score set, the multidimensional feature set, and the answer relevance score are weighted and summed to obtain several comprehensive scores. The FAQ score corresponding to the highest score among several comprehensive scores is marked as the FAQ similarity score.

7. The method according to claim 5, characterized in that, The document similarity score is obtained through the following methods: The similarity algorithm is used to calculate pairwise similarity between the query request vector and the document vector library to obtain a set of document scores; Select the document segments corresponding to the top K document scores from the document score set and label them as the top K document set; where K is an integer; Based on the Rerank model, the semantic relevance of the query request vector and the top K document set is reordered to obtain document similarity scores and then sorted.

8. The method according to claim 1, characterized in that, The step of generating answers based on the document fragments corresponding to the similarity scores of the first M documents using a large language model includes: The document fragments corresponding to the similarity scores of the top M documents are marked as candidate document fragments; The prompt text is obtained by assembling the user's query request and candidate document fragments using the prompt word engineering tool. The answer is generated from the Prompt text based on a large language model, and the query results are obtained.

9. The method according to claim 5, characterized in that, The similarity threshold is dynamically adjustable; based on historical query logs, user-satisfied FAQ matching cases are selected and their FAQ scores are extracted, and the scores at a preset proportion position are selected as the initial threshold; historical query hit rate, user feedback negative review rate and system average load are statistically analyzed in real time at a preset fixed period to obtain feedback data; adjustment coefficients are calculated by assigning different weights to the feedback data; the initial threshold and adjustment coefficients are summed to obtain the dynamic similarity threshold.

10. An electronic device, characterized in that, include: Communication unit and processing unit; The communication unit is used to acquire user query requests and historical document data; The processing unit is used to construct a FAQ vector library and a document vector library based on historical document data; and to calculate the matching similarity between the user's query request and the FAQ vector library using a similarity algorithm to obtain an FAQ similarity score. The FAQ similarity score is compared with a preset similarity threshold; when the FAQ similarity score is greater than or equal to the similarity threshold, the standard answer corresponding to the FAQ similarity score is marked as the query result. When the FAQ similarity score is less than the similarity threshold, the similarity between the user's query request and the document vector library is calculated using a similarity algorithm, and several document similarity scores are obtained and sorted. Based on a large language model, answers are generated from the document fragments corresponding to the similarity scores of the first M documents, and the query results are obtained.

Citation Information

Cited By

  • Intelligent question and answer method and system based on dual-stage retrieval and generation

    CN122045379A