Document question-answering system and method based on large model

By adopting large-model-based document segmentation and answer generation methods in the document Q&A system, the problems of security and delay problems and insufficient context coherence in the existing system are solved, and high accuracy, security and user experience are improved.

CN119577087APending Publication Date: 2025-03-07RSVP TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411619705.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

The existing document question and answer system has security and delay problems when extracting valuable information from massive text documents, and the traditional document segmentation method leads to a lack of coherence in the context, affecting the accuracy of search results.

Method used

A document question and answer system based on a large model is adopted, and documents are divided according to the paragraph structure through the document segmentation module, and answer generation module is combined with the answer generation module to generate answers, and knowledge graphs are built by embedding processing modules and graph databases to improve the accuracy and security of information retrieval.

Benefits of technology

It improves the accuracy of search results, enhances data security, improves the system's response speed and user experience, and enhances the ability to trace and verify information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119577087A_ABST
    Figure CN119577087A_ABST
Patent Text Reader

Abstract

The invention provides a document question-answering system and method based on a large model, and relates to the technical field of artificial intelligence, and the system comprises a document segmentation module which is used for segmenting a document uploaded by a user according to a paragraph structure to obtain a plurality of paragraph nodes; and the answer generation module is connected with the document segmentation module and is used for performing similarity matching on a query question proposed by a user and each paragraph node and sending the paragraph node with the highest similarity into a local large language model for processing so as to display answer information associated with the query question to the user. The method has the beneficial effects that the document is segmented according to the paragraph structure, so that the related content is effectively prevented from being split into different paragraph nodes, the context continuity is ensured, and the accuracy of a search result is improved; and the answer information is generated by adopting a local large language model, so that data leakage and privacy risks are avoided, and the data security is enhanced while the user privacy is effectively protected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a document question-answering system and method based on a large model. Background Art

[0002] In the current information age, the explosive growth of knowledge and information has made users face the huge challenge of extracting valuable information from massive text documents. Although professional documents such as medical knowledge and equipment maintenance contain rich knowledge, users often need to invest a lot of time and energy to read and parse them, which is unrealistic in many cases. Therefore, how to quickly and accurately obtain answers from complex documents through natural language has become an important issue.

[0003] The current mainstream approach includes the following steps:

[0004] 1) Document slicing: The document is sliced ​​into equal-length segments. Specifically, the document is divided into several segments of the same length to ensure that each segment contains relatively independent information units.

[0005] 2) Similarity comparison: Compare the similarity between the slice and the user's question. Use a pre-trained natural language processing model (mainly ChatGPT) to calculate the similarity score between each slice and the user's question.

[0006] 3) Answer extraction: Based on the similarity scores, possible answers are extracted from the highest-scoring slices and presented to the user.

[0007] The above methods can improve the efficiency of extracting valuable information from massive text documents to a certain extent, but there are also several significant problems in practical applications, which are manifested in the following aspects:

[0008] 1. ChatGPT, as an advanced AI conversation model, has several security and latency issues despite its outstanding performance in natural language processing. First, in terms of security, ChatGPT is a product of a foreign organization and may have data leakage and privacy risks, especially when processing sensitive information or personal data. Second, the latency issue is mainly reflected in the response speed of the model when processing large-scale requests. Complex calculations and large-scale data processing may cause system delays, affecting the real-time interactive experience.

[0009] 2. In the traditional document segmentation process, due to the different lengths of chapters or knowledge points in the document, the longer part is often split into multiple nodes. This splitting method leads to a lack of coherence between contexts, so that some related content may be ignored when performing similarity search, thus affecting the accuracy of search results. Summary of the invention

[0010] In view of the problems existing in the prior art, the present invention provides a document question answering system based on a large model, comprising:

[0011] The document segmentation module is used to segment the document uploaded by the user into multiple paragraph nodes according to the paragraph structure;

[0012] The answer generation module is connected to the document segmentation module and is used to match the query questions raised by the user with the similarities of each paragraph node, and send the paragraph node with the highest similarity to the local large language model for processing, so as to display the answer information associated with the query question to the user.

[0013] Preferably, the document segmentation module includes:

[0014] A paragraph recognition unit, used to recognize subheadings in the document;

[0015] The paragraph extraction unit is connected to the paragraph identification unit and is used to extract the first content between the subtitles by taking the subtitles as a dividing line, and taking the first content and the corresponding subtitle as a paragraph node.

[0016] The first content and the corresponding subtitle are taken as a paragraph node.

