## 3 Materials and Methods
### Question Answering Method
This log-probability serves as a measure of the model's confidence in its predicted action, where a more negative log-probability indicates a lower likelihood of the _action_ in the given context. Where \(i=1,2,\ldots,n\), given hyper-parameters \(k\) (the maximum number of retained candidates) and \(P_{\text{threshold}}\) (the minimum probability threshold), the formulas are as follows:

\[P(\text{Action})=\sum_{i=1}^{n}e^{\log p_{i}} \tag{1}\]

For all candidate operations, they are sorted according to the probability size, and the top \(k\) operations are selected as the candidate operation set \(\{Action_{0},Action_{0},\ldots,Action_{\text{topK}}\}\). Operations with probabilities lower than the threshold, \(P(\text{Action})<P(\text{threshold})\), are filtered out. The final retained candidate operation set \(A_{\text{final}}\) can be expressed as follows:

\[p_{i}=e^{\log p_{i}}A_{\text{final}}=\{\text{Action}_{j}\mid j\in\text{ Top-K},\,P(\text{Action}\ j)\geq P_{\text{threshold}}\} \tag{2}\]

Figure 2: Example of the operation tree. **Algorithm Complexity Analysis:** The time complexity of the algorithm is \(\mathcal{O}(m(n\log n+k))\), where \(m\) is the number of iterations, \(n\) is the number of candidate actions sampled per iteration, and \(k\) is the number of top \(k\) actions selected. The space complexity of the algorithm is \(\mathcal{O}(n+k+m)\), accounting for storing candidate actions, Top-k actions, and the final action sequence. **Data Retrieval and Selection:** The Retriever, a dynamic example retriever, is used to find appropriate few-shot examples from historical plans, which helps to reduce the probability of operation errors in the current task. The Retriever retrieves the required examples from the vector database based on the embedding of the prompt composed of the sub-table generated after the current operation, the dynamic operation chain, and the task instruction, and provides them to the Worker for execution. This method can significantly reduce errors, especially in complex table operations or scenarios that require dynamic corpus expansion. **Task Execution and Result Generation:** The Worker, an executor, specifically executes each action formulated by the Planner, where each action is a pure function. The Worker performs corresponding operations on the table according to the instructions of each step of the action, such as column addition (add_col), conditional selection (select_where_row), etc., and also supports operations like retrieve_from_repo and query to retrieve the required information from the external real-time knowledge base or the knowledge embedded in the model. During the execution process, the Worker reports the operational results to the Planner for subsequent planning adjustments. Table operations rely on the Python pandas dataframe for operation. ### Knowledge Injection

A knowledge graph constructed by WikiEvents [35] is incorporated as an external knowledge supplement. During the reasoning process, this knowledge graph assumes a pivotal role. When the model processes table data and questions, it initially parses the questions to extract key entities and relationships. For example, if a question pertains to table data related to a historical event, the model will utilize these key pieces of information to conduct searches and matches within the WikiEvents knowledge graph. The nodes in the knowledge graph encapsulate rich entity information, while the edges define various relationships between entities. Through interaction with the knowledge graph, the model can access world knowledge that is not explicitly presented in the table. For instance, when handling a table related to a sports event, if the table merely records the game results, yet the question involves the historical head-to-head data of the participating teams or the past honors of a particular athlete, the knowledge graph can furnish this supplementary information to the model.