potentialpaper

Unraveling Syntax: How Language Models Learn Context-Free Grammars

Laura Ying Schulz, Daniel Mitropolsky, Tomaso Poggio

ICLR 2026 submission

Edit this page

Or clone it with git

The page gets its repository with its first edit, so start in the web editor.

Or let your agent set it up

It checks and sets up everything: signing in, git, the clone, credentials and an SSH key.

Abstract. We introduce a new approach to understanding how language models acquire syntax. While large models achieve impressive results, little is known about their learning dynamics. Our approach starts with the observation that most domains of interest -- such as natural language syntax, coding languages, arithmetic problems -- are captured by context-free grammars (CFGs). In this work we initiate the study of how language modeling for CFGs behaves with respect to the substructure of CFGs, namely the notion of a ``subgrammar". We define subgrammars, and prove a suite of fundamental results showing that the loss of language modeling obeys recurrences with respect to subgrammars. We show empirically that small transformers learn subgrammars in parallel, unlike children-- who first master simple substructures before progressing to more complex constructions. We further explore whether curriculum learning using an inductive bias, by pretraining on a subgrammar, can improve performance, and use alignment analysis to show definitively that such pre-training results in internal representations that are more aligned with the grammar's substructure. Finally we demonstrate that models struggle with deeper recursive structures (a limitation even of large language models), revealing fundamental challenges in how neural networks represent hierarchical syntax.

Are you an author? Claim this paper to see who's reading it, with views and other statistics, and to write about it here.

Claim this paper
How does this paper connect to your work? Write how you built on it, compared with it or reproduced it, or add a summary, a critique or errata.
Or make it interactive:
Start writing

add · history

No versions are recorded yet: its preprint, the venues it went to and what they decided, the camera-ready. Missing a version?

We don't know of a submission of this paper to a venue with open reviews. Missing a submission?

Loading the discussion…