[0017] Preferably, the paragraph extraction unit also includes an appending sub-unit, which is used to obtain the parent titles of various levels associated with the subtitle according to the directory of the document, and append the subtitle and its associated parent titles of various levels, as well as the second content between the subtitle and the parent title to the corresponding first content to form the paragraph node.

[0018] Preferably, after acquiring the second content, the appending subunit further comprises generating corresponding summary information based on the second content, and then appending the summary information as the second content to the beginning of the first content.

[0019] Preferably, the paragraph extraction unit further comprises an extraction subunit, which is used for, when a table is included in the first content, assembling the content in the table into a declarative sentence, and replacing the corresponding table with the declarative sentence.

[0020] Preferably, it also includes an embedding processing module, which is connected to the document segmentation module and the vector database, respectively, and is used to embed each of the paragraph nodes to generate a corresponding paragraph vector and save it to the vector database, and embed the query question to generate a question vector;

[0021] The answer generation module is also connected to the embedding processing module and the vector database, and is used to perform similarity matching between the question vector and each of the paragraph vectors to achieve similarity matching between the query question and each of the paragraph nodes.

[0022] Preferably, the answer generation module includes:

[0023] A similarity matching unit, used for performing similarity matching between the query question and each of the paragraph nodes, and obtaining a plurality of the paragraph nodes having a preset number in descending order of similarity;

[0024] A reordering unit is connected to the similarity matching unit and is used to use a reordering model to reorder the similarities of the obtained paragraph nodes, and send the paragraph nodes with the highest similarity after reordering to the local large language model.

[0025] Preferably, it also includes an image bed connected to the document segmentation module, and the document segmentation module also includes:

[0026] A page segmentation unit, used for segmenting the document into multiple pages, and storing each page and its corresponding page number information on the image bed;

[0027] A page number associating unit, used for associating each of the paragraph nodes with the page number information on which it is located;

[0028] The answer generation module is connected to the image hosting service, and is also used to display the page number information associated with the paragraph node with the highest similarity and the page where the paragraph node is located to the user while displaying the answer information.

[0029] Preferably, it also includes a graph database, which is connected to the document segmentation module and the answer generation module respectively, and the document segmentation module also includes:

[0030] A relationship graph generating unit, configured to convert the contents of the table into triples according to the row and column position relationship when the paragraph node contains a table, and store the triples in the graph database to build a knowledge graph;

[0031] The answer generation module is also used to display the associated knowledge graph to the user while displaying the answer information when it is identified that the paragraph node with the highest similarity contains a table.

[0032] The present invention also provides a document question-answering method based on a large model, which is applied to the above-mentioned document question-answering system. The document question-answering method includes:

[0033] Step S1, the document question-answering system divides the document uploaded by the user into multiple paragraph nodes according to the paragraph structure;

[0034] In step S2, the document question-answering system matches the query question raised by the user with the similarity of each paragraph node, and sends the paragraph node with the highest similarity to the local large language model for processing, so as to display the answer information associated with the query question to the user.

[0035] The above technical solution has the following advantages or beneficial effects:

[0036] 1) Split documents according to paragraph structure, effectively avoiding splitting related content into different paragraph nodes, ensuring the coherence of context, and thus improving the accuracy of search results;

[0037] 2) Use a local large language model to generate answer information to avoid data leakage and privacy risks, effectively protect user privacy and enhance data security;

[0038] 3) When performing similarity matching, the re-ranking model is introduced to effectively enhance the semantic distinction and improve the accuracy of classification and similarity search;

[0039] 4) By converting the content of tables in paragraph nodes, the large model's ability to understand table data is enhanced, and the accuracy and efficiency of the document question-answering system in processing complex tables is improved;

[0040] 5) While displaying the answer information to the user, the page number information and page associated with the answer information are also displayed to the user. When a table is included, the relevant knowledge graph is also displayed at the same time, which solves the problem of associating large model answers with original documents, helps to enhance the ability of information traceability and verification, and improves users' trust in the system output results.

[0041] 6) Build a safer, more reliable and efficient artificial intelligence system as a whole to meet the diverse needs of users in different fields. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 The structure diagram of a document question-answering system based on a large model in a preferred embodiment of the present invention is as follows;

[0043] Figure 2 This is a schematic diagram of the statistical results of the scores of four models in a preferred embodiment of the present invention;

[0044] Figure 3 A schematic diagram of a directory in a preferred embodiment of the present invention;

[0045] Figure 4 A schematic diagram of a document fragment 1 in a preferred embodiment of the present invention;

