Intelligent rule and regulation question answering method and device based on two-stage retrieval and large model

Through a two-stage search strategy, combining sparse vectors and dense vector models, the problems of low search accuracy and irrelevant text interference in the existing technology are solved, and a more accurate and comprehensive rule-based intelligent Q&A effect is achieved.

CN119807346AActive Publication Date: 2025-04-1110TH RES INST OF CETC

Patent Information

Application Number
CN202411778714.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-04-11
Estimated Expiration
2044-12-05

AI Technical Summary

Technical Problem

The existing rules and regulations intelligent question-and-answer technology has insufficient retrieval accuracy and irrelevant text interference, resulting in inaccurate and comprehensive enough answers.

Method used

Using a two-stage search strategy, firstly, the files that are most relevant to the user's questions are retrieved through a mixture of sparse vector search and dense vector search, and then the second stage of text block search is carried out within the file scope to ensure the accuracy of the reference text.

Benefits of technology

Improve the search accuracy and comprehensiveness of the rules and regulations Q&A, ensuring that more accurate answers are generated within a time range acceptable to users.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807346A_ABST
    Figure CN119807346A_ABST
Patent Text Reader

Abstract

The invention discloses a rule and regulation intelligent question-answering method and device based on two-stage retrieval and a large model, and belongs to the field of rule and regulation file-based intelligent question-answering, and the method comprises the following steps: carrying out file abstract extraction on each file based on a large model question-answering form, and constructing an abstract vector library; cutting and partitioning all the files, respectively vectorizing text boxes of all text blocks by adopting a sparse vector model and a dense vector model, and constructing a content vector library; in the first stage, files most relevant to questions of a user are retrieved, two vector libraries are retrieved in a mixed retrieval mode, and weighted calculation is conducted on retrieval on the two sides to obtain the first K most relevant files; in the second stage, the text blocks most relevant to the questions of the user are retrieved, and the first k most relevant text blocks are obtained through mixed retrieval; and during answering, taking the first k most relevant text blocks as reference texts, and enabling the large model to answer based on the reference texts. According to the invention, more accurate answers can be generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of intelligent question answering based on rules and regulations documents, and more specifically, to a method and device for intelligent question answering of rules and regulations based on two-stage retrieval and large models. Background Art

[0002] As companies continue to grow and expand their business, the company's internal rules and regulations will continue to accumulate. Generally, companies will simply store the rules and regulations in a database. When employees have business needs or new employees join the company, they need to consult relevant rules and regulations. It is often cumbersome and difficult to get answers immediately. They can only slowly consult relevant personnel or search for documents by themselves.

[0003] Existing intelligent question-answering technology for rules and regulations: Intelligent question-answering methods based on retrieval-enhanced generation technology. With the development of big model technology, most of the existing rules and regulations question-answering are implemented using retrieval-enhanced generation (RAG). First, a knowledge base is built, all files are cut into several text blocks, and the text blocks are vectorized and stored in the vector database. Then, according to the user's question, the vector is retrieved from the knowledge base to obtain the reference content. Finally, the reference content and the user's question are passed to the big model, so that the big model can answer the user's question based on the reference content. However, in the content retrieval stage, due to the problem that the rules and regulations files are too many and messy, the retrieval method is not optimized separately for the rules and regulations field, resulting in the low retrieval accuracy of the existing technology. Moreover, the questions and answers for rules and regulations are often concentrated in one file. The existing retrieval scheme will result in the retrieval of text blocks of several files, resulting in many irrelevant text blocks in the reference text given to the big model, which in turn results in the final generated answer sometimes not answering the question and being incomplete. Summary of the invention

