Abstract
Neural network models often generalize poorly to mismatched domains or distributions. In NLP, this issue arises in particular when models are expected to generalize compositionally, that is, to novel combinations of familiar words and constructions. We investigate learning representations that facilitate transfer learning from one compositional task to another: the representation and the task-specific layers of the models are strategically trained differently on a pre-finetuning task such that they generalize well on mismatched splits that require compositionality. We apply this method to semantic parsing, using three very different datasets, COGS, GeoQuery and SCAN, used alternately as the pre-finetuning and target task. Our method significantly improves compositional generalization over baselines on the test set of the target task, which is held out during fine-tuning. Ablation studies characterize the utility of the major steps in the proposed algorithm and support our hypothesis.
Introduction
Standard neural networks, including state-of-the-art Transformers like T5, frequently fail at compositional generalization (CG). While these models excel at pattern recognition within seen distributions, they struggle to interpret novel combinations of familiar elements. In semantic parsing—the conversion of natural language into formal logic—this manifests as a failure to process longer sentences or familiar words in new syntactic roles.
This research explores whether compositional generalization can be treated as a transferable meta-skill. The authors hypothesize that a model can learn how to generalize on a source dataset and apply this inductive bias to a distinct target task.
Methodology: Dueling Updates for Encoder-decoder Learning (DUEL)
The proposed solution is DUEL, a pre-finetuning algorithm designed to instill compositional inductive biases. Unlike standard multi-task learning that merges data, DUEL exploits the gap between training ($p$) and evaluation ($\tilde{p}$) distributions of a source task.
The algorithm employs an iterative "dueling" process during pre-finetuning:
- Encoder Update: The encoder $f(\cdot; \theta)$ is updated using the evaluation split ($\tilde{p}$) while the decoder $g(\cdot; \phi)$ remains frozen. This forces the encoder to find representations that enable the frozen decoder to succeed on out-of-distribution data.
- Decoder Update: The decoder is updated using the training split ($p$) while the encoder remains frozen.
- Transfer: Post-dueling, the source-task decoder is discarded. The encoder, now optimized for generalization, is retained and fine-tuned on the target task ($q$).
Experimental Setup
The study evaluates DUEL across three semantic parsing benchmarks, each featuring challenging compositional splits:
- COGS: Focuses on lexical and structural shifts (e.g., verb role changes).
- GeoQuery: Real-world questions about US geography.
- SCAN: Navigation commands testing length generalization.
The datasets are used interchangeably as source and target tasks to test the transferability of generalization skills across domains.
Key Results and Insights
DUEL consistently outperforms standard baselines, including models with no pre-finetuning and those trained on merged source data.
- State-of-the-Art Performance: On the GeoQuery TMCD split, DUEL achieved 57.8% accuracy, surpassing previous neuro-symbolic benchmarks.
- Length Generalization: Transferring from SCAN to GeoQuery improved length generalization accuracy from 38.6% to 45.0% for T5-Base.
- Inductive Bias Transfer: The results suggest that the ability to handle distributional shifts is a representation strategy that can be moved between tasks. The effectiveness of DUEL is most pronounced when source and target tasks share similar compositional challenges, such as length constraints.
Conclusion and Future Work
While DUEL significantly advances compositional generalization in neural models, "structural generalization" remains a significant challenge. For instance, improvements on COGS structural splits were marginal, indicating that deeply nested syntactic structures are still difficult for purely neural architectures to master. Future research will focus on extracting stronger structural inductive biases and understanding why certain types of generalization are more resistant to transfer than others.
Summary updated