A complex table question answering method based on tree structure, electronic equipment and medium

By organizing multi-level table headings into a tree structure and decomposing questions into keywords aligned with the table header tree structure, an iterative reasoning method was adopted to solve the accuracy and efficiency problems of large language models in complex table question-and-answer, achieving more efficient information extraction and answering.

CN120670452BActive Publication Date: 2026-07-07ZHEJIANG UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHEJIANG UNIV
Filing Date
2025-06-09
Publication Date
2026-07-07

Smart Images

  • Figure CN120670452B_ABST
    Figure CN120670452B_ABST
Patent Text Reader

Abstract

The application discloses a complex table question and answer method based on a tree structure, an electronic device and a medium, and comprises the following steps: in response to table header information of a complex table, a large language model outputs a table header tree structure; the large language model decomposes a question into a plurality of keywords, aligns the keywords with the table header tree structure, and obtains keyword-tree structures; in response to the keyword-tree structures, the large language model is guided to iteratively reason and search in the complex table by using a React-Style prompting method, and an answer is output. According to the application, the multi-level titles of the table are organized into a tree structure, so that the large language model can more clearly understand the hierarchical relationship of the table, and thus can more accurately locate relevant information when answering questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of machine learning, and more particularly to a complex table question-answering method, electronic device, and medium based on a tree structure. Background Technology

[0002] In the era of digital information processing, tabular data, as an important information carrier, is widely present in various fields, such as financial statements, scientific research, and statistical analysis. However, accurately extracting information from complex tables and answering related questions remains a challenging task for existing models. Traditional methods often struggle to effectively handle complex hierarchical structures and multi-level headings in tables, making it easy for irrelevant information to interfere with the accuracy and efficiency of answers.

[0003] In recent years, with the development of large language models (LLMs), they have demonstrated powerful capabilities in natural language processing tasks. However, even state-of-the-art LLMs have certain limitations when faced with complex table-based question-answering tasks. For example, the model may fail to accurately understand the hierarchical relationships between multi-level headings in a table, or it may be unable to effectively focus on key parts when retrieving information relevant to the question, leading to a decrease in the accuracy and relevance of the answer.

[0004] To overcome these challenges, researchers have proposed various methods to enhance models' understanding and reasoning abilities regarding tabular data. Some methods focus on encoding and representing the table structure, while others focus on how to more effectively align questions with table content. However, these methods still have room for improvement when dealing with complex hierarchical tables. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a complex table question-and-answer method, electronic device, and medium based on a tree structure.

[0006] In a first aspect, embodiments of the present invention provide a complex table question-and-answer method based on a tree structure, the method comprising:

[0007] In response to the header information of complex tables, the large language model outputs a header tree structure;

[0008] The problem is decomposed into several keywords using a large language model, and the keywords are aligned with the header tree structure to obtain a keyword-tree structure.

[0009] Responding to the keyword-tree structure, the React-Style hint method guides the large language model to perform iterative reasoning to retrieve answers from complex tables and output the results.

[0010] Secondly, embodiments of the present invention provide an electronic device, including a memory and a processor, wherein the memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the above-described tree-structure-based complex table question-and-answer method.

[0011] Thirdly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the above-described complex table question-and-answer method based on a tree structure.

[0012] Fourthly, embodiments of the present invention provide a computer program product, including a computer program / instruction, which, when executed by a processor, implements the above-described tree-structure-based complex table question-and-answer method.

[0013] Compared with the prior art, the beneficial effects of the present invention are:

[0014] This invention provides a tree-structure-based method for complex table question answering. By organizing the multi-level headings of a table into a tree structure, a large language model can more clearly understand the hierarchical relationships within the table, thus enabling more accurate location of relevant information when answering questions. Furthermore, this invention decomposes the question into several keywords using the large language model and aligns these keywords with the table header tree structure. This question decomposition and alignment process helps the large language model focus on the key parts of the question, avoiding interference from irrelevant information. Finally, a multi-round optimization strategy further improves the accuracy and reliability of the answers, resulting in superior performance of the large language model in complex table question answering tasks. Attached Figure Description

[0015] To more clearly illustrate the technical solutions and processes in this invention, the technical processes mentioned in the invention description will be accompanied by specific architectural diagrams and brief descriptions below. Obviously, the accompanying drawings described below are merely some embodiments of this invention. For those skilled in the art, additional drawings can be obtained based on the drawings without any creative effort.