[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a method and device for intelligent question answering of rules and regulations based on two-stage retrieval and large models, which can generate more accurate answers.

[0005] The object of the present invention is achieved through the following solutions:

[0006] A method for intelligent question answering of regulations based on two-stage retrieval and large models, comprising:

[0007] S1, constructing a knowledge base: extracting a summary of each file based on a large model question-answering format, and constructing a summary vector library; then cutting all files into blocks, and vectorizing all text blocks using a sparse vector model and a dense vector model to obtain corresponding sparse vectors and dense vectors, and constructing a content vector library;

[0008] S2, two-stage retrieval: During retrieval, a two-stage retrieval strategy is adopted. In the first stage, the files most relevant to the user's question are retrieved. A hybrid retrieval method of sparse vector retrieval and dense vector retrieval is used to search the two vector libraries. The retrieval on both sides is weighted to obtain the top K most relevant files. In the second stage, the text blocks most relevant to the user's question are retrieved. In this stage, hybrid retrieval is also used to obtain the top k most relevant text blocks.

[0009] S3, when answering, use the top k most relevant text blocks as reference texts, and let the large model answer based on the reference texts.

[0010] Furthermore, in step S1, a summary is performed on each file based on the large model question-answering format to construct a summary vector library; all files are then cut into blocks, and all text blocks are vectorized using a sparse vector model and a dense vector model to obtain corresponding sparse vectors and dense vectors, and a content vector library is constructed, which specifically includes the following sub-steps:

[0011] S11: Use the big model to extract a summary of each file, pass the content of each file as a reference text to the big model, and let the big model generate summary content based on the reference text;

[0012] S12: Use the sparse vector model and the dense vector model to perform vector embedding operations on the summary content to generate vector data V s and V d ; Stored in Mongodb's abstract_db library in the form of {abstract text content, file name}, and in {V s ,V d , file name} in the abstract_db library of Milvus, and the construction of the abstract knowledge base is completed;

[0013] S13: Cut each file into a number of text blocks in turn, and divide the text content from a semantic perspective;

[0014] S14: Use the sparse vector model and the dense vector model to perform vector embedding operations on each text block to generate vector data V s and V d ; Stored in Mongodb's content_db library in the form of {text block content, file name}, and in the form of {V s ,V d , file name} in the Milvus content_db library, and the content knowledge base is built.

[0015] Furthermore, in step S2, a two-stage search strategy is adopted during the search. In the first stage, the files most relevant to the user's question are retrieved, and a hybrid search method of sparse vector search and dense vector search is used to search the two vector libraries, and the search on both sides is weighted to obtain the top K most relevant files; in the second stage, the text blocks most relevant to the user's question are retrieved, and this stage also uses hybrid search to obtain the top k most relevant text blocks, which specifically includes the following sub-steps:

[0016] S21: Use sparse vector model and dense vector model to embed the user's question content into vectors to obtain the question vector set V q = {V qs ,V qd};

[0017] S22: A hybrid retrieval method of sparse vector retrieval and dense vector retrieval is used to perform vector searches in the summary knowledge base and the content knowledge base respectively to obtain the most k1 relevant results and the most k2 relevant results; a text block retrieval result in the summary knowledge base is defined as U abstract_i = {Sa, Aa, Fa}, where i is the index of the result, Sa is the score, Aa is the summary content, and Fa is the corresponding file name; define a text block retrieval result in the content knowledge base as U content_i ={St,Tt,Ft}, where i is the index of the result, St is the score, Tt is the text block content, and Ft is the corresponding file name;

[0018] S23: weighting the search results to obtain the most relevant document set;

[0019] S24: Second stage retrieval: In the most relevant file range, hybrid retrieval is used to search in the content knowledge base to obtain the most relevant text block; the k most relevant text blocks to the user's question are retrieved from the file collection filtered in the first stage, and the results with scores lower than the set value are eliminated; after two stages of retrieval, the retrieved text blocks are spliced ​​together and passed to the large model as reference text, so that the large model can give the answer to the user's question based on the reference text.

[0020] Furthermore, in step S23, the search results are weighted to obtain the most relevant document set, which specifically includes the following sub-steps:

[0021] S231: Taking files as units, obtain the U corresponding to each file. abstract and U content , and get a result set U corresponding to each file result = {U abstract_1 ,U abstract_2 ,…,U abstract_n1 ,U content_1 ,Ucontent_2 ,…,U content_n2};

[0022] S232: Based on the result set of each file, a file score is calculated for each file, and the calculation method is: W a *(U abstract_1 +U abstract_1 +…+U abstract_1 )+W t *(U content_1 +U content_2 +…+U content_n2 ) / N(U result ), where W a is the weight of the summary knowledge base result, W t is the result weight of the content knowledge base, N(U result ) is U result The number of elements in ;

[0023] S233: Calculate the file score for each file, sort them according to the file score and then extract them.

[0024] Further, in step S22, k1=k2=15, the range of Sa is between [0,1], and the range of St is between [0,1].

[0025] Further, in step S24, k is 10 and the set value is 0.3.

[0026] Further, in step S232, W is set a =0.4,W t is 0.6.

[0027] Further, in step S233, the sorting according to file scores is specifically sorting from high to low.

[0028] Furthermore, after sorting from high to low, the first 30% of the files are taken out after sorting according to the file scores, and at least one file is taken out.

[0029] A smart question-answering device for rules and regulations based on two-stage retrieval and large models, comprising a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is loaded by the processor, any of the methods described above is executed.

[0030] The beneficial effects of the present invention include:

[0031] Compared with the existing intelligent question-answering methods based on retrieval enhancement generation technology, the present invention, within a time range acceptable to users, targets the question-answering scenario of rules and regulations by constructing a summary knowledge base and a content knowledge base, and adopts two-stage retrieval to obtain text blocks that are more precise to the user's questions. Based on these text blocks, the large model can generate more accurate answers. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0033] Figure 1 A diagram showing the steps of building a knowledge base according to an embodiment of the present invention;

[0034] Figure 2 This is a two-stage retrieval process of an embodiment of the present invention. DETAILED DESCRIPTION

[0035] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.

[0036] The specific implementation process of the present invention is as follows:

[0037] In view of the fact that the existing technology cannot accurately and comprehensively retrieve relevant files and text block contents during the question-and-answer process of rules and regulations, and there is also the problem that irrelevant text blocks are retrieved and interfere with the final answer results, the present invention proposes a method for intelligent question-and-answer of rules and regulations based on two-stage retrieval and a large model. In the retrieval stage, the existing technology will only retrieve the first k relevant text blocks in one step, and these k relevant text blocks are the reference texts subsequently passed to the large model.

[0038] The method of the present invention firstly summarizes each file based on the large model question-answering form when constructing the knowledge base, and builds a summary vector library. Secondly, all files are cut and divided into blocks, and all text blocks are vectorized respectively using sparse vector models and dense vector models to obtain corresponding sparse vectors and dense vectors, and a content vector library is constructed. The purpose of this is to lay the foundation for the subsequent retrieval stage.

[0039] During the retrieval, a two-stage retrieval strategy is adopted. The purpose of the first stage is to retrieve the files that are most relevant to the user's question. A hybrid search (sparse vector search + dense vector search) is used to search the two vector libraries, and the search on both sides is weighted to obtain the top K most relevant files. The purpose of the second stage is to retrieve the text blocks that are most relevant to the user's question. Since the scope of files is narrowed in the first stage, more relevant texts can be obtained in this stage without being disturbed by other irrelevant files. This stage also uses hybrid search to obtain the top k most relevant text blocks.

[0040] When answering, the top k most relevant text blocks are used as reference texts, and the large model is allowed to answer based on the reference texts.

[0041] Furthermore, the following are included:

[0042] 1. Build a knowledge base

[0043] The knowledge base is a container for carrying knowledge. In the field of regulatory system questions and answers, the knowledge base includes all regulatory system contents of an enterprise. In order to answer questions about regulations and systems more accurately, the present invention uses the MongoDB document database and the Milvus vector database to jointly construct a knowledge base. Storage is performed in units of text blocks. MongoDB stores the text content of text blocks, and the Milvus vector database stores the vectorized data of text blocks. The present invention constructs two knowledge bases, one is a summary knowledge base. The summary of a file is a highly compressed version of the file content, which is conducive to more accurate finding of files related to user questions. The other is a content knowledge base, which stores the text block information of a file, which is conducive to finding text blocks related to user questions, such as Figure 1 As shown, the specific steps include:

[0044] Step 1: Use the big model to extract a summary of each file. Pass the content of each file as a reference text to the big model, and let the big model generate summary content based on the reference text.

[0045] Step 2: Use the sparse vector model and dense vector model to perform vector embedding operations on the summary content to generate vector data V s and V d . It is stored in the abstract_db database of Mongodb in the form of {abstract text content, file name} and in the form of {V s ,V d , file name} into the abstract_db library of Milvus. The construction of the abstract knowledge base is completed.

[0046] Step 3: Cut each file into several text blocks in turn and divide the text content from a semantic perspective.

[0047] Step 4: Use the sparse vector model and dense vector model to perform vector embedding operations on each text block to generate vector data V s and V d . It is stored in the content_db library of Mongodb in the form of {text block content, file name} and in the form of {V s ,V d , file name} in the Milvus content_db library. The content knowledge base is built.

[0048] 2. Two-stage retrieval

[0049] The retrieval step is the most core step in the entire intelligent question-answering process of rules and regulations. If the relevant content cannot be accurately retrieved, the answer will be irrelevant to the question. In order to meet the needs of rules and regulations retrieval scenarios, the present invention proposes a two-stage retrieval method. The first stage is used to search for the most relevant files, and the second stage is for users to search for the most relevant text block content in the most relevant files. Regardless of the stage, the present invention uses a hybrid retrieval method of sparse vector retrieval + dense vector retrieval for retrieval. Sparse vector retrieval focuses on keyword matching, and dense vector retrieval focuses on deeper semantic matching. Retrieving the two can more accurately search for results related to user questions, such as Figure 2 As shown, the specific steps include:

[0050] Step 1: Use sparse vector model and dense vector model to embed the user's question content into vectors and obtain the question vector set V q = {V qs ,V qd}.

[0051] Step 2: Use a hybrid retrieval method of sparse vector retrieval + dense vector retrieval to perform vector searches in the summary knowledge base and content knowledge base respectively, and obtain the most k1 relevant results and the most k2 relevant results, where k1 = k2 = 15. Define the retrieval result of a text block in the summary knowledge base as U abstract_i = {Sa, Aa, Fa}, where i is the index of the result, Sa is the score, ranging from [0, 1], Aa is the summary content, and Fa is the corresponding file name. Define a text block retrieval result in the content knowledge base as U content_i ={St,Tt,Ft}, where i is the index of the result, St is the score, ranging between [0,1], Tt is the text block content, and Ft is the corresponding file name.

[0052] Step 3: Weight the search results to obtain the most relevant file set.

[0053] Since the goal of the first stage retrieval is to find the most relevant files, and the number of files in the file collection must be accurate and relevant, the search results of Step 2 need to be processed. The processing steps are described as follows:

[0054] Step 3.1: Take the file as the unit and get the U corresponding to each file. abstract and U content , and get a result set U corresponding to each file result = {U abstract_1 ,U abstract_2 ,…,U abstract_n1 ,U content_1 ,U content_2 ,…,U content_n2}.

[0055] Step 3.2: Based on the result set of each file, calculate a file score for each file. The calculation method is: W a *(U abstract_1 +U abstract_1 +…+U abstract_1 )+W t *(U content_1 +U content_2 +…+U content_n2 ) / N(U result ), where W a is the weight of the summary knowledge base result, W t is the result weight of the content knowledge base, here we set W a =0.4,W t is 0.6, N(U result ) is U result The number of elements.

[0056] Step 3.3: Calculate the file score for each file, sort the files from high to low, take the top 30% of the files, and take at least 1 file.

[0057] Step 4: This is the second stage of retrieval. In the most relevant document range, hybrid retrieval is used to search in the content knowledge base to obtain the most relevant text blocks. The purpose of this stage is to retrieve the k most relevant text blocks to the user's question from the document set filtered in the first stage, where k is 10, and exclude the results with a score lower than 0.3.

[0058] After two stages of retrieval, the retrieved text blocks are spliced ​​together and passed to the big model as reference text, allowing the big model to give answers to users' questions based on the reference text.

[0059] In other embodiments, the intelligent question-answering method for rules and regulations based on two-stage retrieval and large models provided by the present invention has three main steps:

[0060] The first step is to build a knowledge base based on existing rules and regulations documents;

[0061] In the second step, a two-stage retrieval is used to search for the most relevant text block as the reference text.

[0062] The third step is to let the big model give answers to users’ questions based on the reference text.

[0063] 1. Build a knowledge base

[0064] like Figure 1 As shown, the steps of the specific example are as follows:

[0065] Step 1: Use the big model to extract a summary of each file. Pass the content of each file as a reference text to the big model, and let the big model generate summary content based on the reference text. The prompt words are as follows, and {ref_text} is the full text content of the file:

[0066] #Text content

[0067] {ref_text}

[0068] #Task

[0069] Extract text summary based on <text content>.

[0070] Step 2: Use the sparse vector model and dense vector model to perform vector embedding operations on the summary content to generate vector data V s and V d . It is stored in the abstract_db database of Mongodb in the form of {abstract text content, file name} and in the form of {V s ,V d , file name} into the abstract_db library of Milvus. The construction of the abstract knowledge base is completed.

[0071] Step 3: Cut each file into several text blocks in turn and divide the text content from a semantic perspective.

[0072] Step 4: Use the sparse vector model and dense vector model to perform vector embedding operations on each text block to generate vector data V s and V d . It is stored in the content_db library of Mongodb in the form of {text block content, file name} and in the form of {V s ,V d , file name} in the Milvus content_db library. The content knowledge base is built.

[0073] 2. Two-stage retrieval, the specific steps are as follows Figure 2 As shown:

[0074] Step 1: Use sparse vector model and dense vector model to embed the user's question content into vectors and obtain the question vector set V q = {V qs ,V qd For example, the question is “What is the division of labor under leadership?”, Vq = {[0.8, 0.2, 0.6, …], [0.1, 0.8, 0.7, 1.0, …]}.

[0075] Step 2: Use a hybrid retrieval method of sparse vector retrieval + dense vector retrieval to perform vector searches in the summary knowledge base and content knowledge base respectively, and obtain the most k1 relevant results and the most k2 relevant results, where k1 = k2 = 15. Define the retrieval result of a text block in the summary knowledge base as U abstract_i = {Sa, Aa, Fa}, where i is the index of the result, Sa is the score, ranging from [0, 1], Aa is the summary content, and Fa is the corresponding file name. Define a text block retrieval result in the content knowledge base as U content_i ={St,Tt,Ft}, where i is the index of the result, St is the score ranging between [0,1], Tt is the text block content, and Ft is the corresponding file name.

[0076] Step 3: Weight the search results to obtain the most relevant file set.

[0077] Since the goal of the first stage retrieval is to find the most relevant files, and the number of files in the file collection must be accurate and relevant, the search results of Step 2 need to be processed. The processing steps are described as follows:

[0078] Step 3.1: Take the file as the unit and get the U corresponding to each file. abstract and U content , and get a result set U corresponding to each file result = {U abstract_1 ,U abstract_2 ,…,U abstract_n1 ,U content_1 ,U content_2 ,…,U content_n2}.

[0079] Step 3.2: Based on the result set of each file, calculate a file score for each file. The calculation method is: W a *(U abstract_1 +U abstract_1 +…+U abstract_1 )+W t *(Ucontent_1 +U content_2 +…+U content_n2 ) / N(U result ), where W a is the weight of the summary knowledge base result, W t is the result weight of the content knowledge base, here we set W a =0.4,W t is 0.6, N(U result ) is U result The number of elements.

[0080] Step 3.3: Calculate the file score for each file, sort the files from high to low, take the top 30% of the files, and take at least 1 file.

[0081] Step 4: This step leads to the second stage of retrieval. In the most relevant file range, hybrid retrieval is used to search in the content knowledge base to obtain the most relevant text blocks. The purpose of this stage is to retrieve the k most relevant text blocks to the user's question from the file collection that has been screened in the first stage, where k is 10, and eliminate the results with a score lower than 0.3. For example, if there are 10 relevant text blocks and 2 of them have a score lower than 0.3, only 8 text blocks will be output to the large model.

[0082] The big model generates answers by merging the text content of the text blocks retrieved in the two stages together as reference text, and lets the big model answer the user's question based on the reference question. The prompt words are as follows, where {ref_text} is the reference text and {question} is the user's question:

[0083] #Reference text

[0084] {ref_text}

[0085] #Task

[0086] Based on the reference text, answer the following questions:

[0087] {question}

[0088] The units involved in the embodiments of the present invention may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, limit the units themselves.

[0089] According to one aspect of an embodiment of the present invention, a computer program product or a computer program is provided, the computer program product or the computer program includes a computer instruction, and the computer instruction is stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in the above various optional implementations.

[0090] As another aspect, an embodiment of the present invention further provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.

Claims

1. A method for intelligent question answering of rules and regulations based on two-stage retrieval and large models, characterized in that: include: S1, constructing a knowledge base: extracting a summary of each file based on a large model question-answering format, and constructing a summary vector library; then cutting all files into blocks, and vectorizing all text blocks using a sparse vector model and a dense vector model to obtain corresponding sparse vectors and dense vectors, and constructing a content vector library; S2, two-stage retrieval: During retrieval, a two-stage retrieval strategy is adopted. In the first stage, the files most relevant to the user's question are retrieved. A hybrid retrieval method of sparse vector retrieval and dense vector retrieval is used to search the two vector libraries. The retrieval on both sides is weighted to obtain the top K most relevant files. The second stage retrieves the text blocks that are most relevant to the user's question. This stage also uses hybrid retrieval to obtain the top k most relevant text blocks; S3, when answering, use the top k most relevant text blocks as reference texts, and let the large model answer based on the reference texts.

2. The intelligent question-answering method for rules and regulations based on two-stage retrieval and large models according to claim 1 is characterized in that: In step S1, the method summarizes each file based on the large model question-answering format and constructs a summary vector library; then all files are cut and divided into blocks, and all text blocks are vectorized using sparse vector models and dense vector models to obtain corresponding sparse vectors and dense vectors, and a content vector library is constructed, which specifically includes the following sub-steps: S11: Use the big model to extract a summary of each file, pass the content of each file as a reference text to the big model, and let the big model generate summary content based on the reference text; S12: Use the sparse vector model and the dense vector model to perform vector embedding operations on the summary content to generate vector data V s and V d ; Stored in Mongodb's abstract_db library in the form of {abstract text content, file name}, and in {V s ,V d , file name} in the abstract_db library of Milvus, and the construction of the abstract knowledge base is completed; S13: Cut each file into a number of text blocks in turn, and divide the text content from a semantic perspective; S14: Use the sparse vector model and the dense vector model to perform vector embedding operations on each text block to generate vector data V s and V d ; Stored in Mongodb's content_db library in the form of {text block content, file name}, and in the form of {V s ,V d , file name} in the Milvus content_db library, and the content knowledge base is built.

3. The intelligent question-answering method for rules and regulations based on two-stage retrieval and large models according to claim 1 is characterized in that: In step S2, a two-stage search strategy is adopted during the search. In the first stage, the files most relevant to the user's question are searched. A hybrid search method of sparse vector search and dense vector search is used to search the two vector libraries. The search on both sides is weighted to obtain the top K most relevant files. The second stage retrieves the text blocks that are most relevant to the user's question. This stage also uses hybrid retrieval to obtain the top k most relevant text blocks, which specifically includes the following sub-steps: S21: Use sparse vector model and dense vector model to embed the user's question content into vectors to obtain the question vector set V q = {V qs ,V qd }; S22: A hybrid retrieval method of sparse vector retrieval and dense vector retrieval is used to perform vector searches in the summary knowledge base and the content knowledge base respectively to obtain the most k1 relevant results and the most k2 relevant results; a text block retrieval result in the summary knowledge base is defined as U abstract_i = {Sa, Aa, Fa}, where i is the index of the result, Sa is the score, Aa is the summary content, and Fa is the corresponding file name; define a text block retrieval result in the content knowledge base as U content_i ={St,Tt,Ft}, where i is the index of the result, St is the score, Tt is the text block content, and Ft is the corresponding file name; S23: weighting the search results to obtain the most relevant document set; S24: Second stage retrieval: In the most relevant file range, hybrid retrieval is used to search in the content knowledge base to obtain the most relevant text block; the k most relevant text blocks to the user's question are retrieved from the file collection filtered in the first stage, and the results with scores lower than the set value are eliminated; after two stages of retrieval, the retrieved text blocks are spliced ​​together and passed to the large model as reference text, so that the large model can give the answer to the user's question based on the reference text.

4. The intelligent question-answering method for rules and regulations based on two-stage retrieval and large models according to claim 3 is characterized in that: In step S23, the search results are weighted to obtain the most relevant document set, which specifically includes the following sub-steps: S231: Taking files as units, obtain the U corresponding to each file. abstract and U content , and get a result set U corresponding to each file result = {U abstract_1 ,U abstract_2 ,…,U abstract_n1 ,U content_1 ,U content_2 ,…,U content_n2 }; S232: Based on the result set of each file, a file score is calculated for each file, and the calculation method is: W a *(U abstract_1 +U abstract_1 +…+U abstract_1 )+W t *(U content_1 +U content_2 +…+U content_n2 ) / N(U result ), where W a is the weight of the summary knowledge base result, W t is the result weight of the content knowledge base, N(U result ) is U result The number of elements in ; S233: Calculate the file score for each file, sort them according to the file score and then extract them.

5. The intelligent question-answering method for rules and regulations based on two-stage retrieval and large models according to claim 3 is characterized in that: In step S22, k1=k2=15, the range of Sa is between [0, 1], and the range of St is between [0, 1].

6. The intelligent question-answering method for rules and regulations based on two-stage retrieval and large models according to claim 3 is characterized in that: In step S24, k is 10 and the set value is 0.

3.

7. The intelligent question-answering method for rules and regulations based on two-stage retrieval and large models according to claim 4 is characterized in that: In step S232, set W a =0.4,W t is 0.

6.

8. The intelligent question-answering method for rules and regulations based on two-stage retrieval and large models according to claim 4 is characterized in that: In step S233, the sorting according to the file scores is specifically sorting from high to low.

9. The intelligent question-answering method for rules and regulations based on two-stage retrieval and large models according to claim 8 is characterized in that: After sorting from high to low, the first 30% of the files are taken out after sorting according to the file scores, and at least one file is taken out.

10. An intelligent question-answering device for rules and regulations based on two-stage retrieval and large models, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is loaded by the processor, the method according to any one of claims 1 to 9 is executed.

Citation Information

Patent Citations

  • Large language model training method and device, computer equipment and storage medium

    CN117473065A

  • Question and answer method and system based on multi-modal self-adaptive retrieval type enhanced large model

    CN117648429A

  • Article processing method and device, computer equipment, storage medium and program product

    CN118227880A

  • Vector knowledge base-based large-model question-answer dialogue method and system and storage medium

    CN118484526A

  • Retrieval enhanced intelligent question answering method and system based on large model

    CN118503392A

Cited By

  • Conference summary system and method based on KD tree fragmentation

    CN120690204A

  • Two-stage electronic contract element extraction method based on large model

    CN120911437A

  • A Two-Stage Electronic Contract Element Extraction Method Based on a Large Model

    CN120911437B

  • A method, apparatus, device, and storage medium for streaming retrieval of financial strategy documents based on a two-layer knowledge base cluster.

    CN122570776A