[0046] Figure 5This is a schematic diagram of paragraph node 1 obtained by segmenting document fragment 1 in a preferred embodiment of the present invention;

[0047] Figure 6 This is a schematic diagram of paragraph node 2 obtained by segmenting document segment 1 in a preferred embodiment of the present invention;

[0048] Figure 7 This is a schematic diagram of paragraph node 3 obtained by segmenting document segment 1 in a preferred embodiment of the present invention;

[0049] Figure 8 A schematic diagram of document fragment 2 in a preferred embodiment of the present invention;

[0050] Fig. 9 This is a schematic diagram of summary information of the parent paragraph in the second document fragment in a preferred embodiment of the present invention;

[0051] Fig.10 A schematic diagram of a knowledge graph in a preferred embodiment of the present invention;

[0052] Fig.11 The figure is a flowchart of a document question-answering method based on a large model in a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0053] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The present invention is not limited to this embodiment, and other embodiments may also fall within the scope of the present invention as long as they conform to the gist of the present invention.

[0054] In a preferred embodiment of the present invention, based on the above problems existing in the prior art, a document question answering system based on a large model is provided. Figure 1 As shown, including:

[0055] Document segmentation module 1, used to segment the document uploaded by the user according to the paragraph structure to obtain multiple paragraph nodes;

[0056] The answer generation module 2 is connected to the document segmentation module 1, and is used to match the query questions raised by the user with the similarity of each paragraph node, and send the paragraph node with the highest similarity to the local large language model for processing, so as to display the answer information related to the query question to the user.

[0057] Specifically, the document question-and-answer system of the present invention can be installed on a terminal and used by users in the form of an APP or a web page. It is understandable that the document question-and-answer system also provides an interactive interface. When in use, the user first uploads the document to be searched through the interactive interface, and the system first performs document segmentation according to the paragraph structure, so that related content can be split into the same paragraph node, ensuring the coherence of the context, thereby facilitating subsequent similarity matching according to the segmented paragraph nodes while improving matching accuracy.

[0058] After the document segmentation is completed, users can ask query questions, and the system can automatically give the answer information obtained from the query. Among them, although the existing ChatGPT model, as an advanced artificial intelligence dialogue model, performs well in natural language processing, it has several security and delay issues. First of all, in terms of security, ChatGPT is a product of a foreign institution and may have data leakage and privacy risks, especially when processing sensitive information or personal data. Secondly, the delay problem is mainly reflected in the response speed of the model when processing large-scale requests. Complex calculations and large-scale data processing may cause system delays, affecting the real-time interactive experience.

[0059] In order to replace the ChatGPT model, the document question-answering system of the present invention generates answer information based on a local large language model. Since there are many types of models on the market, such as ChatGLM, Baichuan, Tongyi Qianwen, etc., and the versions are updated and iterated rapidly, selecting a model with high accuracy becomes a crucial step. Although these domestic and foreign open source models can run locally to avoid data leakage and privacy risks, and can be adjusted according to specific needs, and each model provides corresponding accuracy statistics, there may be unforeseen differences between the test scenario and our actual application scenario, so it is necessary to test the alternative models to determine the most accurate model.

[0060] Based on this, in this embodiment, various models on the market are compared through model evaluation to select the model that best suits specific needs. The specific process is as follows:

[0061] 1. Select a specific representative document as a test sample. Based on this test sample, write k questions and their corresponding k correct answers to obtain:

[0062] 1) Question list Q

[0063] 2) Correct answer list A

[0064] 2. Slice the test sample with chunk_size=m, overlap=n (where m is the length of each slice and n is the length of the overlapping portion between slices), and get:

[0065] 1) Text fragment list G

[0066] 3. After embedding the text fragment list G, the corresponding multiple slice nodes are stored in the vector database (vector store), thereby obtaining:

[0067] 1) Vector database V

[0068] 4. Find the slice node with the highest similarity to each question.

[0069] By traversing the question list Q obtained in step 1, and matching each element in the question list Q with the vector database V obtained in step 3, we can get a list of nodes ans_vlist with similarity from high to low corresponding to each question. By traversing the entire list Q according to the above rules, we can get a list RQ:

[0070] q1 ans_vlist1 q2 ans_vlist2 q3 ans_vlist3 …… …… qn ans_vlistn

[0071] Among them, {q1,q2,q3,……,qn}∈Q

[0072] 5. Traverse the list RQ, give the RQ[n].q question and the RQ[n].ans_vlist node list to the big model, and let the big model organize the natural language answer ans_txt from the text of the node list ans_vlist according to the question. Traverse the entire list RQ according to the above rules to get the list RS1:

