NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Compositional Program Generation for Systematic Generalization

Tim Klinger, Qi Liu, Maxwell Crouse, Soham Dan, Parikshit Ram, Alexander G. GrayKBCG @ IJCAI 2023

TL;DR

This paper introduces the Compositional Program Generator (CPG), a neuro-symbolic architecture that tackles the challenge of systematic generalization in sequence-to-sequence tasks. CPG leverages context-free grammars and learned semantic functions to achieve robust generalization, even on complex tasks like COGS and SCAN, outperforming standard neural models.

What Problem Does This Paper Address?

Neural models, particularly transformers, struggle with compositional generalization. This means they often fail to generalize to new combinations of familiar components or to longer sequences than seen during training, even if the underlying structure is simple. This limitation hinders their ability to truly understand and manipulate language in a systematic way. The paper aims to bridge this gap by developing a model that can systematically generalize by explicitly learning compositional semantic functions.

Methods

The core of the proposed approach is the Compositional Program Generator (CPG). CPG is a neuro-symbolic architecture that combines a context-free grammar of the input language with a learned dictionary mapping input tokens to their output interpretations. The model learns to generate type-specific symbolic semantic functions that are composed in an input-dependent manner to produce the output sequence. This process is recursive and bottom-up, mirroring the structure of the input's parse tree. CPG decomposes the problem into:

  1. Specifying a context-free grammar: This defines the structure of the input language.
  2. Learning a parser: This generates a parse tree for the input.
  3. Learning a dictionary: This maps input tokens to their output representations.
  4. Learning type-specific semantic functions: These are the core components that combine to form the final output.

The paper also introduces two types of learned programs: "copy programs" for copying elements and "substitution programs" for replacing placeholders.

Datasets

  • SCAN: Used for evaluating systematic generalization, particularly on the "add jump" split.
  • COGS: A benchmark for compositional generalization, used to test the model's ability to generalize to longer sequences and new combinations.

Key Insights and Ideas

  • Neuro-symbolic approach is key: Combining neural learning with symbolic structures (grammars, semantic functions) appears to be a promising direction for achieving systematic generalization.
  • Decomposition into sub-problems: Breaking down the task into grammar specification, parsing, dictionary learning, and semantic function learning makes the problem more tractable.
  • Type-specific semantic functions: Learning functions tailored to specific grammatical types allows for more robust and interpretable composition.
  • Productivity by definition: The recursive nature of the compositional functions inherently allows for generalization to longer sequences.
  • Curricular training: Training on progressively longer sentences helps the model learn more effectively.

Key Results

  • On the SCAN benchmark, CPG solves all splits and achieves few-shot generalization on the systematicity ("add jump") split.
  • On the COGS benchmark, CPG achieves perfect generalization after training for only two epochs on sentences of length less than 13.

Limitations and Future Work

  • Grammar learning: The current approach assumes the grammar is provided. Future work could explore learning the grammar itself.
  • Dictionary learning complexity: Learning the dictionary for more complex datasets like COGS is more involved than for simpler ones like SCAN.
  • Interpretability: While the approach generates symbolic programs, further work could enhance the interpretability of the learned semantic functions.
  • Broader applicability: While successful on SCAN and COGS, exploring CPG's effectiveness on a wider range of compositional generalization tasks is a natural next step.

Summary updated

BibTeX
@inproceedings{klinger2023compositional,
  author = {Tim Klinger and Qi Liu and Maxwell Crouse and Soham Dan and Parikshit Ram and Alexander G. Gray},
  title = {{Compositional Program Generation for Systematic Generalization}},
  booktitle = {KBCG @ IJCAI},
  year = {2023},
  url = {https://openreview.net/forum?id=Wxj9U0ySU-s},
}
Figure