Introduction
Answering complex questions over hybrid data sources—such as financial reports containing both structured tables and unstructured text—requires "discrete reasoning." This process involves not just retrieving information, but performing arithmetic (addition, percentages), sorting, or counting across disparate data formats.
Existing approaches to this problem generally fall into two categories: Mixture-of-Experts (MoE) models and Semantic Parsing (SP). MoE models utilize specialized heads for different mathematical operations but often struggle with multi-step reasoning and lack transparency. Conversely, SP models translate questions into executable code (e.g., SQL), providing interpretability; however, they typically focus on a single data type and require expensive, human-labeled step-by-step derivations for training.
UniRPG (Unified Reasoning as Program Generation) addresses these limitations by treating reasoning as a unified program generation task. It bridges the gap between structured and unstructured data while utilizing a distant supervision strategy to learn from data where explicit reasoning steps are missing.
Methodology
UniRPG consists of three core components: a structure-aware reader, a neural programmer, and a symbolic executor.
Structure-Aware Knowledge Reader
To process hybrid inputs, UniRPG employs a modified BART encoder. While tables are flattened into sequences for the transformer, a custom attention mask preserves the 2D logic of the spreadsheet. In the lower layers of the encoder, cells are restricted to attending to others within the same row. In higher layers, the model integrates column-wise information. This hierarchical approach allows the model to capture the structural dependencies inherent in tabular data.
Neural Programmer and Constraint Decoding
The programmer component generates a symbolic program by selecting from 15 predefined operations, such as SUM, DIFF, COUNT, and ARGMAX. It utilizes a copy mechanism to point to specific numbers or text spans within the input to serve as arguments for these operations.
To ensure the validity of the generated programs, UniRPG implements Constraint Decoding. This system enforces strict grammatical rules during the generation process—for instance, ensuring a DIFF operation always receives exactly two numerical arguments and preventing logical errors like an end-index appearing before a start-index.
Distant Supervision via Pseudo-Programs
A significant challenge in training semantic parsers is the lack of "gold" programs in existing datasets. UniRPG overcomes this using Distant Supervision. The authors developed a template library to automatically search for potential programs that yield the correct ground-truth answer. These "pseudo-programs" are then used for training, supported by a re-weighting strategy designed to filter out noisy or coincidental derivations.
Experimental Results
UniRPG was evaluated on two major benchmarks: TAT-QA (financial hybrid data) and DROP (general-purpose text reasoning).
Performance on TAT-QA
On the TAT-QA test set, UniRPG (using a BART-large backbone) achieved 67.1% Exact Match (EM) and 76.0% F1. This represents a substantial 17.0 point EM improvement over the previous state-of-the-art model, TAGOP. Notably, the model trained on automatically generated pseudo-programs performed nearly as well as one trained on human-annotated derivations (a difference of only 1.4 F1 points), demonstrating the effectiveness of the distant supervision strategy.
Performance on DROP
Despite being designed for hybrid data, UniRPG proved competitive on the text-only DROP dataset, achieving 77.08% EM. This suggests that the unified program generation framework is robust across different reasoning contexts.
Analysis and Interpretability
UniRPG offers high interpretability because it outputs a symbolic program rather than a raw number. Analysis of cross-attention scores reveals that the model successfully maps linguistic cues (e.g., "What is the change...") to specific mathematical operations (e.g., DIFF).
However, the authors identified three primary error categories:
- Pointing Errors (62% of errors): The model often selects the wrong cell or text span from long documents.
- Semantic Confusion: The model occasionally relies on keyword matching, such as attempting an
AVGoperation because the word "average" appears in the question, even when the correct logic requires simple division (DIV). - Counting: The model struggles with counting tasks, likely due to the sparsity of counting examples in the training data (representing only 2% of the dataset).
Conclusion
UniRPG demonstrates that a unified, program-based approach to discrete reasoning can significantly outperform specialized mixture-of-experts models. By treating table cells and text spans as interchangeable arguments and leveraging distant supervision, UniRPG provides a scalable and interpretable framework for complex question answering over hybrid data sources.
Summary updated