[0073]

[0074]

[0075] Among them, {q1,q2,q3,……,qn}∈Q

[0076] 6. Combine the correct answer list A obtained in step 1 with the list RS1 obtained in step 5 to get list RS2:

[0077] q1 ans_txt1 a1 q2 ans_txt2 a2 q3 ans_txt3 a3 …… …… …… qn ans_txtn a4

[0078] Among them, {q1,q2,q3,…,qn}∈Q, {a1,a2,a3,…,an}∈A

[0079] 7. Evaluate the answer score.

[0080] Traverse the list RS2, and give q, ans_txt, and a in the list RS2 to ChatGPT. Use the prompt word (Prompt) to let it score ans_txt (the reason for using ChatGPT for this operation is that the answer needs to be evaluated. Given that ChatGPT currently represents the top level of artificial intelligence reasoning capabilities worldwide, the answers it generates are relatively more fair). The key point for deducting points is usually the omissions or creative content in the answer, and the scoring range is usually set to 0-100.

[0081] The test results of bert, ChatGLM6B, qwen1.514B, and qwen2.5-14B are as follows: Figure 2 As shown, the score intervals are 0-10, 10-20, 20-30, 30-40, 40-50, 50-60, 60-70, 70-80, 80-90, 90-100 respectively.

[0082] Among the models with scores between 90 and 100, qwen2.5-14B has the highest proportion and bert has the lowest proportion. Among the models with scores between 0 and 10, qwen2.5-14B has the lowest proportion and bert has the highest proportion. Therefore, it can be concluded that among the above four models, using the qwen2.5-14B model as the local large language model is the most reasonable choice.

[0083] Next, the selected model is deployed on a local server to ensure that data is processed locally and further enhance data security. During the deployment process, containerization technologies such as Docker can be used for packaging and management to ensure the consistency and isolation of the model environment. In addition, the performance and resource usage of the model are optimized through technologies such as model distillation and quantization. Model distillation can simplify the model structure and reduce computational complexity; quantization can convert model parameters from floating point numbers to low-precision integers, reducing storage and computing requirements. Finally, through the Monitoring and Logging System, system performance (usually GPU usage and video memory occupancy rate) is regularly monitored, and maintenance and updates are performed in a timely manner to ensure system stability.

[0084] In a preferred embodiment of the present invention, the document segmentation module 1 includes:

[0085] A paragraph recognition unit 11, used to recognize subheadings in a document;

[0086] The paragraph extraction unit 12 is connected to the paragraph identification unit 11 and is used to extract the first content between the subtitles by taking the subtitles as the dividing line, and taking the first content and the corresponding subtitle as a paragraph node.

[0087] Specifically, since the subtitle has the characteristics of starting with a number and using "." to indicate the level of the subtitle, based on this, in this embodiment, the paragraph recognition unit 11 can recognize the subtitle when recognizing the above characteristics. The above numbers can be Chinese numbers or Arabic numbers. After the subtitle is recognized, the first content between two adjacent subtitles is obviously content-related and context-coherent, and it can be regarded as an independent paragraph node.

[0088] After the content scope of each independent paragraph node is determined as described above, in order to maintain the association between the various paragraph nodes and further enhance the readability and comprehensibility of the document, in this embodiment, the parent title or parent paragraph or summary of the parent paragraph of each paragraph node is appended before the first content of each paragraph node. Specifically, the paragraph extraction unit 12 also includes an appending subunit 121, which is used to obtain parent titles of various levels associated with the subtitle according to the document's directory, and append the subtitle and its associated parent titles of various levels, as well as the second content between the subtitle and the parent title, to the corresponding first content to form a paragraph node.

[0089] Specifically, by appending the subtitle and its associated parent titles at all levels, as well as the second content between the subtitle and the parent title to the corresponding first content to form a paragraph node, the document structure is made similar to a directory, which facilitates navigation while improving the efficiency of information retrieval.

[0090] The following is Figure 3 Take the directory shown as an example to illustrate the relationship between subtitles and parent titles: when the identified subtitle is the directory's second-level title "1.1 Structure of Optical Fiber", its corresponding parent title is the directory's first-level title "Chapter 1 Optical Fiber". When the identified subtitle is the directory's third-level title "1.3.1 Classification of Optical Fiber", its corresponding parent title includes the second-level title "1.3 Classification and Main Characteristics of Optical Fiber" and the first-level title "Chapter 1 Optical Fiber", and so on.

