Intelligent document question-answering system and method based on large language model
By constructing a customized knowledge base and document system, and combining it with a large language model, an intelligent document question-answering system was developed. This solved the problems of information loss and noise interference in the answering of complex questions by large-scale pre-trained models, and achieved efficient and accurate question-answering results.
Patent Information
- Application Number
- CN202511661280.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-13
- Publication Date
- 2026-02-17
AI Technical Summary
Existing large-scale pre-trained models lack up-to-date knowledge or industry-specific information when answering complex questions, leading to problems such as loss of semantic integrity, information fragmentation, contextual noise interference, and inefficient use of long documents.
An intelligent document question-answering system based on a large language model is adopted. A customized knowledge base is built through the RAG retrieval module, combined with a document selection module and a web search module. The large language model is used to answer questions, ensuring information integrity and contextual understanding.
It improves the practicality and reliability of document question-and-answer systems in professional fields, avoids information loss, enhances the accuracy and applicability of answers, and utilizes online searches to supplement information.
Smart Images

Figure CN121542376A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of artificial intelligence and natural language processing, and specifically relates to the field of large language model of document question answering system, and particularly relates to an intelligent document question answering system and method based on a large language model. BACKGROUND
[0002] In recent years, large-scale pre-training models have shown significant capabilities in various natural language processing tasks. However, when answering complex questions, the models are often limited by the lack of the latest knowledge or industry-specific information, with specific limitations as follows:
[0003] 1. Block strategy is simple and rough: Most systems use a fixed-length sliding window block (such as 512 tokens), which can cause complete semantic paragraphs to be truncated or noisy content (such as headers and footers) to be mixed into the search results; currently, some works propose semantic-based blocking, but it still causes information fragmentation, and the content needed to answer the question is split into multiple document blocks.
[0004] 2. Lack of semantic annotation: The original document is not structurally analyzed, and it is not possible to identify which paragraphs are suitable for answering which type of question, resulting in reliance on coarse-grained vector similarity rather than precise question and answer matching when searching; to solve such problems, some multi-index algorithms currently exist, which perform semantic annotation on document blocks.
[0005] 3. Context noise interference: When multiple retrieved document blocks contain redundant or contradictory information, the LLM may confuse the key evidence; currently, some works propose applying a reordering algorithm to the retrieved document blocks; however, semantic annotation and reordering algorithms are based on small models or already filtered partial information, and have very limited effect on improving the performance of the final answer quality.
[0006] 4. Inefficient use of long documents: Even if the LLM supports a long context window, simply concatenating all search results can still cause core information to be submerged, affecting the generation quality.
[0007] Therefore, we propose an intelligent document question answering system and method based on a large language model. SUMMARY
[0008] In view of the deficiencies in the prior art, the purpose of the present application is to provide an intelligent document question answering system and method based on a large language model, which aims to improve the practicality and reliability of the document question answering system in the professional field.
[0009] In order to achieve the above-mentioned purpose, the technical scheme adopted by the present application is as follows: an intelligent document question answering system and method based on a large language model, and the specific working process of each module is as follows:
[0010] The rag retrieval module: acquires customized information, constructs a rag knowledge base according to the customized information, sets a preset threshold for the rag knowledge base, acquires a user input question, matches the input question through the rag knowledge base to obtain a matching result, compares the matching result with the preset threshold, and respectively calls a module according to a comparison result.
[0011] The document selection module: when the matching result output by the rag retrieval module is lower than the preset threshold, a document system is called; based on a large language model, the input question is matched with a document index of the document system to generate a document matching list; according to the matching list, a corresponding document is called, full-text content is read to construct a context, and a filled document is formed.
[0012] The network search module: according to the document matching list, a website list corresponding to each document is acquired, a network search function is called, and content on a related webpage is extracted; the content is used to supplement the filled document, and based on the supplemented filled document, a large language model is called to answer the question.
[0013] Further, the rag retrieval module is configured to construct the rag knowledge base and perform matching by the following methods, specifically as follows:
[0014] The customized information is processed, and the customized information is decomposed into question text and corresponding answer text;
[0015] Based on the answer text, a plurality of extended questions capable of being answered by the answer text are generated;
[0016] The answer text is used to construct the rag knowledge base with the corresponding question text and the extended questions as multiple indexes;
[0017] The user input question is acquired, and the user input question is matched with the rag knowledge base to obtain a matching result;
[0018] The matching result is compared with the preset threshold, if the matching result is higher than the preset threshold, a context is constructed using the matching answer text corresponding to the question and answer pair, and a large language model is called to answer the question; if the matching result is lower than the preset threshold, the document selection module is entered.
[0019] Further, the rag knowledge base is constructed, specifically as follows:
[0020] The number of customized information is acquired, denoted as hs, the customized information is decomposed according to the number of customized information to obtain question text and answer text, the question text is denoted as wtb(h), and the answer text is denoted as hdw(h);
[0021] Using a large language model, based on the answer text, generate multiple extended questions that can be answered by the answer text. The original question text is called the main index, and the generated extended questions are called auxiliary indexes, denoted as wgj(g). The main index and multiple auxiliary indexes are associated with the corresponding answer text to obtain an association list glb, glb=[wtb(h)=[wgj(g)]:hdw(h)], and the association list is counted to obtain a rag knowledge base.
[0022] Further, the full text content is read to build context and form a filled document, as follows:
[0023] The document system is called according to the matching results output by the rag retrieval module. Based on the large language model, the input question is matched with the document index of the document system, the matching documents are sorted according to the matching results, and a document matching list is generated. From the document matching list, the corresponding document is called, the full text content is read to build context, and a filled document is formed.
[0024] Further, the document system is obtained, as follows:
[0025] The collected original file is obtained, and the text of the original file is extracted to obtain a text document of the original file. The text document is analyzed by a large language model, and the text document is classified and merged according to the semantic analysis results to obtain classified files and a text index of each processed file. The text index is set to a white list to obtain a white list website, and the text index, the processed file and the white list website are associated and stored to build a document system.
[0026] Further, the text document is classified and merged, as follows:
[0027] The collected original file is counted to obtain the number of original files, denoted as ys. According to the number of original files, the original file is denoted as ysw(y), which represents the yth original file. The original file is processed by a text extraction software to extract the text content in the original file, and a text document ywb(y) of the original file is obtained, which represents the text document corresponding to the original file ysw(y).
[0028] The text document is analyzed by a large language model, and the semantic analysis result is denoted as yfx(y), which represents the semantic analysis result corresponding to the text document ywb(y). The semantic analysis result is traversed, and different semantic analysis results are matched by a large language model to obtain a matching value ppz(y1, y2). ppz(y1, y2) represents the matching value of the y1th semantic analysis result and the y2th semantic analysis result. The text document is classified and calculated according to the matching value to obtain a classification threshold fly.
[0029]
[0030] According to the classification threshold fly, the matching value ppz(y1, y2) is analyzed and judged:
[0031] If ppz(y1, y2) < fly, it indicates that the y1th semantic analysis result and the y2th semantic analysis result have low matching degree, and the corresponding text document does not belong to the same category document;
[0032] If ppz(y1, y2) ≥ fly, it indicates that the y1th semantic analysis result and the y2th semantic analysis result have high matching degree, and the corresponding text document belongs to the same category document;
[0033] The same category documents are merged, and the non-same category documents are stored separately, to obtain a classification file;
[0034] The context length of the large language model is obtained, and the character length of the classification file is set according to the context length of the large language model. If the file content exceeds the preset file character length, it is split into multiple files to ensure that the content of each file is lower than the preset file character length;
[0035] For each processed file, a large language model is called to generate a content profile, and a text index is generated from the content profile.
[0036] Further, the text index, the processed file and the whitelist website are associated and stored, specifically as follows:
[0037] For each processed file, network retrieval is performed according to the text index, and the network retrieval result is analyzed by manual analysis. According to the manual analysis result, no or one or more whitelist websites are selected;
[0038] The text index, the processed file and the whitelist website are associated and stored, and a document system is constructed, which includes a plurality of triplets, and the triplets include: file index, website list, and file content full text.
[0039] Further, a filled document is formed, specifically as follows:
[0040] The matching result exceeding the preset matching accuracy threshold output by the rag retrieval module is obtained. If the matching result is a non-empty set, it indicates that the actual input problem exists in the rag knowledge base, and the preset output is obtained through the large prediction model to solve the problem, to obtain the output result. If the retrieval result is empty, it indicates that the actual input problem does not exist in the rag knowledge base, and the document system needs to be called;
[0041] Based on the large language model, the input question and the document index in the document system are taken as the prompt words of the model, and the large language model is used to select a matching document list that can be used to answer the input question;
[0042] The large language model is contextually filled by the matching document list, the full-text content of the matching document is spliced, and a reference document is formed;
[0043] Further, the network search function is called, specifically as follows:
[0044] According to the matching document list, the white list website corresponding to the document is obtained to obtain a website list, and network retrieval is performed according to the website list to extract the content of the relevant web pages searched on the network to supplement the reference document;
[0045] If the number of characters of the supplemented reference document exceeds the number of context filling characters of the large language model, the reference document is truncated according to the number of context filling characters of the large language model;
[0046] Based on the supplemented reference document, the large language model is called to answer the question.
[0047] The intelligent document question and answer method based on the large language model, the question and answer method comprises:
[0048] Step S1: obtaining customized information, constructing a rag knowledge base according to the customized information, setting a preset threshold for the rag knowledge base, obtaining a user input question, matching the input question through the rag knowledge base to obtain a matching result, comparing the matching result with the preset threshold, and calling a module according to the comparison result;
[0049] Step S2: calling a document system according to the matching result output by the rag retrieval module; based on the large language model, matching the input question with the document index of the document system to generate a document matching list; according to the matching list, calling the corresponding document, reading the full-text content to construct the context, and forming a reference document;
[0050] Step S3: according to the document matching list, obtaining the website list corresponding to each document, calling the network search function, extracting the network related content; using the content to supplement the reference document, and based on the supplemented reference document, calling the large language model to answer the question.
[0051] As described above, due to the adoption of the above technical solutions, the beneficial effects of the present application are:
[0052] 1. The present application uses RAG technology to intercept content that needs to be accurately answered, and limits the content to a piece of corpus that can be completely answered, without text chunking, thereby avoiding information loss or incompleteness caused by text chunking.
[0053] 2、The application makes full use of the super-long context understanding ability of the large model, records the original file as a whole through the construction of the document system, classifies and merges the documents through semantic analysis, improves the storage efficiency and retrieval accuracy of the document system, matches the problem with the document based on the large model, fills the context of the large model, improves the data reference of the large model, and enhances the reliability of the answer.
[0054] 3、The application uses network search to search the content of the website to ensure that the network search content is referred to for answering in the case that the corpus cannot answer the question, avoiding the fantasy problem of the large model.
[0055] 4、The application only defines the workflow, does not limit the system prompt words used by each module, improves the applicability of the application, and makes it widely applicable in various fields. BRIEF DESCRIPTION OF DRAWINGS
[0056] In order to facilitate the understanding of those skilled in the art, the application will be further described below in conjunction with the drawings.
[0057] Figure 1 is the overall system block diagram of the application;
[0058] Figure 2 is the processing flow diagram of the application;
[0059] Figure 3 is the step diagram of the application; DETAILED DESCRIPTION
[0060] The technical solutions of the application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the application, not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor belong to the scope of protection of the application.
[0061] Embodiment one
[0062] Please refer to Figure 1 The application provides a technical solution: an intelligent document question and answer system based on a large language model, including a rag retrieval module, an original file processing module, a document selection module, a network search module and a server, the rag retrieval module, the original file processing module, the document selection module, the network search module are connected with the server respectively, and the server controls the rag retrieval module, the original file processing module, the document selection module, the network search module respectively;
[0063] The rag retrieval module: acquires customized information, constructs a rag knowledge base according to the customized information, sets a preset threshold for the rag knowledge base, acquires a question input by a user, matches the input question through the rag knowledge base to obtain a matching result, compares the matching result with the preset threshold, and respectively calls a module according to a comparison result.
[0064] It should be noted that the customized information refers to specific questions and their answers provided by the user (such as contact number, working hours, department settings).
[0065] It should be noted that retrieval augmented generation (RAG) is a technical framework combining information retrieval and generative artificial intelligence, aiming to enhance the accuracy, timeliness and reliability of large language models (LLM) through external knowledge sources. The core idea is "retrieval first, then generation", that is, first retrieve relevant content from massive data, and then generate the final answer based on the retrieval result.
[0066] The specific workflow of the rag retrieval module is as follows:
[0067] The customized information is processed, and the customized information is decomposed into question text and corresponding answer text;
[0068] Based on the answer text, a plurality of extended questions capable of being answered by the answer text are generated;
[0069] Using the answer text, the corresponding question text and the extended question are used as multi-indexes to construct the rag knowledge base;
[0070] The specific workflow of constructing the knowledge base is as follows:
[0071] The number of customized information is acquired, denoted as hs, the customized information is decomposed according to the number of customized information, to obtain question text and answer text, the question text is denoted as wtb(h), and the answer text is denoted as hdw(h);
[0072] Using a large language model, based on the answer text, a plurality of extended questions capable of being answered by the answer text are generated, the original question text is referred to as a primary index, the generated extended question is referred to as a secondary index, denoted as wgj(g), the primary index and the plurality of secondary indexes are associated with the corresponding answer text to obtain an association list glb, glb=[wtb(h)=[wgj(g)]:hdw(h)], and the association list is counted to obtain a rag knowledge base;
[0073] It should be noted that: wtb(h) = [wgj(g)] indicates that the main index corresponds to multiple auxiliary indexes, and wtb(h): hdw(h) indicates that each main index corresponds to one answer text.
[0074] Obtain the user input question, match the user input question with the rag knowledge base, and obtain the matching result;
[0075] Compare the matching result with the preset threshold value, if the matching result is higher than the preset threshold value, use the matched answer text to construct the context, and call the large language model to answer the question; if the matching result is lower than the preset threshold value, turn into the document selection module.
[0076] The specific working process of presetting the threshold value is as follows:
[0077] Based on the large language model, the synonym conversion of the question text wtb(h) is carried out, the converted question text is taken as the input question, the matching threshold value of the rag knowledge base is preset, the matching threshold value is recorded as p, the rag knowledge base is searched according to the input question and the matching threshold value, the pre-search result is recorded, the pre-search result is recorded as yjs(h, p), yjs(h, p) represents the converted input question of the hth question text, and the search result through the matching threshold value p;
[0078] Statistical calculation is carried out on the pre-search result under the same matching threshold value, and the judgment value pdz(p) of the pre-search result is obtained;
[0079]
[0080] It should be noted that by searching the rag knowledge base under the condition that the hs input questions have the same matching threshold value, the search result obtained by the matching threshold value is intuitively displayed, which facilitates effective analysis of the precision of the matching threshold value;
[0081] The judgment value pdz(p) of the pre-search result is analyzed:
[0082] If pdz(p) = 0, it indicates that the pre-search result of the input question is empty, and the matching threshold value p cannot effectively search the input question;
[0083] If pdz(p) > 0, it indicates that the pre-search result of the input question is not empty, and the matching threshold value p can effectively search the input question, and p is reserved;
[0084] Obtain the value range of the matching threshold value, traverse the matching threshold value according to the value range of the matching threshold value, count the matching threshold values that can effectively search the input question, extract the maximum value in the matching threshold value, obtain the preset threshold value, and call the rag knowledge base according to the preset threshold value.
[0085] It should be noted that the size of the matching threshold can effectively reflect the matching accuracy of the rag knowledge base. By maximizing the matching threshold of the effective search, the matching accuracy of the knowledge base is improved, and the search accuracy is enhanced.
[0086] The original file processing module: collect the original file, process the collected original file, obtain the text document, and construct the document system according to the text document;
[0087] The specific working process of the original file processing module is as follows:
[0088] The collected original file is obtained, the original file is normalized in format, the normalized original file is text extracted, and the text document of the original file is obtained; the text document is analyzed by a large language model, the text document is classified and merged according to the semantic analysis result, and the classified file and the text index of each processed file are obtained; according to the text index, network search is carried out, through artificial screening, white list setting is carried out on the website, white list website is obtained, text index, processed file and white list website are associated and stored, and document system is constructed.
[0089] The specific process is as follows:
[0090] The collected original file is counted to obtain the number of original files, which is denoted as ys; according to the number of original files, the original file is denoted as ysw(y), ysw(y) represents the yth original file; the original file is processed by a text extraction software to extract the text content in the original file, and the text content is counted to obtain the text document ywb(y) of the original file, ywb(y) represents the text document corresponding to the original file ysw(y);
[0091] The text document is analyzed based on a large language model, and the semantic analysis result is denoted as yfx(y), yfx(y) represents the semantic analysis result corresponding to the text document ywb(y); the semantic analysis result is traversed, and different semantic analysis results are matched by a large language model to obtain a matching value ppz(y1, y2); ppz(y1, y2) represents the matching value of the y1th semantic analysis result and the y2th semantic analysis result; the text document is classified and calculated according to the matching value to obtain a classification threshold fly;
[0092]
[0093] It should be noted that the matching value is divided by the mean value, the division result is intuitive, the classification threshold division is simple, and the division data is intuitive, which is convenient for adjusting the division result.
[0094] According to the classification threshold fly, the matching value ppz(y1, y2) is analyzed and judged:
[0095] If ppz(y1, y2) < fly, it indicates that the y1th semantic analysis result and the y2th semantic analysis result have low matching degree, and the corresponding text document does not belong to the same category document;
[0096] If ppz(y1, y2) ≥ fly, it indicates that the y1th semantic analysis result and the y2th semantic analysis result have high matching degree, and the corresponding text document belongs to the same category document;
[0097] The same category documents are statistically combined, and the non-same category documents are classified and stored to obtain a classified file.
[0098] The context length of the large language model is obtained, and the character length of the classified file is set according to the context length of the large language model. If the file content exceeds the preset file character length, it is split into multiple files to ensure that the content of each file is lower than the preset file character length;
[0099] For each processed file, the large language model is called to generate a content profile, and a text index is generated from the content profile.
[0100] It should be noted that: Context is a core concept in natural language processing (NLP) and large language model (LLM) applications, which refers to all background information, historical interactions or environmental data related to the current task, which helps the model understand user intent, maintain conversation coherence, and generate more accurate and relevant answers.
[0101] The specific process is as follows:
[0102] The context length of the large language model is counted, and the context length of the large language model is denoted as mcd; according to the context length of the large language model, the character length of the classified file is set to obtain a preset character length, denoted as ysc;
[0103] It should be noted that: The number of characters in each file cannot exceed the context length limit of the large model. Considering that the context of the large model includes not only the file content but also the network search content and the history of the previous rounds of dialogue, the upper limit of the number of characters in each file is set to 50-60% of the context length of the large model as the preset character length.
[0104] The classified file is obtained, the number of characters in the classified file is counted, and the number of characters in the classified file is compared with the preset character length. According to the comparison result, the classified file is intercepted to obtain a processed file;
[0105] According to the processing file, the large language model is transmitted with the file, the processing file is based on the large language model to set the content profile through the prompt word setting, the content profile is counted to obtain the text index of the processing file, for each processed file, network retrieval is performed according to the text index, the network retrieval result is analyzed by manual, and one or more white list websites are selected according to the manual analysis result;
[0106] The text index, the processing file and the white list website are associated and stored, a document system is constructed, the document system includes a plurality of triples, and the triples include a file index, a website list and a file content full text;
[0107] The text index and the processing file are associated and stored, and a document system is constructed;
[0108] The document selection module: when the matching result output by the rag retrieval module is lower than the preset threshold, the document system is called; based on the large language model, the input question is matched with the document index of the document system to generate a document matching list; according to the matching list, the corresponding document is called, the full text content is read to construct the context, and the filling document is formed;
[0109] The specific working process of the document selection module is as follows:
[0110] Please refer to Figure 2 ; the document system is called according to the matching result output by the rag retrieval module; based on the large language model, the input question is matched with the document index of the document system, the matching documents are sorted according to the matching result, a document matching list is generated; according to the document matching list, the corresponding document is called, the full text content is read to construct the context, and the filling document is formed;
[0111] The specific steps are as follows:
[0112] The matching result exceeding the preset matching accuracy threshold output by the rag retrieval module is obtained, if the matching result is a non-empty set, it indicates that the actual input question exists in the rag knowledge base, the preset output is obtained through the large prediction model to answer the question, and the output result is obtained; if the retrieval result is empty, it indicates that the actual input question does not exist in the rag knowledge base, and the document system needs to be called;
[0113] Based on the large language model, the input question and the document index in the document system are used as the prompt word of the model, and the large language model is used to select the matching document list which can be used to answer the input question;
[0114] The matching document list is used to fill the context of the large language model, the full text content of the matching document is spliced to form a reference document;
[0115] The specific steps are as follows:
[0116] If the search result is empty, it indicates that the actual input question does not exist in the rag knowledge base, and the document system needs to be called. Based on the large language model, the actual input question is matched with the document system, and the matching value of the actual input question and the document system is obtained. The matching value is denoted as the document matching value wpp(1) value wpp(ws), wherein ws represents the number of documents in the document system, and wpp(ws) represents the document matching value of the actual input question and the ws-th document. The document matching values wpp(1) to wpp(ws) are sorted in descending order to obtain a document matching list plb. The actual input question is answered according to the document matching list;
[0117] According to the document matching list, the processing file in the document system is extracted, the context of the large language model is filled by the processing file, and the large language model is called according to the context filling result. The actual input question is answered by the large language model combined with the context filling result.
[0118] The context of the large language model is filled by the document matching list, the number of context filling characters czf of the large language model is obtained, and the number of characters pzf(w) of the matching document in the document matching list is obtained. The context filling document is judged by calculating the number of characters to obtain a filling judgment value tpd(w’).
[0119]
[0120] Wherein w’ represents the w’-th document, and the value range of w’ is [1, ws].
[0121] The w’ is traversed, and when tpd(w’)≥0 and tpd(w’+1)<0, the number of context filling documents is determined as the first to w’-th documents in the document sorting list.
[0122] According to the context filling document, the large language model is called, and the actual input question is answered by the large language model combined with the context filling result.
[0123] Network search module: according to the document matching list, the website list corresponding to each document is obtained, the network search function is called, and the content on the related web page is extracted; the content is used to supplement the filling document, and based on the supplemented filling document, the large language model is called to answer the question;
[0124] The specific working process of the network search module is as follows:
[0125] According to the matching document list, the white list website corresponding to the document is obtained to obtain a website list, network search is performed according to the website list, and the content of the relevant web page searched on the network is extracted to supplement the reference document;
[0126] If the number of characters of the supplemented reference document exceeds the context filling character number of the large language model, the reference document is truncated according to the context filling character number of the large language model;
[0127] Based on the supplemented reference document, the large language model is called to answer the question.
[0128] Embodiment two
[0129] Please refer to Figure 3 The intelligent document question answering method based on the large language model comprises the following steps:
[0130] Step S1: Obtain customized information, construct a rag knowledge base according to the customized information, set a preset threshold for the rag knowledge base, obtain a user input question, match the input question through the rag knowledge base to obtain a matching result, compare the matching result with the preset threshold, and call a module according to a comparison result;
[0131] Step S2: According to the matching result output by the rag retrieval module, a document system is called; based on a large language model, the input question is matched with a document index of the document system to generate a document matching list; according to the matching list, a corresponding document is called to read the full text content to construct a context to form a reference document;
[0132] Step S3: According to the document matching list, the website list corresponding to each document is obtained, a network search function is called, and network related content is extracted; the content is used to supplement the reference document, and based on the supplemented reference document, a large language model is called to answer the question.
[0133] The preferred embodiments disclosed above are only used to help explain the present application. The preferred embodiments do not describe all the details, nor limit the application to the specific embodiments. Obviously, many modifications and variations can be made according to the content of the present application. The embodiments are selected and described in detail to better explain the principles and practical applications of the present application, so that those skilled in the art can well understand and utilize the present application. The present application is limited by the claims and their entire scope and equivalents.
Claims
1. An intelligent document question-answering system based on a large language model, characterized in that, include: rag retrieval module: retrieves customized information and builds a rag knowledge base based on the customized information; Set a preset threshold for the rag knowledge base; The system retrieves user input questions, matches them against a rag knowledge base, and obtains matching results. These matching results are then compared to preset thresholds, and module calls are made based on the comparison results. Document selection module: When the matching results output by the rag search module are lower than a preset threshold, the document system is invoked; Based on a large language model, the input question is matched with the document index of the document system to generate a document matching list; according to the matching list, the corresponding document is called, the full text content is read to construct the context, and a populated document is formed. Web search module: Based on the document matching list, obtain the list of websites corresponding to each document, call the web search function to extract content from the relevant web pages; use this content to supplement the document, and based on the supplemented document, call the large language model to answer the question.
2. The intelligent document question-answering system based on a large language model according to claim 1, characterized in that, The rag retrieval module is configured to construct the rag knowledge base and perform matching in the following manner: The customized information is processed by breaking it down into question text and corresponding answer text. Based on the answer text, generate multiple extended questions that can be answered by the answer text; Using the answer text, and with the corresponding question text and extended questions as multiple indexes, the rag knowledge base is constructed. Obtain the user's input question, match the user's input question with the rag knowledge base, and obtain the matching result; The matching result is compared with a preset threshold. If the matching result is higher than the preset threshold, the context is constructed using the answer text corresponding to the matched question and answer, and the large language model is called to answer the question. If the matching result is lower than the preset threshold, the process proceeds to the document selection module.
3. The intelligent document question-answering system based on a large language model according to claim 2, characterized in that, The rag knowledge base is constructed as follows: The quantity of customized information is obtained and denoted as hs. Based on the quantity of customized information, the customized information is decomposed to obtain the question text and the answer text. The question text is denoted as wtb(h) and the answer text is denoted as hdw(h). Using a large language model, based on the answer text, multiple extended questions that can be answered by the answer text are generated. The original question text is called the main index, and the generated extended questions are called the secondary indexes, denoted as wgj(g). The main index and multiple secondary indexes are associated with the corresponding answer text to obtain the association list glb, glb = [wtb(h) = [wgj(g)]: hdw(h)]. The association list is statistically analyzed to obtain the rag knowledge base.
4. The intelligent document question-answering system based on a large language model according to claim 1, characterized in that, The entire text is read to build context and form a populated document, as follows: The document system is retrieved, and the matching results output by the rag retrieval module are invoked. Based on the large language model, the input question is matched with the document index of the document system, and the matching documents are sorted according to the matching results to generate a document matching list. From the document matching list, the corresponding documents are invoked, and the full text content is read to construct the context and form a populated document.
5. The intelligent document question-answering system based on a large language model according to claim 4, characterized in that, The document system can be accessed as follows: The process involves acquiring the raw files, extracting text from them to obtain text documents, performing semantic analysis on the text documents using a large language model, classifying and merging the text documents based on the semantic analysis results to obtain classified files and a text index for each processed file, setting a whitelist based on the text index to obtain whitelisted websites, and associating and storing the text index, processed files, and whitelisted websites to build a document system.
6. The intelligent document question-answering system based on a large language model according to claim 5, characterized in that, The text documents are categorized and merged as follows: The number of original files collected is counted and denoted as ys. Based on the number of original files, the original files are denoted as ysw(y), where ysw(y) represents the y-th original file. The original files are processed using text extraction software to extract the text content and obtain the text document ywb(y), where ywb(y) represents the text document corresponding to the original file ysw(y). Semantic analysis of text documents is performed based on a large language model. The semantic analysis result is denoted as yfx(y), where yfx(y) represents the semantic analysis result corresponding to the text document ywb(y). The semantic analysis results are iterated through, and different semantic analysis results are matched using the large language model to obtain the matching value ppz(y1, y2). ppz(y1, y2) represents the matching value between the y1-th and y2-th semantic analysis results. The text document is then classified based on the matching value to obtain the classification threshold fly. The matching value ppz(y1, y2) is analyzed and judged based on the classification threshold fly: If ppz(y1, y2) < fly, it indicates that the semantic analysis result of the y1th semantic analysis result has a low matching degree with the semantic analysis result of the y2th semantic analysis result, and the corresponding text document does not belong to the same type of document; If ppz(y1, y2) ≥ fly, it indicates that the semantic analysis result of the y1th semantic analysis result has a high degree of matching with the semantic analysis result of the y2th semantic analysis result, and the corresponding text documents belong to the same type of document; Merge similar documents and store dissimilar documents separately to obtain categorized files; Obtain the context length of the large language model, and set the character length of the classified files based on the context length of the large language model. If the file content exceeds the preset file character length, split it into multiple files to ensure that the content of each file is lower than the preset file character length. For each processed file, the large language model is called to perform content summarization, and a text index is generated from the content summarization.
7. The intelligent document question-answering system based on a large language model according to claim 5, characterized in that, The text index, processed files, and whitelisted websites are associated and stored as follows: For each processed file, a web search is performed based on the text index. The web search results are analyzed manually, and based on the results of the manual analysis, one or more whitelisted websites are selected. A document system is constructed by associating and storing text indexes, processed files, and whitelisted websites. The document system includes multiple triples, each containing: a file index, a list of websites, and the full text of the file content.
8. The intelligent document question-answering system based on a large language model according to claim 4, characterized in that, The filled document is generated as follows: Obtain matching results that exceed the preset matching precision threshold from the rag retrieval module. If the matching result is a non-empty set, it indicates that the actual input question has a preset output in the rag knowledge base. The preset output is then used to answer the question through the Big Prophet model to obtain the output result. If the search results are empty, it means that the actual input question does not have a relevant input in the rag knowledge base, and the document system needs to be called. Based on the large language model, the input question and the document index in the document system are used as prompt words for the model. The large language model is used to select a list of matching documents that can be used to answer the input question. The large language model is filled with context using the list of matched documents, and the full text of the matched documents is concatenated to form a reference document.
9. The intelligent document question-answering system based on a large language model according to claim 1, characterized in that, To use the web search function, follow these steps: Based on the list of matching documents, the whitelist URLs corresponding to the documents are obtained to get a list of websites. Based on the list of websites, a network search is performed to extract the content of relevant web pages found in the network search to supplement the reference documents. If the number of characters in the supplemented reference document exceeds the number of context padding characters in the large language model, then the reference document will be truncated according to the number of context padding characters in the large language model. Based on the supplemented reference documents, the large language model is invoked to answer the questions.
10. A method for intelligent document question answering based on a large language model, applicable to the intelligent document question answering system based on a large language model as described in any one of claims 1-9, characterized in that, Question and answer methods include: Step S1: Obtain customized information and construct a rag knowledge base based on the customized information; set a preset threshold for the rag knowledge base; obtain the user input question and match the input question using the rag knowledge base to obtain the matching result; compare the matching result with the preset threshold and call the module based on the comparison result; Step S2: Based on the matching results output by the rag retrieval module, call the document system; based on the large language model, match the input question with the document index of the document system to generate a document matching list; based on the matching list, call the corresponding document, read the full text content to construct the context, and form a reference document; Step S3: Based on the document matching list, obtain the list of websites corresponding to each document, call the network search function to extract relevant network content; use this content to supplement the reference documents, and based on the supplemented reference documents, call the large language model to answer the questions.