Consistency Regularization Training for Compositional Generalization

Yongjing Yin, Jiali Zeng, Yafu Li, Fandong Meng, Jie Zhou, Yue Zhang

Introduction: The Compositional Gap

Humans possess a remarkable ability for compositional generalization: once we understand the meaning of "the book" and the phrase "he likes," we can immediately comprehend "the book he likes," even if we have never encountered that specific combination. In contrast, standard neural networks, including Transformers, often struggle with this. They tend to overfit to specific training patterns and fail when faced with novel combinations of familiar components.

While previous research has focused on developing complex, specialized architectures to solve this, this paper explores a different question: Can we achieve compositional generalization simply by improving how we train standard models? The authors propose Consistency Regularization (CReg), a training strategy that encourages models to learn more robust and invariant representations.

Methodology: The CReg Framework

The CReg framework introduces two primary regularization terms that are applied during training but do not add any overhead during inference. These terms force the model to maintain internal and external consistency.

The CReg framework: (Left) Input grouping by token type. (Middle) Representation and Prediction consistency mechanisms. (Right) Visualization of contextualized representations being pulled together.
  1. Representation Consistency: This ensures that a specific token (e.g., "book") maintains a similar internal representation across different contexts (e.g., "write a book" vs. "the book he likes"). Using contrastive learning, the model is trained to "pull" representations of the same token closer together in the embedding space while "pushing" different tokens apart.
  2. Prediction Consistency: Standard models use dropout during training, which introduces internal noise. CReg forces the model to be "self-consistent" by passing the same input through the model twice with different dropout masks and minimizing the divergence between the resulting output distributions.

Key Insights and Efficiency

A significant finding of this work is that architecture is not the only bottleneck for generalization. Standard Transformers are highly capable but require better guidance to avoid "internal inconsistency."

Furthermore, the authors address the "Validation Saturation" problem. On many compositional benchmarks, models reach 100% accuracy on standard validation sets very quickly, making it difficult to predict which model will generalize best to difficult test sets. The researchers discovered that prediction consistency scores on simple validation data correlate strongly with actual generalization performance on hard test sets, providing a new metric for model selection.

Experimental Results

The CReg method was evaluated across four major benchmarks, including COGS, CFQ, and machine translation tasks (CoGnition and OPUS).

Performance comparison of standard Transformer (TF) vs. TF+CReg on CFQ (Accuracy) and CoGnition (CTER) across varying data sizes.

As shown in the results, CReg significantly outperforms the baseline across all data scales. Notably, the method provides substantial efficiency gains. On the CFQ dataset, the consistency-regularized model achieved 18% accuracy with only 1,200 training samples, a scenario where the baseline model failed to learn at all. In machine translation (CoGnition), CReg reduced the Aggregate Compound Translation Error Rate from 62.9% to 48.3%, demonstrating a superior ability to handle novel word combinations.

Conclusion

Consistency Regularization demonstrates that significant leaps in compositional generalization can be achieved without abandoning standard Transformer architectures. By enforcing representation and prediction stability, CReg helps models move beyond simple pattern memorization toward a more human-like understanding of language structure. Future work may explore adaptive consistency, where regularization is tuned based on the semantic stability of specific token types.

Summary updated

BibTeX
@inproceedings{yin2023consistency,
  author = {Yongjing Yin and Jiali Zeng and Yafu Li and Fandong Meng and Jie Zhou and Yue Zhang},
  title = {{Consistency Regularization Training for Compositional Generalization}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.72},
}
Figure