[0091] Further, as Figure 4 The document fragment 1 shown in the figure is used as an example to illustrate the process of document segmentation according to paragraph structure as follows:

[0092] Figure 4The document fragment in the figure contains the abstract, the first chapter and its first two sections. Through the characteristics of the sub-headings, it can be identified that the sub-headings include "1 Core recommendations and basis", "(2) Maintain a healthy weight, prevent obesity and weight loss", among which "1 Core recommendations and basis" is the parent title of "(1) Scientific diet, regular exercise, and cultivate a good lifestyle" and "(2) Maintain a healthy weight, prevent obesity and weight loss".

[0093] Based on the above sub-heading identification, Figure 4 The document fragment in the first part is divided into three parts. The first part is the content before the subheading "1 Core Recommendations and Basis", that is, Figure 5 The paragraph node 1 shown is independent of other paragraphs and can be used as a paragraph node alone.

[0094] The second part is the content between the subheadings “(1) Eat healthy, exercise regularly, and develop a good lifestyle” and “(2) Maintain a healthy weight and prevent obesity and emaciation”, i.e. Figure 6 As shown in the paragraph node 2, it can be seen that the content related to the parent title "1 Core Recommendations and Basis" is attached to the front of the paragraph node.

[0095] The third part is the content after the subheading “(2) Maintain a healthy weight and prevent obesity and emaciation”, i.e. Figure 7 As shown in paragraph node three, it can be seen that the front of this paragraph node also has content related to the parent title "1 Core Recommendations and Basis" attached to it.

[0096] By attaching the relevant parent title, it is indicated that the above three paragraph nodes belong to the same parent title, the content is related and the coherence and completeness of the context are guaranteed, thereby effectively improving the probability of the corresponding paragraph node being correctly selected.

[0097] Furthermore, between the parent title “1 Core recommendations and basis” and the subtitle “(1) Scientific diet, regular exercise, and cultivating a good lifestyle”, there are two lines of content: “Recommendation 1: Reasonable diet, balanced eating and exercise, and blood sugar control” and “Key recommendations”. These two lines of content can be considered as the second content between the subtitle and the parent title. It can be seen that this part of the content is relatively brief and can be directly attached to the front of paragraph node two and paragraph node three.

[0098] However, in the case where there is a lot of second content, if all of it is directly appended to the paragraph node, firstly, there will be too much content affecting the search efficiency, and secondly, too much content will also cause too much noise, which will further affect the search accuracy. Based on this, in a preferred embodiment of the present invention, in the appending subunit 111, after obtaining the second content, it also includes generating corresponding summary information based on the second content, and then appending the summary information as the second content to the front of the first content.

[0099] Specifically, Figure 8 Taking the document fragment 2 shown in the figure as an example, it can be seen that there is a large second content between the parent title "Chapter 2 Lexical Analysis" and the subtitle "2.1 Scanning Processing". The content is too long, and it is preferred to use a local large language model for summarization to obtain the following: Fig. 9 The summary information shown is used to compress the second content so that it is not too lengthy when it is attached to the front of the paragraph node.

[0100] The above-mentioned process of document segmentation according to paragraph structure includes the recognition of paragraph boundaries through the recognition of sub-headings and the construction of a hierarchical structure through the relationship between sub-headings and parent headings. This process is all carried out automatically, which greatly reduces manual operations, improves the efficiency and accuracy of the segmentation process, and ultimately improves the efficiency of document management and information extraction.

[0101] If the document contains only text content, then only the paragraph nodes need to be divided based on the above processing process, but in the document, we often encounter the existence of tables. Existing large model-driven document question-answering systems often seem to be unable to cope with the processing of tables, mainly because their understanding of the table structure and content is not deep enough. This deficiency makes the system encounter obstacles when parsing and extracting complex information in the table, and it is impossible to accurately identify the row and column relationship and logical structure of the table, which in turn affects the accuracy and reliability of the question-answering system. In short, faced with complex tables, these systems often seem to be stretched and unable to cope. In order to solve this technical problem, the present invention also converts the content in the table before performing similarity matching. The uniqueness of the table is that the meaning of its content is often closely related to the grid position. Therefore, when it is necessary to extract information from the table, its content cannot be simply cut into fragments for processing. On the contrary, it is necessary to carefully pre-process the table to ensure that the information can be accurately retained during the conversion process. Specifically, the paragraph extraction unit 12 further includes an extraction subunit 122, which is used to assemble the contents in the table into declarative sentences when the first content includes a table, and replace the corresponding table with the declarative sentences.