[0016] Figure 1 A flowchart illustrating a complex table-based question-and-answer method based on a tree structure, provided in an embodiment of the present invention;

[0017] Figure 2 A schematic diagram illustrating the implementation process of a complex table-based question-and-answer method based on a tree structure, provided in an embodiment of the present invention;

[0018] Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0020] It should be noted that, unless otherwise specified, the features in the following embodiments and implementation methods can be combined with each other.

[0021] like Figure 1 As shown, this embodiment of the invention provides a complex table question-answering method based on a tree structure, the method comprising the following steps:

[0022] Step S1: In response to the header information of the complex table, the large language model outputs the header tree structure.

[0023] The header information of complex tables is encoded into several quadruplets T = (t1, t2, t3, t4) using a large language model. Here, t1 represents the header category and its corresponding hierarchical structure, where the header category is either a row header (R) or a list header (C). t2 represents the starting position of the current header, t3 represents the ending position of the current header, and t4 represents the content of the current header. For example, the quadruplet (R0, 1, 2, City) indicates that the header is a row header located at level 0, and its influence ranges from the first row to the second row, with the cell content being City.

[0024] Concatenate all the quadruples to obtain the header list L = (T1, T2, ..., T... n This allows large language models to more clearly identify the hierarchical structure of the table header, construct a "structural blueprint" for the table, and effectively guide the subsequent reasoning process.

[0025] Based on the hierarchical relationship L of the table headers, the table header list is converted into a table header tree structure H; including:

[0026] Group each quadruple in the header list L according to the header category and hierarchy level, group all quadruples at the same hierarchy level into the same group, and add a root node for each row and column, with a hierarchy mark of -1.

[0027] Compare the starting positions of each quaternion T in the header list L. and termination position If the start and end positions of a quaternion are equal, that is... Then mark the quadruple as a leaf node;

[0028] If the starting position of a quaternion and termination position If they are different, then the current first quaternion T is compared with all second quaternions T of higher hierarchical levels and the same header category. If the starting position of the first quaternion is greater than or equal to the starting position of the second quaternion and the ending position of the first quaternion is less than or equal to the ending position of the second quaternion, then... and Then the second quaternion T′ is considered to be the parent node of the first quaternion T;

[0029] The process continues until all quadruplets in the header list L are connected to their respective parent nodes. Quadruplets without parent nodes are directly connected to the root node, thus forming the header tree structure H.

[0030] Step S2: Decompose the problem into several keywords using a large language model, align the keywords with the header tree structure, and obtain the keyword-tree structure.

[0031] Furthermore, a first prompt word template is set up to guide the large language model to structurally decompose question Q into several keywords, as shown in the following expression:

[0032] K = Decompose LLM (Q) = [k1, k2, ..., k m ]

[0033] In the formula, K represents the keyword set, decompose represents the decomposition function, m represents the number of keywords, and k m This represents the m-th keyword.

[0034] It's important to note that these keywords typically represent core concepts, key entities, or main query points in the problem, helping the model quickly focus on the core requirements. For a query involving tabular data, keywords might be field names in the table header, numerical ranges, or specific condition descriptions. By extracting these keywords, the large language model can more efficiently filter out irrelevant information and concentrate on the parts directly related to the problem. For example, the first suggestion word template is:

[0035]

[0036] Furthermore, after completing the problem decomposition, a second prompt word template is set to guide the model to align the extracted keywords with the header quadruples, thereby enabling it to accurately locate header information related to the problem. Specifically, given a keyword set K and a header quadruple set H, the alignment goal is to construct a keyword-tree structure H. * Its form can be expressed by the following formula:

[0037] H *=select(T,Align) LLM (T,k)>θ),T∈H,k∈K

[0038] Here, θ is a preset matching threshold, which allows the large language model to calculate the degree of matching between the header quadruple and the keyword. Tuples T that meet the condition will be added to the keyword-tree structure H. * In the middle. For example, the second prompt word template is:

[0039]

[0040]

[0041] Step S3: In response to the keyword-tree structure, the large language model is guided to perform iterative reasoning to retrieve the answer from the complex table using the React-Style hint method.

