Document knowledge management method and system based on text retrieval enhancement generation
The document is segmented and meta-knowledge extracted through a large language model, and combined with user feedback to optimize the knowledge base, the problems of insufficient semantic understanding and high demand for manual intervention in the existing document management system are solved, and efficient and automated knowledge processing and multi-scene adaptability are achieved.
Patent Information
- Application Number
- CN202510898879.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2045-07-01
AI Technical Summary
The existing document management system has insufficient semantic understanding and retrieval capabilities, high demand for manual intervention, low knowledge utilization efficiency, single application scenarios, and difficult to adapt to diversified enterprise knowledge bases and educational resource management scenarios.
A large language model is used to segment documents and extract meta-knowledge, build a vectorized document knowledge system, accurately match and generate answers based on user questions, and optimize the knowledge base through user feedback.
A Q&A system with accurate semantic matching is realized, which improves intelligence level and question-and-answer accuracy, reduces labor costs, supports the rapid knowledge of multi-format documents, and builds a context-driven high-quality answering mechanism.
Smart Images

Figure CN120407749A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and specifically relates to artificial intelligence, natural language processing, knowledge management, and intelligent question answering technologies. In particular, it relates to a document knowledge management method and system based on text retrieval enhanced generation. Background Art
[0002] Document management technology is an important part of the information technology field, covering a wide range of application scenarios such as enterprise knowledge management, scientific research literature management, and education and training resource management. Traditional document management systems have core functions of file storage, classification indexing, and full-text retrieval, and have been developed for decades. From manual filing to electronic storage, and then to cloud storage and collaboration in recent years, document management technology has made remarkable progress in improving storage capacity and access efficiency.
[0003] With the development of artificial intelligence technology, some document management systems have begun to introduce basic intelligent functions, such as keyword retrieval, tag recommendation, and simple automatic classification, aiming to improve the extraction and utilization efficiency of knowledge in documents. Current systems mostly implement preliminary semantic matching and question answering functions based on information retrieval technologies (such as TF-IDF, BM25), but most still face problems of single application scenarios and insufficient intelligence.
[0004] Defects and deficiencies of the prior art: 1. Limitations in semantic understanding and retrieval capabilities: Existing systems have insufficient depth of semantic understanding of user questions and can only perform retrieval based on keyword matching or simple semantic embedding, resulting in limited ability to answer complex questions. In the case of rich document knowledge and high semantic similarity, the retrieval results are prone to deviate from user needs and lack accuracy.
[0005] 2. High demand for manual intervention: Most document management systems require users to manually classify, label, or design a structured indexing system to achieve retrieval. This method has certain requirements for the professional skills of operators, is time-consuming and laborious, and has a high management cost. In actual applications, the disadvantages of manually maintained knowledge bases are more prominent due to frequent and irregular document updates.
[0006] 3. Low knowledge utilization efficiency: Traditional systems lack the ability to combine retrieval and generation, and can only provide document fragments matching user questions, unable to further extract answers, reducing the user experience. The system usually relies heavily on knowledge extraction from a single document, unable to associate information across documents, and difficult to form a complete knowledge network.
[0007] 4. Single application scenario and insufficient generality: Most of the existing knowledge management and Q&A systems are optimized for specific fields and are difficult to adapt to diverse scenarios such as enterprise knowledge bases, educational resource management, and customer service support. In the environment of large-scale document sets, the system performance and response speed often decrease significantly due to insufficient resource allocation. Summary of the Invention
[0008] Aiming at the problems of limited semantic understanding and retrieval capabilities, high demand for manual intervention, low knowledge utilization efficiency, and single application scenario existing in the prior art, the present invention aims to provide a document knowledge management method and system based on text retrieval enhanced generation.
[0009] In the first aspect, the present invention provides a document knowledge management method based on text retrieval enhanced generation, including the following steps: S1: Receive the document uploaded by the user, use the first large language model to perform segmentation processing on the document, convert it into a set of multiple knowledge text blocks, extract meta-knowledge from the knowledge text blocks, establish the association relationship between the meta-knowledge and the knowledge text blocks, and then perform vectorization processing on the knowledge text blocks to obtain knowledge text block vectors and store them, constructing a document knowledge system; S2: Receive the input user question, use the knowledge invocation agent to analyze the user question to determine the relevant meta-knowledge, and combine the meta-knowledge and the vector similarity between the knowledge text block vector and the user question vector to retrieve the relevant knowledge text blocks and their knowledge sources from the document knowledge system, constructing a knowledge reference table including the relevant meta-knowledge, knowledge text blocks, and knowledge sources; S3: Integrate the user question with the knowledge reference table to form context information, use the second large language model to generate an answer to the user question based on the context information, and provide the knowledge source corresponding to the cited knowledge text block in the answer; S4: Calculate the final evaluation score according to the user's feedback on the generated answer and the citation accuracy of the knowledge text block in the answer in the knowledge reference table; if the final evaluation score meets the preset conditions, store the current Q&A pair as a new knowledge text block in the document knowledge system; and dynamically adjust the parameters for document segmentation and the number of retrieved relevant knowledge text blocks according to the final evaluation score.
[0010] As an alternative implementation of the first aspect of the present application, the step S1 includes: Document preprocessing: Extract and clean the text of the document uploaded by the user to obtain pure text content; Divide knowledge text blocks: The first large language model reads the pure text content, extracts keywords according to the text content, and divides the text content into a sequence of knowledge text blocks with a maximum token limit around the keywords; Extract and organize meta-knowledge: The first large language model parses each knowledge text block to extract meta-knowledge, unifies similar meta-knowledge, and establishes an association between the meta-knowledge and the relevant knowledge text blocks; Vectorize knowledge text blocks: Use an embedding model to generate vector representations for each knowledge text block and store them in a knowledge text block vector table, which contains the ID, content, affiliated meta-knowledge, and knowledge source information of the knowledge text blocks.
[0011] As an alternative implementation of the first aspect of the present application, the step S2 includes: Meta-knowledge matching: The third large language model in the knowledge invocation intelligent body analyzes the user's question, identifies the meta-knowledge involved in the question, and compares it with the meta-knowledge in the document knowledge system to obtain a sequence of relevant meta-knowledge; Preliminary vector screening: According to the sequence of relevant meta-knowledge and its association with the knowledge text blocks, screen out a sequence of knowledge text block vectors that are preliminarily relevant from the knowledge text block vector table; Similarity calculation and screening: Vectorize the user's question, calculate its similarity with each vector in the sequence of preliminarily relevant knowledge text block vectors, sort according to the similarity scores, and select a predetermined number of knowledge text block vectors with the highest similarity and their corresponding knowledge text blocks and knowledge sources, which together with the found corresponding meta-knowledge constitute a knowledge reference table.
[0012] As an alternative implementation of the first aspect of the present application, the similarity calculation between the user question vector and the knowledge text block vector adopts cosine similarity.
[0013] As an alternative implementation of the first aspect of the present application, in the step S4, the steps of calculating the final evaluation score according to the user's feedback on the generated answer and the accuracy of the answer's reference to the knowledge text blocks in the knowledge reference table include: Calculate the answering effectiveness score: The involved meta-knowledge is calculated according to the user's feedback on whether the answer is helpful, and the feedback is represented by positive samples and negative samples; Calculate the knowledge citation accuracy score: The fourth large language model analyzes whether the generated answer accurately cites the knowledge text blocks in the knowledge reference table and provides the knowledge source according to the generated answer and the knowledge reference table, and gives the knowledge citation accuracy score; Calculate the final score: Perform a weighted average on the answering effectiveness score and the knowledge citation accuracy score to obtain the final evaluation score.
[0014] As an alternative implementation of the first aspect of the present application, in step S4, if the final evaluation score meets the preset conditions, the step of storing the current Q&A pair as a new knowledge text block into the document knowledge system further includes: performing vectorization processing on the new knowledge text block and storing it in the knowledge text block vector table, and simultaneously establishing a connection with the corresponding meta-knowledge according to the meta-knowledge used in this Q&A.
[0015] As an alternative implementation of the first aspect of the present application, in step S4, the step of dynamically adjusting the parameters for document segmentation and the number of relevant knowledge text blocks retrieved according to the final evaluation score includes: when the final evaluation score is higher than the preset threshold, increasing the maximum token limit for document segmentation and the number of relevant knowledge text blocks retrieved; when the final evaluation score is lower than the preset threshold, reducing the maximum token limit for document segmentation and the number of relevant knowledge text blocks retrieved.
[0016] In a second aspect, an embodiment of the present application provides a document knowledge management system based on text retrieval enhanced generation, including: A knowledge document conversion module, configured to receive a document uploaded by a user, perform segmentation processing on the document using a first large language model, convert it into a set of multiple knowledge text blocks, extract meta-knowledge from the knowledge text blocks, establish an association relationship between the meta-knowledge and the knowledge text blocks, then perform vectorization processing on the knowledge text blocks, obtain knowledge text block vectors and store them, and construct a document knowledge system; A knowledge retrieval and reference construction module, configured to receive an input user question, analyze the user question using a knowledge invocation agent to determine relevant meta-knowledge, and combine the vector similarity between the meta-knowledge, the knowledge text block vectors and the user question vector to retrieve relevant knowledge text blocks and their knowledge sources from the document knowledge system, and construct a knowledge reference table including the relevant meta-knowledge, knowledge text blocks and knowledge sources; A Q&A generation and knowledge tracing module, configured to fuse the user question and the knowledge reference table to form context information, use a second large language model to generate an answer to the user question based on the context information, and provide the knowledge source corresponding to the cited knowledge text block in the answer; A feedback learning and system optimization module, configured to calculate a final evaluation score according to the user's feedback on the generated answer and the citation accuracy of the knowledge text blocks in the knowledge reference table by the answer; if the final evaluation score meets the preset conditions, store the current Q&A pair as a new knowledge text block into the document knowledge system; and dynamically adjust the parameters for document segmentation and the number of relevant knowledge text blocks retrieved according to the final evaluation score.
[0017] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of the method described in the first aspect are implemented.
[0018] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0019] Compared with the prior art, the present invention provides a document knowledge management method based on text retrieval enhanced generation, which has the following beneficial effects: 1. Implement a question-answering system with accurate semantic matching: Through the vectorized semantic representation method and the meta-knowledge association mechanism, the large model can deeply understand the user's intention, achieve accurate matching at the knowledge fragment level, and significantly improve the accuracy and intelligence level of question answering.
[0020] 2. Build an efficient and automated knowledge processing process: By combining the large model with the pre-trained embedding model, automatically complete document slicing, meta-knowledge extraction, and structured vectorization, significantly improve the processing efficiency, reduce labor costs, and support the rapid knowledgeization of multi-format documents.
[0021] 3. Create a context-driven high-quality answer mechanism: The system constructs a structured knowledge reference table and fuses the context to dynamically generate the final question context, making the generated answers have context consistency and reasoning logic, and greatly improving the response ability to complex questions.
[0022] 4. Provide a feedback-driven knowledge optimization mechanism: Introduce a learning mechanism jointly driven by user feedback and citation accuracy scoring, dynamically adjust the slicing parameters and reference dimensions according to the question-answering performance, realize the self-optimization and continuous enhancement of the knowledge base, and build an intelligent learning closed loop. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 is a flowchart of a document knowledge management method based on text retrieval enhanced generation provided by the first embodiment of the present invention; Figure 2 is a schematic flowchart of document knowledge transformation in the first embodiment of the present invention; Figure 3 is a schematic flowchart of knowledge retrieval and reference construction in the first embodiment of the present invention; Figure 4 is a schematic flowchart of feedback learning and system optimization in the first embodiment of the present invention; Figure 5 is a schematic structural diagram of a document knowledge management system based on text retrieval enhanced generation proposed in the second embodiment of the present invention. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0025] The terms "first", "second", etc. in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the application can be implemented in a sequence other than those illustrated or described here. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated before and after are in a kind of "or" relationship. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically limited.
[0026] Example 1 See also Figure 1 , is a flowchart of a document knowledge management method based on text retrieval and enhanced generation provided by an embodiment of the present invention. The method may include the following steps: S1, document knowledge transformation (corresponding to Figure 2 ): Receive documents uploaded by users, use the first large language model to segment the documents, convert them into a collection of multiple knowledge text blocks, extract meta-knowledge from the knowledge text blocks, establish an association between the meta-knowledge and the knowledge text blocks, and then vectorize the knowledge text blocks to obtain and store knowledge text block vectors to build a document knowledge system.
[0027] For the document uploaded by the user (denoted as k), the large model reads the document in large length and divides the document into independent text blocks according to the document segmentation and context semantics, and converts them into knowledge text blocks that can be used separately (composed of a collection ); Next, all knowledge text blocks converted from the document are parsed to extract the meta-knowledge contained in all knowledge text blocks (denoted as Each knowledge block contains several pieces of meta-knowledge, and a piece of meta-knowledge also appears in several knowledge blocks. By associating meta-knowledge with knowledge blocks, the document-to-knowledge transformation is completed. This is done in three steps.
[0028] Step 1: Document preprocessing Document Perform text extraction, clean up irrelevant information (such as extra spaces, punctuation), and form a complete and smooth pure text content, and store it in the "document table" to prepare for conversion.
[0029] Step 2: Divide the knowledge text blocks The first large language model reads through the text obtained from the preprocessing steps , extracts keywords according to the text content, and divides the text into blocks around the keywords (each text block is denoted as , with a maximum token limit, and immediately splits when the maximum token is exceeded), forming an independent sequence of knowledge text blocks , and store it in the "knowledge text block table".
[0030] Step 3: Extract meta-knowledge and organize the document knowledge system The first large language model parses each knowledge text block , extracts the meta-knowledge in it . After all knowledge text blocks are parsed, similar meta-knowledge is unified into one meta-knowledge, and all meta-knowledge is stored in the "meta-knowledge table", and associations are established between the meta-knowledge and related knowledge text blocks to form a network.
[0031] The sequence of knowledge text blocks is vectorized using the text-embedding-3-small model to generate a vector representation for each knowledge text block , where each vector representation is calculated by the following formula: Among them, is the weight matrix of the embedding model, is the bias term, is the vector representation of the knowledge text block . All vector representations are stored in the "knowledge text block vector table", which contains not only the vector representations of each knowledge text block, but also information such as the ID, content, affiliated meta-knowledge, knowledge source, etc. of the knowledge text block.
[0032] After vectorization is completed in this way, a complete document knowledge system is constructed, providing a basis for subsequent knowledge retrieval and invocation based on similarity.
[0033] S2. Knowledge Retrieval and Reference Construction (corresponding to Figure 3): Receive the input user question, use the knowledge invocation agent to analyze the user question to determine relevant meta-knowledge, and retrieve relevant knowledge text chunks and their knowledge sources from the document knowledge system by combining the meta-knowledge, the vector similarity between the knowledge text chunk vectors and the user question vector, and construct a knowledge reference table containing the relevant meta-knowledge, knowledge text chunks, and knowledge sources.
[0034] To construct a more accurate and structured knowledge reference table (denoted as ), having the third large language model refer to accurate and structured knowledge helps to avoid hallucinations in the large model. The knowledge reference table contains the following elements: meta-knowledge , knowledge text chunks , and knowledge sources (i.e., the document sources of the knowledge text chunks). Constructing the knowledge reference table requires the following two steps.
[0035] First step, use the knowledge invocation agent (denoted as ), which manages the "meta-knowledge table" and the association between meta-knowledge and knowledge text chunks. After the user inputs a question , the large model in the agent analyzes the question for the possible meta-knowledge , compares it with the meta-knowledge in the "meta-knowledge table" to obtain a relevant meta-knowledge sequence. Subsequently, according to the association between meta-knowledge and knowledge text chunks, find all relevant knowledge text vector sequences in the "knowledge text chunk vector table".
[0036] Second step, construct the knowledge reference table . Vectorize the user question using the text-embedding-3-small model to obtain the user question vector , and then calculate the similarity between the knowledge text vector sequences provided by the knowledge invocation agent and respectively to obtain a similarity sequence . The similarity calculation method is: where represents the two-norm of the vector (i.e., the vector length).
[0037] According to the similarity scores, sort them from high to low, take the top 5 knowledge text chunk vectors with the highest similarity (the number of knowledge text chunk vectors taken is denoted as , which can be adjusted independently), find the corresponding knowledge text chunks and knowledge sources , and the corresponding meta-knowledge found in the first step Together, build a knowledge reference table .
[0038] S3. Question and answer generation and knowledge tracing: The user question is integrated with the knowledge reference table to form context information, and a second large language model is used to generate an answer to the user question based on the context information, and the knowledge source corresponding to the referenced knowledge text block is provided in the answer.
[0039] Build a good knowledge reference table After that, the reference table, user questions And the second large language model task setting fusion constitutes the final context , making the second large language model context-based , using document knowledge to generate reference answers and providing the knowledge source of the knowledge used in the reply .
[0040] S4, Feedback Learning and System Optimization (corresponding to Figure 4 ): Calculate the final evaluation score based on the user's feedback on the generated answer and the accuracy of the answer's reference to the knowledge text block in the knowledge reference table; if the final evaluation score meets the preset conditions, store the current question and answer pair as a new knowledge text block in the document knowledge system; and dynamically adjust the parameters for document segmentation and the number of retrieved related knowledge text blocks based on the final evaluation score.
[0041] Strengthen the knowledge system based on user feedback, enhance the fourth-largest language model's understanding of document knowledge, and adopt a set of scoring and feedback mechanisms to optimize the knowledge system during user use, so that the fourth-largest language model can learn document knowledge through user use and feedback. This solution is divided into the following three steps.
[0042] Step 1: Answer the valid score calculation ( ) User feedback ,in: Indicates that the user thinks the answer Helpful (positive sample) Indicates that the user thinks the answer Not helpful (negative samples) The effective answer score is defined as: Step 2: Calculation of knowledge citation accuracy score ( ) After each answer is generated, the fourth large language model uses the knowledge reference table and answer , analyze whether the knowledge text block in the reference table is accurately cited and accurately provide the knowledge source , and give an accurate score for knowledge citation .
[0043] Step 3: Final score calculation ( ) Set the scoring weight , to control the relative importance of user feedback and the accuracy of knowledge citation, then the final score is a weighted average: When , it is considered that the Q&A is valid, and save this Q&A as a new knowledge text block , and store it in the "Knowledge Text Block Table", establish a connection with the corresponding meta-knowledge according to the meta-knowledge used this time, and at the same time perform vectorization processing into a vector representation store it in the "Knowledge Text Block Vector Table".
[0044] To further optimize the construction of the knowledge system and the retrieval effect, dynamically adjust the following two parameters according to the value of the final score , the maximum token limit when slicing documents , the number of the top relevant knowledge text blocks returned in the knowledge reference table. The adjustment strategy is as follows: When is higher than the preset threshold ( ), it indicates that the current slice quality and the reference text hit effect are good, and the values of and can be appropriately increased to make the knowledge text block more contextually complete and expand the reference range; When is lower than the preset threshold (such as ), it indicates that the knowledge expression or hit degree is insufficient, and the values of and can be appropriately reduced to make the slice finer and the retrieval more concentrated.
[0045] Through the cyclic iteration of the above four steps, the method described in the present invention can continuously learn from user interactions and documents, and continuously optimize its knowledge base and Q&A performance.
[0046] It should be noted that the "first large language model", "second large language model", "third large language model", and "fourth large language model" mentioned in the present invention can be the applications of a general large model with multiple capabilities at different stages or tasks, or different model instances that have been fine-tuned or optimized for specific tasks (such as text understanding, knowledge extraction, question answering generation, evaluation). Embedding models such as "text-embedding-3-small" are text vectorization tools available currently or in the future. Various "tables" (such as document tables, knowledge text block tables, meta-knowledge tables, knowledge text block vector tables) are logical data storage structures that can be implemented by relational databases, NoSQL databases, or specialized vector databases.
[0047] Embodiment 2 Please refer to Figure 5 , which shows a schematic structural diagram of a document knowledge management system based on text retrieval enhanced generation proposed in the second embodiment of the present application. The system includes the following key modules: The knowledge document conversion module 100 is used to receive the document uploaded by the user, perform segmentation processing on the document by using the first large language model, convert it into a set of multiple knowledge text blocks, extract meta-knowledge from the knowledge text blocks, establish an association relationship between the meta-knowledge and the knowledge text blocks, then perform vectorization processing on the knowledge text blocks, obtain knowledge text block vectors and store them, and construct a document knowledge system; The knowledge retrieval and reference construction module 200 is used to receive the input user question, analyze the user question by using the knowledge call intelligent agent to determine relevant meta-knowledge, and combine the meta-knowledge, the vector similarity between the knowledge text block vectors and the user question vector, retrieve relevant knowledge text blocks and their knowledge sources from the document knowledge system, and construct a knowledge reference table including the relevant meta-knowledge, knowledge text blocks and knowledge sources; The question answering generation and knowledge traceability module 300 is used to fuse the user question with the knowledge reference table to form context information, generate an answer to the user question based on the context information by using the second large language model, and provide the knowledge source corresponding to the cited knowledge text block in the answer; The feedback learning and system optimization module 400 is used to calculate the final evaluation score according to the user's feedback on the generated answer and the citation accuracy of the knowledge text blocks in the knowledge reference table by the answer; if the final evaluation score meets the preset conditions, then store the current question-answer pair as a new knowledge text block in the document knowledge system; and dynamically adjust the parameters for document segmentation and the number of retrieved relevant knowledge text blocks according to the final evaluation score.
[0048] A document knowledge management system based on text retrieval enhanced generation in the embodiments of the present application can be a device, or a component, an integrated circuit, or a chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a handheld computer, a vehicle-mounted electronic device, a wearable device, an Ultra-mobile Personal Computer (UMPC), a netbook, or a Personal Digital Assistant (PDA), etc., and the non-mobile electronic device can be a server, a Network Attached Storage (NAS), a Personal Computer (PC), etc., which are not specifically limited in the embodiments of the present application.
[0049] A document knowledge management system based on text retrieval enhanced generation in the embodiments of the present application can be a device with an operating system. The operating system can be an Android operating system, an IOS operating system, or other possible operating systems, which are not specifically limited in the embodiments of the present application.
[0050] A document knowledge management system based on text retrieval enhanced generation provided in the embodiments of the present application can implement Figure 1 each process implemented by a document knowledge management method based on text retrieval enhanced generation in the method embodiments. To avoid repetition, it will not be elaborated here.
[0051] Optionally, the embodiments of the present application further provide an electronic device, including a processor, a memory, and a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, it implements each process of the above-mentioned document knowledge management method embodiment based on text retrieval enhanced generation and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0052] The embodiments of the present application further provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by the processor, it implements each process of the above-mentioned document knowledge management method embodiment based on text retrieval enhanced generation and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0053] Wherein, the processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer-readable storage medium, such as a computer Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disc, etc.
[0054] It should be noted that, in this document, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, article or device comprising such element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in a reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, the features described with reference to certain examples may be combined in other examples.
[0055] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions for causing a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present application.
[0056] The embodiments of the present application have been described above in conjunction with the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Under the inspiration of the present application, those of ordinary skill in the art can also make many forms without departing from the purpose of the present application and the scope protected by the claims, and all of them belong to the protection scope of the present application.
Claims
1. A document knowledge management method based on text retrieval enhanced generation, characterized in that It includes the following steps: S1: Receive the document uploaded by the user, use the first large language model to segment the document, convert it into a set of multiple knowledge text blocks, extract meta-knowledge from the knowledge text blocks, establish the association relationship between the meta-knowledge and the knowledge text blocks, then perform vectorization processing on the knowledge text blocks, obtain the knowledge text block vectors and store them, and construct a document knowledge system; S2: Receive the input user question, use the knowledge invocation agent to analyze the user question to determine the relevant meta-knowledge, and combine the meta-knowledge, the vector similarity between the knowledge text block vectors and the user question vector, and retrieve the relevant knowledge text blocks and their knowledge sources from the document knowledge system, and construct a knowledge reference table including the relevant meta-knowledge, knowledge text blocks and knowledge sources; S3: Integrate the user question with the knowledge reference table to form context information, use the second large language model to generate an answer to the user question based on the context information, and provide the knowledge source corresponding to the cited knowledge text block in the answer; S4: Calculate the final evaluation score according to the user's feedback on the generated answer and the citation accuracy of the knowledge text blocks in the answer in the knowledge reference table; if the final evaluation score meets the preset conditions, store the current question-answer pair as a new knowledge text block in the document knowledge system; and dynamically adjust the parameters for document segmentation and the number of retrieved relevant knowledge text blocks according to the final evaluation score.
2. The method according to claim 1, wherein The step S1 includes: Document preprocessing: Perform text extraction and cleaning on the document uploaded by the user to obtain pure text content; Dividing knowledge text blocks: The first large language model reads through the pure text content, extracts keywords according to the text content, and divides the text content into a sequence of knowledge text blocks with a maximum token limit around the keywords; Extracting and organizing meta-knowledge: The first large language model parses each knowledge text block to extract meta-knowledge, unifies similar meta-knowledge, and establishes an association between the meta-knowledge and the relevant knowledge text blocks; Vectorization of knowledge text blocks: Use an embedding model to generate vector representations for each knowledge text block and store them in a knowledge text block vector table, which includes the ID, content, affiliated meta-knowledge and knowledge source information of the knowledge text blocks.
3. The method according to claim 1 or 2, characterized in that, The step S2 includes: Meta-knowledge matching: The third large language model in the knowledge invocation agent analyzes the user question, identifies the meta-knowledge involved in the question, and compares it with the meta-knowledge in the document knowledge system to obtain a relevant meta-knowledge sequence; Initial vector screening: According to the relevant meta-knowledge sequence and its association with the knowledge text blocks, screen out an initially relevant knowledge text block vector sequence from the knowledge text block vector table; Similarity calculation and screening: Vectorize the user question, calculate its similarity with each vector in the initially relevant knowledge text block vector sequence, sort according to the similarity scores, select a predetermined number of knowledge text block vectors with the highest similarity and their corresponding knowledge text blocks and knowledge sources, and jointly form a knowledge reference table with the corresponding meta-knowledge found.
4. The method according to claim 3, wherein The similarity between the user question vector and the knowledge text block vector is calculated using cosine similarity.
5. The method according to claim 1, wherein In step S4, the steps of calculating the final evaluation score according to the user's feedback on the generated answer and the accuracy of the reference to the knowledge text block in the knowledge reference table include: Calculating the answer effectiveness score: The involved meta-knowledge is calculated based on the user's feedback on whether the answer is helpful, and the feedback is represented by positive and negative samples; Calculating the knowledge reference accuracy score: The fourth large language model analyzes whether the generated answer accurately references the knowledge text block in the knowledge reference table and provides the knowledge source based on the generated answer and the knowledge reference table, and gives the knowledge reference accuracy score; Calculating the final score: The final evaluation score is obtained by weighted averaging the answer effectiveness score and the knowledge reference accuracy score.
6. The method according to claim 1 or 5, characterized in that In step S4, if the final evaluation score meets the preset conditions, the steps of storing the current Q&A pair as a new knowledge text block in the document knowledge system further include: Performing vectorization processing on the new knowledge text block and storing it in the knowledge text block vector table, and establishing a connection with the corresponding meta-knowledge according to the meta-knowledge used in this Q&A.
7. The method according to claim 1 or 5, characterized in that, In step S4, the steps of dynamically adjusting the parameters for document segmentation and the number of retrieved relevant knowledge text blocks according to the final evaluation score include: When the final evaluation score is higher than the preset threshold, increase the maximum token limit for document segmentation and the number of retrieved relevant knowledge text blocks; When the final evaluation score is lower than the preset threshold, reduce the maximum token limit for document segmentation and the number of retrieved relevant knowledge text blocks.
8. A document knowledge management system based on text retrieval enhanced generation, characterized in that, Including: A knowledge document conversion module for receiving a document uploaded by a user, using a first large language model to perform segmentation processing on the document, converting it into a set of multiple knowledge text blocks, extracting meta-knowledge from the knowledge text blocks, establishing an association relationship between the meta-knowledge and the knowledge text blocks, then performing vectorization processing on the knowledge text blocks, obtaining knowledge text block vectors and storing them, and constructing a document knowledge system; A knowledge retrieval and reference construction module for receiving an input user question, using a knowledge invocation agent to analyze the user question to determine relevant meta-knowledge, and combining the meta-knowledge and the vector similarity between the knowledge text block vector and the user question vector to retrieve relevant knowledge text blocks and their knowledge sources from the document knowledge system, and constructing a knowledge reference table including the relevant meta-knowledge, knowledge text blocks and knowledge sources; A Q&A generation and knowledge tracing module for fusing the user question and the knowledge reference table to form context information, using a second large language model to generate an answer to the user question based on the context information, and providing the knowledge source corresponding to the referenced knowledge text block in the answer; A feedback learning and system optimization module is used to calculate a final evaluation score based on the user's feedback on the generated answer and the citation accuracy of the knowledge text block in the knowledge reference table by the answer; if the final evaluation score meets a preset condition, the current question-answer pair is stored as a new knowledge text block in the document knowledge system; and the parameters for document segmentation and the number of retrieved relevant knowledge text blocks are dynamically adjusted according to the final evaluation score.
9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instruction stored on the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of a document knowledge management method based on text retrieval enhanced generation as described in any one of claims 1-7 are implemented.
10. A readable storage medium, characterized in that, A program or instruction is stored on the readable storage medium. When the program or instruction is executed by the processor, the steps of a document knowledge management method based on text retrieval enhanced generation as described in any one of claims 1-7 are implemented.
Citation Information
Patent Citations
Question generation system based on answer perception
CN117195864A
Question and answer retrieval method and system fusing document knowledge and question and answer pair data
CN117407505A
Scientific and technical literature category automatic mapping model training and predicting method
CN117688945A
RAG retrieval optimization method and system based on title enhancement and intention recognition
CN118467681A
Vector knowledge base-based large-model question-answer dialogue method and system and storage medium
CN118484526A
Cited By
Knowledge question-answering method based on improved RAG and agent workflow
CN120929577A