[0102] For example, there is the following table in the document:

[0103] nation capital Population (millions) Primary Language China Beijing 1,400 Chinese USA Washington 331 English Japan Tokyo 126 Japanese Germany Berlin 83 German

[0104] Before extracting the contents in the table, it is preferred to also perform data preprocessing on the table. The preprocessing here includes data cleaning and data formatting. Data cleaning can ensure that there are no missing values ​​and abnormal values ​​in the table data. Data formatting includes unifying the case of all letters, removing commas in all numbers, and so on.

[0105] After the data preprocessing is completed, the first column of each row of the table can be assembled into a declarative sentence separately, as follows:

[0106] China's capital is Beijing, with a population of 1.4 billion and the main language is Chinese

[0107] The capital of the United States is Washington, D.C., with a population of 331 million and English as the main language

[0108] The capital of Japan is Tokyo, the population is 126 million, and the main language is Japanese

[0109] The capital of Germany is Berlin, with a population of 83 million and the main language is German

[0110] By replacing the table with the above-mentioned declarative sentences, the document question-answering system of the present invention can achieve an in-depth understanding of the table structure and content, and thus can respond to relevant questions from users. For example, if a user asks "Which country's capital is Beijing?", the closest entry "China's capital is Beijing, with a population of 1.4 billion and Chinese as the main language" can be found through similarity matching, and then the answer information can be given.

[0111] In a preferred embodiment of the present invention, a graph database 6 is further included, which is connected to the document segmentation module 1 and the answer generation module 2 respectively. The document segmentation module 1 also includes:

[0112] A relationship graph generating unit 15 is used to convert the contents of the table into triples according to the row and column position relationship when a table is included in a paragraph node, and store the triples in a graph database 6 to build a knowledge graph;

[0113] The answer generation module 2 is also used to display the associated knowledge graph to the user while displaying the answer information when it is identified that the paragraph node with the highest similarity contains a table.

[0114] Specifically, in this embodiment, when the first content includes a table, it also includes building a knowledge graph based on the content in the table to further display the knowledge graph and improve the user experience. Still taking the above table 1 as an example, it also includes processing the table into a relationship graph, and the specific process is as follows:

[0115] The table content is converted into a triple structure according to the positional relationship between rows and columns. The triples obtained after conversion are:

[0116] (China, capital, Beijing)

[0117] (China, population, 140 million)

[0118] …

[0119] (Germany, primary language: German)

[0120] In order to make the knowledge more three-dimensional and vivid, we store these triple data in a graph database 6, which can be Neo4j or JanusGraph, to build a similar Fig.10 The knowledge graph shown in the figure shows that various information and relationships are intertwined in a visual way. With the help of the query language of the graph database 6, such as Cypher or Gremlin, it is possible to display the intricate relationship graph between entities, while improving the accuracy of information retrieval and significantly improving the performance of the question-answering system. In addition, by preprocessing the tabular data and ensuring the efficiency and accuracy of the data conversion process, it helps to reduce manual intervention and reduce the error rate. This method not only improves the structuring of the data, but also provides a solid foundation for subsequent data analysis and mining.

[0121] In a preferred embodiment of the present invention, an embedding processing module 3 is further included, which is connected to the document segmentation module 1 and the vector database 4, respectively, and is used to embed each paragraph node to generate a corresponding paragraph vector and save it to the vector database 4, and embed the query question to generate a question vector;

[0122] The answer generation module 2 is also connected to the embedding processing module 3 and the vector database 4, and is used to perform similarity matching between the question vector and each paragraph vector to achieve similarity matching between the query question and each paragraph node.

[0123] In a preferred embodiment of the present invention, the answer generation module 2 includes:

[0124] A similarity matching unit 21 is used to perform similarity matching between the query question and each paragraph node, and obtain a plurality of paragraph nodes having a preset number in descending order of similarity;

[0125] The reordering unit 22 is connected to the similarity matching unit 21 and is used to use the reordering model to reorder the similarity of each paragraph node obtained, and send the paragraph node with the highest similarity after reordering to the local large language model.

[0126] Specifically, in this embodiment, embedding technology is preferably used to match the query question with each paragraph node for similarity. The embedding technology here is a technology that converts text into a dense numerical vector, that is, converting the user question into a question vector, and converting the paragraph node into a paragraph vector. These vectors can well represent the semantic features of the text, such as semantics, contextual relationships, and emotional tendencies, and then the vectors can be used to calculate the semantic similarity between texts, such as cosine similarity.

