Manuscript Offprint

arXiv:2610.07749

Cost-Effective Numerical QA over Semi-Structured Table: Structuring, Resolution, Planning

Feng Luo, Hui Luo, Zhifeng Bao, J. Shane Culpepper, Xiaoli Wang, Shazia Sadiq

Feng Luo 1,3†^{1,3\dagger}, Hui Luo 2^{2}, Zhifeng Bao 3^{3}, J. Shane Culpepper 3^{3}, Xiaoli Wang 4^{4}, Shazia Sadiq 3^{3}

1^{1}RMIT University 2^{2}University of Wollongong 3^{3}The University of Queensland 4^{4}Xiamen University

feng.luo@student.rmit.edu.au, huil@uow.edu.au, zhifeng.bao@uq.edu.au, s.culpepper@uq.edu.au,

xlwang@xmu.edu.cn, shazia@eecs.uq.edu.au

Abstract—Semi-structured tables encode rich semantic information through diverse layout elements, such as hierarchical row and column headers. Answering numerical questions over such data is challenging because it requires a joint effort of accurate structural understanding of tables, question uncertainty resolution, and complex query intents interpretation. Existing methods are rarely effective in handling the above multifaceted challenges in a holistic manner; moreover, they rely on LLMs without considering financial implications.

We propose SemiBonsai, a cost-effective, LLM-powered framework featuring: (1) a Multiway Layered Table Structurer that converts a table into a multiway layered tree organized by structural elements; (2) a Context-Aware Uncertainty Resolver that grounds underspecified phrases to context-coherent structural elements; (3) a Plan-Guided Reasoner that decomposes complex query intents into a query plan for reasoning; (4) a Budget-Aware Bandit Router that learns per-instance LLM utilities and optimizes LLM selection under fixed monetary constraints. Experiments on three benchmarks show that Semi-Bonsai improves both QA effectiveness and cost-effectiveness. Notably, the Table Structurer improves answer accuracy by 46% over alternative tree construction methods, and Router achieves a 5% average relative gain in answer accuracy compared with existing routing methods across budgets.

Index Terms—Semi-structured table QA, LLM routing

I. INTRODUCTION

Semi-structured tables flexibly capture complex layouts common in real-world data (e.g., financial reports [1] and electronic health records [2]). Unlike flat tables, semantics can be (implicitly) encoded through rich layout elements, including the use of multiple subtables, hierarchical row headers, and hierarchical column headers [3]. Notably, these tables often contain a substantial portion of numerical data (nearly 70% [4]) and users frequently need to extract numerical insights from them, motivating the need for natural language interfaces to perform numerical question answering (QA) over such data.

In this paper, we study Numerical Semi-Structured Table QA, which aims to accurately compute numeric answer for the question over semi-structured tables. Its complexity stems from two aspects: table side and question side. On the table side, complexity mainly arises from layout elements that specify structural semantics for interpreting values. Specifically, a single table may contain multiple subtables where a cell's meaning is only recoverable by inferring its unique Hierarchical Header Sequence: 11◯\textcircled{11} hierarchical column headers, where a column is specified using a nested column header sequence; 12◯\textcircled{12} hierarchical row headers, where a row is specified using a nested row header sequence. We illustrate this using the table T shown in Fig. 1:

T contains two subtables: Service Group Sale Info and Cloud Team Sale Info. Within Service Group Sale Info:

① Determining the year in Year Ended May 31 requires inferring the column header sequence (2016, Year Ended May 31).

② Determining the Total Cost requires inferring the row header sequence (Managed Services, Total Cost).

On the question side, complexity arises from: 21◯\textcircled{21} question uncertainty, where questions are underspecified and require context-coherent grounding; 22◯\textcircled{22} query intent, where answering a question requires multi-step value grounding and reasoning, involving operands and operators. As shown in Fig. 1:

②): “last two years” is underspecified and must be grounded to specific years, i.e., 2018 and 2017.

②: The query intent in “annualized uplift of total revenue in the year with the minimum cost” involves five steps: (1) locate data for the last two years, (2) rank these years by cost to find the minimum-cost year, (3) retrieve the values needed to instantiate the two operands for the uplift—the total revenue of that year and of the previous year, (4) aggregate the retrieved values, and (5) compute the uplift to produce the final answer.

