arXiv:2611.23093cs.CLNov 2026

Manuscript Offprint

arXiv:2611.23093

What's in a Tree ? Hierarchical nn-gram models as controlled approximators of language

Aritra Das, Francesco Cagnetta, Darshil Doshi, Victor V. Albert, Maissam Barkeshli, Andrey Gromov

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Hierarchical models have been proposed as synthetic settings for studying language. However, their relevance to realistic language corpora remains underexplored. In this work, we introduce tree-grams, autoregressive generative nn-gram models that build the conditional probability tensor p(xn∣x1:n−1)p(x_{n}\mid x_{1:n-1}) through a hierarchical composition of order-2 and order-3 tensors. nn controls the maximal context window, whereas a rank hyperparameter dd controls model capacity, yielding an interpretable and systematically scalable family of approximators of language. We show how tree-grams outperform existing nn-gram baselines, while remaining competitive with deep transformer-based language models. We demonstrate the utility of such controlled approximations by using tree-grams as generative models. In particular, we show that hyperparameter transfer under μ\muP can be made more robust when narrower models are tuned on simpler data, generated by tree-grams with moderate nn and dd. In addition, we show that entropy and effective range of correlations control performance gap after fine-tuning. This is because tree-grams allow us to explicitly control horizon and capacity. When allowed to route across candidate topologies, we observe emergent sparsity in tree-grams. Such concentrated routing permits pruning upto 95% of topologies without significant change in performance.

1 Introduction

Language is hypothesized to be hierarchically structured (Chomsky, 1956; Chomsky, 1957; Everaert et al., 2015; Hauser et al., 2002; Goodfellow et al., 2016). Its statistical structure has been studied using classical and modern language models, including Markov-chain and nn-gram models (Shannon, 1951; Brown et al., 1992; Bengio et al., 2003a). Synthetic datasets inspired by context-free gramars (Chomsky, 1956; Hopcroft and Ullman, 1979; Klein and Manning, 2004; Kim et al., 2019) have also been proposed as tractable testbeds to understand language modeling. In particular, (Cagnetta et al., 2024) propose a family of tree-like generative models where a hierarchy of latent nodes determines the probability distribution of the leaves. Tree-like generative models can successfully represent compositional dependencies and improve language modeling (Dyer et al., 2016; Kuncoro et al., 2018); however, learning linguistically meaningful tree structures directly from data remains difficult (Klein and Manning, 2004; Kim et al., 2019; Hewitt and Manning, 2019). It is also important to understand what tree-like properties are present in real data, which can be accomplished by creating trainable versions of such models.

In this work, we propose such a trainable model. In particular, we propose tree-grams, which are hybrid nn-gram models based on hierarchy and local connectivity. Tree-grams combine order-2/order-3 tensor approximation with normalization layers, residual connections, and MLPs to approximate the order-nn transition tensor p(xn∣x1:n−1)p(x_{n}|x_{1:n-1}). The two hyper-parameters nn and dd are independent controls on tree-grams, while nn controls the horizon of the model, dd controls model capacity. A summary of our contributions is provided below.

References (60)