[0127] However, when only embedding technology is used to calculate similarity, the difference between the similarity scores may be too small, resulting in unclear data features, which will cause trouble for subsequent classification work. For example, for the phrase "I want to eat something", only embedding technology is used to calculate its similarity with the following words:

[0128] -Bathroom: 0.4499711

[0129] -Park: 0.46093374

[0130] -Bedroom: 0.49159515

[0131] In the above results, "restroom" is ranked first among the related words. Based on common sense, we can infer that people usually do not eat in the restroom. This phenomenon reveals some limitations of word embedding in dealing with semantic relevance, indicating that the model may be biased in understanding and distinguishing the actual usage of words in different contexts.

[0132] In order to solve the above technical problems, in this embodiment, a reranking mechanism is introduced to rerank the candidate results of the preliminary search obtained by similarity matching using the embedding technology to improve the relevance and accuracy of the results. Preferably, a reranking model can be used, and the reranking model here can use a learning-based ranking model (Learning to Rank Model), such as a LAMBDA-MART or BERT-based reranking model. Secondly, a complex scoring mechanism is designed.

[0133] Still for the above example, the three candidate results obtained by preliminary similarity matching were re-ranked to obtain the following re-ranking results: (the higher the score, the higher the relevance)

[0134] Park: 0.00030268586

[0135] Bedroom: 0.0009920185

[0136] Restroom: 0.000092096234

[0137] It can be seen that after the rerank process, "park" and "bedroom" are ranked before "restroom", and their scores are one order of magnitude higher. This sorting is more logical and common sense. Therefore, the addition of the rerank step can further improve the quality of the final result.

[0138] In a preferred embodiment of the present invention, an image bed 5 is further included, connected to the document segmentation module 1, and the document segmentation module 1 further includes:

[0139] The page segmentation unit 13 is used to segment the document into multiple pages and store each page and its corresponding page number information on the image bed;

[0140] A page number associating unit 14 is used to associate each paragraph node with the page number information where the paragraph node is located;

[0141] The answer generation module 2 is connected to the image hosting 5, and is also used to display the page number information associated with the paragraph node with the highest similarity and the page where it is located to the user while displaying the answer information.

[0142] Specifically, when providing answers, traditional big models often fail to link to specific pages of original documents, which poses a great challenge to information traceability and verification. It is difficult for users to quickly verify the accuracy and context of answers, which increases the risk of misunderstanding and miscommunication. This not only hinders academic research and legal fields that rely heavily on precise citations and evidence support, but also significantly reduces the credibility and professionalism of information. Such a lack of transparency may seriously undermine users' trust in the output results of big models.

[0143] To solve the above-mentioned technical problems, in the present embodiment, the document is divided into multiple pages by page, and each page is preferably stored in the image bed 5 in the form of a picture or PDF, to ensure that each paragraph node corresponds to a specific page number. Then, the page number information of each paragraph node is obtained, and it is associated with the content. When providing an answer, the page number information of the relevant paragraph node is returned, so that the user can quickly locate the original document, and the credibility of the answer is also enhanced. To optimize the user experience, it is preferred to display the relevant page number and the original data link in the user interface, so that the user is more convenient and efficient when verifying the answer. Wherein, the document question-answering system of the present invention can automatically perform the slicing, identification and page number association of the document, to ensure that the whole process is efficient and accurate, greatly optimizing the user experience. This method not only improves the transparency of information tracing, but also enhances the reliability and user trust of the system.

[0144] More specifically, in order to display the page number information associated with the paragraph node with the highest similarity and the page where the paragraph node is located to the user while displaying the answer information, it is preferred to obtain the page number information of each paragraph node through the directory, and when the document is segmented, the page information where the paragraph node is located is added to the first content of the paragraph node:

[0145] {

[0146] 'content': paragraph body

[0147] 'page_ix': the page number where the paragraph is located

[0148] }

[0149] The document is then divided into multiple image files or PDF files in units of pages and stored in an image hosting service. When the answer is provided to the user, the page number information in the paragraph node can be used to quickly find the relevant images in the image hosting service.

[0150] The present invention also provides a document question-answering method based on a large model, which is applied to the above-mentioned document question-answering system, such as Figure 2 As shown, the document question-answering method includes:

[0151] Step S1, the document question answering system divides the document uploaded by the user into multiple paragraph nodes according to the paragraph structure;

[0152] In step S2, the document question answering system matches the query question raised by the user with the similarity of each paragraph node, and sends the paragraph node with the highest similarity to the local large language model for processing, so as to display the answer information associated with the query question to the user.