[0042] Specifically, after alignment, the generated keyword-tree structure H * Integrating into the third-party prompt template guides the large language model to retrieve key information from the table, helping it better locate question-related header information. We employ the React-Style prompting method to guide the model through multiple rounds of iterative reasoning. The core of this method lies in decomposing the reasoning process into multiple stages, each round containing three steps: Thought, Action, and Result.

[0043] In the Thought phase, the large language model analyzes the current problem and existing information to generate inference hypotheses;

[0044] During the Action phase, the large language model performs specific operations based on the reasoning assumptions, such as extracting data from sub-tables or adjusting the reasoning direction.

[0045] In the Result phase, the large language model evaluates the results of the operation and adjusts subsequent inference strategies based on the feedback.

[0046] Through this multi-round iterative approach, the large language model can gradually correct deviations in the initial reasoning and gradually approach the correct answer. For example, if the large language model fails to accurately extract relevant sub-tables in the first round, it can readjust the alignment strategy between keywords and table headers, or refine the reasoning path, based on feedback from the Result stage in the next round, thereby improving the overall reasoning performance. For example, the third prompt word template is:

[0047]

[0048]

[0049] Example 1

[0050] like Figure 2 As shown, this invention uses a student count table as an example to further illustrate the specific process of a complex table-based question-and-answer method based on a tree structure. The method includes:

[0051] Step S1: In response to the header information of the complex table, the large language model outputs the header tree structure.

[0052] For example, the quadruple (C0,0,0,Grade) indicates that the header is a list header located at level 0, with its influence ranging from row 0 to row 0, and the cell content is Grade; the quadruple (R0,1,3,1) indicates that the header is a row header located at level 0, with its influence ranging from row 1 to row 3, and the cell content is 1.

[0053] Step S2: Decompose the problem into several keywords using a large language model, align the keywords with the header tree structure, and obtain the keyword-tree structure.

[0054] For example, in this instance, the question is: How much more numerous are the boys in the second grade than the girls? The question is decomposed into several keywords using a large language model. The keywords obtained include male, student, female, and second grade. The relevant list header is [(C0,0,0,Grade),...], and the relevant row list header is [(R0,4,6,2),...].

[0055] Step S3: In response to the keyword-tree structure, the large language model is guided to perform iterative reasoning to retrieve the answer from the complex table using the React-Style hint method.

[0056] Thinking stage: I now need to calculate how much more second-grade boys there are than girls; Working stage: Calculate the difference between the number of second-grade boys and girls; Result stage: The result is 1575.

[0057] In summary, this invention provides a tree-structure-based question-answering method for complex tables, aiming to solve problems such as high manual annotation costs and the difficulty of traditional methods in handling complex tables. This method organizes multi-level table headings into a tree structure, enabling the model to more clearly understand the table's hierarchical relationships and accurately locate relevant information. Simultaneously, it decomposes questions into keywords and aligns them with the table heading tree, focusing on the key aspects of the question and avoiding interference from irrelevant information. A multi-round optimization strategy is employed to progressively improve the answer, enhancing accuracy and reliability. This invention demonstrates superior performance in complex table question-answering tasks, effectively reducing annotation costs and improving automation. Specifically, the method first automatically organizes the multi-level row and column headings of the table into a tree structure. The model self-interprets the structural information of the table headings, including the meaning, scope of influence, hierarchical structure, and relationships between headings, encoded as a list of tuples. Each tuple represents the attributes of a heading node, such as row or column heading, corresponding level, start and end positions, and cell content. Then, based on the hierarchical relationships of these tuples, the scattered heading list is organized into a table heading tree with clear parent-child connections. Next, the question is decomposed into multiple keywords to more precisely focus on the key aspects of the question. Then, these keywords are aligned with nodes in the table title tree to accurately locate sub-tables relevant to the question. Finally, the aligned keyword title tree guides the model to retrieve necessary information from the table, such as relevant sub-tables. Simultaneously, a React-like multi-round optimization strategy is employed, using multiple rounds of thinking, action, and result feedback to gradually refine the answer and ultimately output the final solution.

[0058] Accordingly, this application also provides an electronic device, including: one or more processors; a memory for storing one or more programs; and when the one or more programs are executed by the one or more processors, causing the one or more processors to implement the tree-based complex table question-and-answer method described above. Figure 3 The diagram shown illustrates a hardware structure of any data processing-capable device for implementing the tree-based complex table question-answering method provided in this embodiment of the invention, except... Figure 3 In addition to the processor, memory, and network interface shown, any data processing device in the embodiment may also include other hardware depending on the actual function of the data processing device, which will not be described in detail here.

