Grammar induction pretraining for language modeling in low resource contexts

Xuanda Chen, Eva Portelance2023

Abstract

In the context of the BabyLM challenge, we present a language model which uses pretrained embeddings from a grammar induction model as its first layer. We compare it to one of the challenge's baseline models and a minimally different baseline which uses random embeddings. We find that though our model shows improvement over the challenge's baseline, the model with randomly initialized embeddings performs equally well. Our results suggest that it is not the pretrained embeddings which aided performance, but likely our tokenizer and choice of hyperparameters.

Introduction

Modern Large Language Models (LLMs) typically require trillions of tokens to achieve high performance, a scale far beyond the linguistic exposure of a developing human child. The BabyLM Challenge addresses this discrepancy by tasking researchers to develop models capable of learning robust linguistic representations from a developmentally plausible dataset of approximately 10 million words.

This paper investigates whether providing a model with an explicit "inductive bias" toward syntax can improve performance in such data-constrained environments. We hypothesized that structural knowledge captured by a grammar induction model could be transferred to a standard Transformer architecture, providing a superior starting point for understanding hierarchical language structures.

Methodology

Our approach utilizes a two-stage pipeline designed to bridge unsupervised grammar learning and standard autoregressive language modeling.

1. Grammar Induction

We first trained a compound-PCFG (Probabilistic Context-Free Grammar) model. This unsupervised model attempts to induce the underlying hierarchical structure of sentences without human-labeled data.

Example of a hierarchical parse tree generated by the grammar induction model.

From this trained PCFG, we extracted "terminal embeddings"—the vector representations the model learned for individual words based on their structural roles. Due to the high memory requirements of grammar induction, this stage was trained on a 1M word subset of the BabyLM data.

2. Language Model Pretraining

We used the induced grammar embeddings to initialize the embedding layer of an OPT-125m-like Transformer. The model was then trained on the full 10M word BabyLM dataset for next-token prediction. To isolate the impact of the grammar embeddings, we compared this model against two controls:

  • The Official Baseline: The standard OPT-125m model provided by the BabyLM organizers.
  • Baseline-token: A model identical to our grammar-initialized model in architecture, tokenizer, and hyperparameters, but utilizing randomly initialized embeddings.

Experimental Results

Models were evaluated across several linguistic benchmarks, including BLiMP (minimal pairs), SuperGLUE (language understanding), and MSGS (generalization patterns).

Performance comparison across major benchmarks showing the grammar model vs. baselines.

Key Findings

  • The Parity of Randomness: The most striking result was the near-identical performance between the "grammar" model and the "baseline-token" model. On SuperGLUE, the grammar model achieved 67.93 compared to the baseline-token's 68.21. On BLiMP, they scored 64.44 and 64.78, respectively. This suggests that the specific syntactic information from the PCFG provided no measurable benefit over random initialization.
  • The Impact of Tokenization: Both custom models significantly outperformed the official BabyLM baseline on SuperGLUE (63.38). Because the only difference between the "baseline-token" and the official baseline was the tokenizer and hyperparameter configuration, we conclude that these factors, rather than syntactic pretraining, were the primary drivers of improvement.
  • Generalization Trade-offs: Interestingly, the official baseline performed best on the MSGS benchmark (69.22), suggesting that our custom configurations might have introduced different generalization biases.

Discussion and Limitations

Our results indicate that simply copying an embedding layer may be too shallow a method to transfer complex, hierarchical rules from a grammar induction model into a Transformer. The "grammar induction" step did not add measurable value over a well-tuned standard training setup.

Several limitations may have influenced these outcomes. The grammar induction model was limited to 10% of the training data due to computational constraints, and the tokenizer was restricted to a 10,000-word vocabulary to maintain compatibility with previous grammar research. Future work should explore more integrated architectural changes, such as conditioning the Transformer's hidden states on the non-terminal syntactic rules predicted by the grammar model, rather than relying solely on embedding initialization.

Summary updated

BibTeX
@misc{chen2023grammar,
  author = {Xuanda Chen and Eva Portelance},
  title = {{Grammar induction pretraining for language modeling in low resource contexts}},
  year = {2023},
  doi = {10.18653/v1/2023.conll-babylm.5},
}
Figure