[0153] The above description is only a preferred embodiment of the present invention, and does not limit the implementation mode and protection scope of the present invention. For those skilled in the art, it should be aware that all solutions obtained by equivalent substitutions and obvious changes made using the contents of this specification and illustrations should be included in the protection scope of the present invention.

Claims

1. A document question answering system based on a large model, characterized in that: include: The document segmentation module is used to segment the document uploaded by the user into multiple paragraph nodes according to the paragraph structure; The answer generation module is connected to the document segmentation module and is used to match the query questions raised by the user with the similarities of each paragraph node, and send the paragraph node with the highest similarity to the local large language model for processing, so as to display the answer information associated with the query question to the user.

2. The document question-answering system according to claim 1, characterized in that: The document segmentation module comprises: A paragraph recognition unit, used to recognize subheadings in the document; The paragraph extraction unit is connected to the paragraph identification unit and is used to extract the first content between the subtitles by taking the subtitles as a dividing line, and taking the first content and the corresponding subtitle as a paragraph node.

3. The document question-answering system according to claim 2, characterized in that: The paragraph extraction unit also includes an appending subunit, which is used to obtain parent titles of various levels associated with the subtitle according to the directory of the document, and append the subtitle and its associated parent titles of various levels, as well as the second content between the subtitle and the parent title to the corresponding first content to form the paragraph node.

4. The document question-answering system according to claim 3, characterized in that: In the appending subunit, after acquiring the second content, the method further includes generating corresponding summary information based on the second content, and then appending the summary information as the second content to the beginning of the first content.

5. The document question-answering system according to claim 2, characterized in that: The paragraph extraction unit further includes an extraction subunit, which is used to assemble the contents in the table into a declarative sentence when the first content includes a table, and replace the corresponding table with the declarative sentence.

6. The document question-answering system according to claim 1, characterized in that: It also includes an embedding processing module, which is connected to the document segmentation module and the vector database, respectively, and is used to embed each of the paragraph nodes to generate a corresponding paragraph vector and save it to the vector database, and embed the query question to generate a question vector; The answer generation module is also connected to the embedding processing module and the vector database, and is used to perform similarity matching between the question vector and each of the paragraph vectors to achieve similarity matching between the query question and each of the paragraph nodes.

7. The document question-answering system according to claim 1, characterized in that: The answer generation module comprises: A similarity matching unit, used for performing similarity matching between the query question and each of the paragraph nodes, and obtaining a plurality of the paragraph nodes having a preset number in descending order of similarity; A reordering unit is connected to the similarity matching unit and is used to use a reordering model to reorder the similarities of the obtained paragraph nodes, and send the paragraph nodes with the highest similarity after reordering to the local large language model.

8. The document question-answering system according to claim 1, characterized in that: It also includes an image bed connected to the document segmentation module, and the document segmentation module also includes: A page segmentation unit, used for segmenting the document into multiple pages, and storing each page and its corresponding page number information on the image bed; A page number associating unit, used for associating each of the paragraph nodes with the page number information on which it is located; The answer generation module is connected to the image hosting service, and is also used to display the page number information associated with the paragraph node with the highest similarity and the page where the paragraph node is located to the user while displaying the answer information.

9. The document question-answering system according to claim 1, characterized in that: It also includes a graph database, which is connected to the document segmentation module and the answer generation module respectively, and the document segmentation module also includes: A relationship graph generating unit, configured to convert the contents of the table into triples according to the row and column position relationship when the paragraph node contains a table, and store the triples in the graph database to build a knowledge graph; The answer generation module is also used to display the associated knowledge graph to the user while displaying the answer information when it is identified that the paragraph node with the highest similarity contains a table.

10. A document question answering method based on a large model, characterized in that: Applied to the document question-answering system according to any one of claims 1 to 9, the document question-answering method comprises: Step S1, the document question-answering system divides the document uploaded by the user into multiple paragraph nodes according to the paragraph structure; In step S2, the document question-answering system matches the query question raised by the user with the similarity of each paragraph node, and sends the paragraph node with the highest similarity to the local large language model for processing, so as to display the answer information associated with the query question to the user.

Citation Information

Cited By

  • Method and system for realizing intelligent customer service in environmental protection field

    CN119961498A

  • Question and answer generation method and device based on reference verification and similarity constraint, medium and program product

    CN120611032A

  • Long PDF file question and answer method and device based on multi-modal model, medium and equipment

    CN121146042A