[0059] Accordingly, this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the tree-structure-based complex table question-and-answer method described above. The computer-readable storage medium can be an internal storage unit of any data-processing device as described in any of the foregoing embodiments, such as a hard disk or memory. The computer-readable storage medium can also be an external storage device, such as a plug-in hard disk, smart media card (SMC), SD card, flash card, etc., equipped on the device. Furthermore, the computer-readable storage medium can include both internal storage units of any data-processing device and external storage devices. The computer-readable storage medium is used to store the computer program and other programs and data required by the data-processing device, and can also be used to temporarily store data that has been output or will be output.

[0060] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the disclosure herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only.

[0061] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.

Claims

1. A complex table question-answering method based on a tree structure, characterized in that, The method includes: In response to the header information of complex tables, the large language model outputs a header tree structure; The problem is decomposed into several keywords using a large language model, and the keywords are aligned with the header tree structure to obtain a keyword-tree structure. Responding to the keyword-tree structure, the React-Style hint method guides the large language model to perform iterative reasoning to retrieve answers from complex tables and output the results. The process by which the large language model outputs the header tree structure in response to the header information of complex tables includes: The header information of complex tables is encoded into several quadruplets T=(t1,t2,t3,t4) using a large language model, where t1 represents the header category of the current table and its corresponding hierarchical structure, and the header category is either a row header or a list header; t2 represents the starting position of the current table header; t3 represents the ending position of the current table header; and t4 represents the content of the current table header. Concatenate all the four tuples to get the table header list L = (T1, T2, …, T n ); Based on the hierarchical relationship L of the table header, the table header list is converted into a table header tree structure H; The process of converting the header list into a header tree structure based on the hierarchical relationship of the headers includes: Group each quadruple in the header list L according to the header category and hierarchy level, group all quadruples at the same hierarchy level into the same group, and add a node for each row and column, with a hierarchy mark of -1. Compare the start and end positions of each quadruple in the header list L. If the start and end positions of a quadruple are equal, mark the quadruple as a leaf node. If the starting and ending positions of a quaternion are different, the current first quaternion is compared with all second quaternions of higher level and the same header category. If the starting position of the first quaternion is greater than or equal to the starting position of the second quaternion and the ending position of the first quaternion is less than or equal to the ending position of the second quaternion, then the second quaternion is considered to be the parent node of the first quaternion. The process continues until all quadruplets in the header list L are connected to their respective parent nodes. Quadruplets without parent nodes are directly connected to the root node, thus forming the header tree structure H.

2. The complex table question-answering method based on a tree structure according to claim 1, characterized in that, The keywords include field names, value ranges, and condition descriptions in the table header.

3. The complex table question-answering method based on a tree structure according to claim 1, characterized in that, The process of aligning keywords with the header tree structure to obtain the keyword-tree structure includes: Iterate through the header set and keyword set, calculate the semantic similarity between each header and keyword, and score based on the semantic similarity. Add headers with semantic similarity scores greater than a threshold to the set of key headers; Match keywords with key headers to obtain a keyword-tree structure.

4. The complex table question-answering method based on a tree structure according to claim 1, characterized in that, Responding to a keyword-tree structure, the process of guiding a large language model through iterative reasoning to retrieve information from a complex table using React-Style hints and outputting the answer includes: In the thinking phase, the large language model analyzes the current problem and generates reasoning hypotheses; in the action phase, the large language model executes the reasoning hypotheses; in the outcome phase, the large language model evaluates the outcome of the action and adjusts the reasoning strategy; this completes one iteration. Following this pattern, after n iterations, the large language model outputs the final answer.

5. A complex table question-and-answer method based on a tree structure according to claim 1 or 4, characterized in that, Based on the React-Style hint method, if the large language model fails to accurately extract relevant sub-tables in the first iteration, it will re-perform inference in the second iteration based on the inference strategy obtained from the results of the first iteration.

6. An electronic device comprising a memory and a processor, characterized in that, The memory is coupled to the processor; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the tree-based complex table question-and-answer method according to any one of claims 1-5.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the complex table question-and-answer method based on a tree structure as described in any one of claims 1-5.

8. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the tree-based complex table question-and-answer method as described in any one of claims 1-5.