Abstract
Natural Language Generation (NLG) from logical forms, known as Logic2Text, is essential for translating structured data into human-readable narratives. While current models achieve high scores on standard benchmarks, they often rely on "shortcuts"—spurious correlations between table headers and logical operators—rather than genuine symbolic reasoning. This paper investigates this lack of robustness by introducing the Logical Counterfactual Data (LCD) benchmark. We propose a structure-aware encoder and a counterfactual data augmentation strategy to mitigate these biases. Our approach significantly improves model robustness and logical consistency, as evidenced by a 30-percentage-point improvement in human evaluations over standard baselines.
Introduction: The Shortcut Problem
The Logic2Text task requires a model to generate a faithful natural language description based on a table and a specific logical form (e.g., "Find the row with the maximum attendance"). Despite the success of large-scale language models like GPT-2 and T5, their performance is often propped up by pattern matching. In many datasets, certain headers (e.g., "attendance") frequently co-occur with specific operators (e.g., argmax for "highest"). Models learn these associations as shortcuts, ignoring the actual logical instructions.
As shown in the figure above, a model might correctly identify the "highest attendance" on a specific date because that pattern is common. However, when presented with a counterfactual sample—such as finding the "latest" game (argmax on date)—the model reverts to its learned bias, hallucinating "highest attendance" instead of following the new logic.
Methodology
To address this lack of robustness, we introduce two primary technical interventions grounded in causal analysis:
1. Structure-Aware Logical Form Encoder
Standard models typically linearize logical forms into flat text strings, which discards the inherent hierarchical tree structure. We introduce a custom attention mask ($M$) that constrains tokens in the logical form to only "attend" to their direct neighbors in the logical graph. This architectural constraint forces the model to respect the hierarchical dependencies of the symbolic logic rather than treating it as a sequence of words.
2. Counterfactual Data Synthesis
To break the model's reliance on biased training data, we automatically generate counterfactual samples. By swapping table headers with others of the same data type (e.g., replacing "attendance" with "assists"), we create a training set where operators and headers are decoupled. Training on this augmented data forces the model to learn the functional relationship between operators and values.
Datasets and Evaluation
We evaluate our approach using three primary datasets:
- Logic2Text: The standard benchmark for table-to-text generation.
- LCD (Logical Counterfactual Data): A new, manually constructed "stress test" containing 809 samples where logical forms use rarely co-occurring headers and operators (e.g.,
argmaxapplied to a "date" column). - Synthetic Counterfactuals: A large-scale dataset created by automated header swapping for training augmentation.
We also introduce BLEC*, an enhanced metric that verifies if the correct table headers are mentioned in the generated text, helping to detect "hallucinated" headers that standard metrics might miss.
Key Results
Our experiments reveal a significant "baseline collapse" on the LCD dataset. Standard GPT-2 and T5 models saw their BLEC* scores drop by over 54% compared to standard test sets, confirming their heavy reliance on shortcuts.
In contrast, our "Full" model (T5 + Structure-Aware Encoder + Data Augmentation) achieved a BLEC* of 59.58 on the LCD dataset, a substantial improvement over the vanilla T5's 41.78. Human validation further confirmed these findings, showing a 30-percentage-point increase in logical consistency on counterfactual samples.
Conclusion
This research demonstrates that current NLG models are prone to learning spurious correlations in structured data tasks. By enforcing structural constraints through graph-based attention and diversifying training data with counterfactual samples, we can move toward models that perform true symbolic reasoning. While synthetic data can slightly impact fluency, the gains in logical faithfulness are a critical step toward reliable natural language generation from structured logic.
Summary updated