Taken together, effectively addressing numerical semi-structured table QA requires a joint effort of (C1) accurate table structure understanding, (C2) question uncertainty resolution, and (C3) complex query intent interpretation. Existing approaches typically fall into three families: prompt-based methods [5] that employ pretrained LLMs to directly generate answers, code-driven methods that translate questions into executable programs (e.g., SQL or Python), and representation-driven methods that convert tables into representations (e.g., trees or graphs) and then use LLM-guided retrieval and reasoning over the representations for answering. However, all three are rarely effective in handling the above multifaceted challenges in a holistic manner (see §II-B1), as they simplify the table layout, or lack robust mechanisms for uncertainty resolution or complex query intent support. For instance, the recent ST-Raptor [6] builds a hierarchical tree and uses LLMs to decompose a question into sub-questions and answer them over the tree. It remains limited because: (1) its tree omits key layout semantics (i.e., hierarchical row headers); (2) it does not explicitly resolve underspecified phrases, causing decomposition errors to propagate to answering; and (3) it

†^{\dagger}This work was done while visiting The University of Queensland.

Figure

What is the annualized uplift of total Revenue in the year with the minimum cost in Supporting part over the last two years?

Fig. 1: A running example illustrating our numerical semi-structured table QA problem.

answers sub-questions independently, ignoring dependencies that often arise in complex query intents.

Beyond effectiveness, existing methods rely on high-capability LLMs, overlooking the monetary cost of large-scale deployment. A naive fix is to consider cheaper LLMs and route each instance (i.e., question and table pair) to an appropriate model to maximize accuracy under a fixed budget. A typical LLM routing paradigm is predict-then-optimize [7]–[9], which learns per-instance answer quality and cost predictions for candidate LLMs using the training set (e.g., thousands of instances), and then solves a constraint optimization problem to derive the routing policy. However, it is impractical for semi-structured table QA, where limited training set (e.g., tens of instances) [10] makes predictions unreliable [11]. The prediction errors then propagate to optimization, yielding routing policies that neither satisfy the budget nor achieve good accuracy. Consequently, we must address C4: How to select an LLM for each instance, aiming to maximize accuracy under a fixed budget, given only limited training data?

Our Contributions. We introduce SemiBonsai, a Cost-Effective, LLM-powered framework designed for Numerical Semi-Structured Table QA. SemiBonsai integrates a traceable pipeline with a routing mechanism, as shown in Fig. 2.

• Multiway Layered Table Structurer (§III). To address C1, we propose a method that converts the table into a Multiway Layered Tree organized by structural elements, enabling more accurate table structure understanding.

• Context-Aware Uncertainty Resolver (§IV). To address C2, we frame phrase grounding as an Extended Steiner Tree Problem, and use context-aware pruning to jointly select a minimal, context-coherent set of structural elements to ground underspecified phrases and rewrite the question.

• Plan–Guided Reasoner (§V). To address C3, we introduce the Operand-based and Operator-based decomposition strategies, to translate a complex query intent into a query plan organized by a set of interdependent subintents. Guided by this plan, it grounds each subintent to the required values and composes an executable reasoning program, enabling robust support for complex intents.

• Budget-Aware Bandit Router (§VI). To address C4, we reformulate the budget-constrained routing objective into an unconstrained Lagrangian surrogate objective. Building on it, we propose a two-stage LLM routing strategy that (i) uses a contextual bandit algorithm to learn per-instance utility scores for candidate LLMs, and (ii) enforces the global budget constraint by selecting the LLM and adaptively updating the cost penalty during execution, which makes the routing effective even with limited training data.

Figure

Fig. 2: Overview of SemiBonsai, containing a traceable QA pipeline QA, and a cost-effective router 11.

• Experimental Evaluation (§VII). Experiments on three benchmarks show that SemiBonsai improves both QA effectiveness and cost-effectiveness. Notably, the Table Structurer improves answer accuracy by 46% over alternative tree construction methods, and the Router achieves a 5% average relative gain in answer accuracy over existing routing approaches across monetary constraints.

TypeMethodAccurate table structure understandingQuestion uncertainty resolutionComplex query intent interpretation
Multiple subtablesHierarchical column headersHierarchical row headersCapability 2^{2}
Prompt-based 1^{1}TableLlama [5]✕✓✓✕✕✕
Code-drivenTABFORMER [12]✕✓✓✕✕✕
E5 [13]✕✓✓★★★★★★
Representation-drivenST-Raptor [6]✓✓✕✕✕✕
TreeThinker [3]✕✓✓★★★★★★
GraphOTTER [14]✕✓✓★★★★★★
Hybrid 3^{3}SemiBonsai✓✓✓★★★★★★★★★

1^{1} We omit general-purpose foundation LLMs, as they are not tailored to semi-structured table QA, while the comparison results can be found in §VII.

2^{2} More ⋆\star indicates stronger capability, based on the performance on our evaluation subsets requiring the corresponding capability (§VII-B - VII-C).

3^{3} We call it hybrid, as it contains structure modeling (as in representation-driven methods) and program generation (as in code-driven methods).

TABLE I: Comparison of semi-structured table QA methods based on the required capabilities.

References (61)