arXiv:2610.26695cs.CLOct 2026

Manuscript Offprint

arXiv:2610.26695

Hierarchical Token Merging with Recursive Autoencoders for Unsupervised Grammar Induction

Murat Guney Kemal, Robert Lieck

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

ABSTRACT

Hierarchical abstraction is a fundamental principle across many data modalities, enabling complex sequences to be represented compositionally at multiple levels. Learning such hierarchies directly from data, without explicit structural supervision, remains a central challenge in representation learning. We investigate whether meaningful hierarchical structure can emerge from compression alone. While autoencoders learn compressed representations through reconstruction, this objective does not necessarily favour meaningful compositional structure. We study this challenge through unsupervised grammar induction, where the underlying hierarchy can be evaluated explicitly. We introduce a hierarchical token-merging autoencoder that recursively combines adjacent tokens into increasingly abstract representations, compressing entire sequences through a variational information bottleneck. The model jointly learns representations and hierarchical structure by marginalising over possible binary trees using dynamic programming. To address training instability, we combine independently trained models through unsupervised consensus and distillation. Experiments on a synthetic, ambiguous grammar demonstrate the emergence of meaningful hierarchical structure without structural supervision. The resulting model achieves 93% grammatical parse-validity and 93% exact reconstruction on held-out sequences, compared with 42% parse-validity for the strongest trivial baseline. These findings establish a proof of concept for hierarchical token merging as a mechanism for unsupervised structure discovery and abstraction learning.

1 INTRODUCTION

Language is compositional, and so are many other kinds of sequence. Small units combine into larger ones hierarchically, and those into larger ones again. Recovering that structure without annotation would be useful, because the treebanks that supervised parsers rely on are expensive to build and specific to one language and domain, and because whether grammatical structure can emerge with no supervision at all is a question of independent scientific interest. The question we study is whether a model can find constituent structure in raw token sequences, with no labelled trees to learn from, with an information bottleneck as the only pressure towards structure.

This is hard for two reasons. First, a plain reconstruction objective is grammar-agnostic. An autoencoder that only has to reproduce its input is rewarded for whatever structure is easiest to reconstruct, which may not be the grammatical one. Second, the structure is a discrete object from a large space, since a sentence of n tokens has exponentially many binary trees; learning the representations and searching that space at the same time is unstable. Models that induce latent trees often do well on their task without recovering structure that matches human annotations (Williams et al., 2018), so reconstructing or predicting well is not the same as parsing well.

We avoid choosing a tree at all. Instead of deciding which pair to merge, the model scores every binary tree at once with an inside chart, a dynamic program that sums over all trees in cubic time, and reads a single parse off the chart only at test time. The merge stays a hard decision, made differentiable with a straight-through estimator. The pressure towards structure comes from the variational bottleneck. We hypothesise that when a whole sentence has to pass through one small vector, merging it along its grammatical constituents has the lowest reconstruction and compression cost, so the model comes to prefer grammatical structure because it compresses well, not because we supervise it. It is never shown a single tree, so it becomes a parser implicitly, as a by-product of learning to compress.

This leads to our research question. Can a token-merging autoencoder induce grammatical structure from raw tokens with no supervision, by scoring all possible trees at once, and if that induction works but is unstable, can the instability be removed without reintroducing supervision?

We make the following contributions.

• We show that a token-merging autoencoder can induce grammatical structure from raw tokens with no supervision, and from a deliberately minimal self-supervision (compression through a variational bottleneck alone, with no outside pass and no reconstruction of words from their context), by marginalising over trees rather than choosing a merge. In the best runs it recovers the grammar with held-out parse-validity of 1.00.

• We show that a single model is unreliable. Its induction is what we call a seed lottery. With identical data and configuration, held-out parse-validity ranges from 0.01 to 1.00 depending only on the random seed, and even the best-parsing models reconstruct poorly, because the tight bottleneck that drives them to find structure also costs them the ability to reproduce their input.

• We find that combining many models at the level of individual constituents (span-based minimum Bayes risk, span-MBR) beats combining whole trees, which matters on ambiguous data where good models disagree over equally valid parses. Shayegh et al. (2024) use the same combination for ensembles of unsupervised parsers; we show it remains effective when the members are runs of one model whose quality ranges from 0.01 to 1.00.

• To make the method robust despite that lottery, we build a pipeline that trains many models, selects the mutually consistent ones, combines them and distils the result into a single model that reaches a mean held-out parse-validity of 0.93 and also reconstructs its input, which no single stage does alone.

• We report a seven-pool robustness study, varying both the random seed and the data split, showing that unsupervised selection mainly raises the weakest pools rather than improving every pool.

• We find that, under the training schedules we tested, a single model does not reach both grammar and reconstruction, because the two objectives compete for its capacity, so in our setting the two-stage separation of induction from reconstruction is necessary rather than merely convenient.

• We find that the two stages learn the grammar differently. The chart-trained base model, under the compression bottleneck, organises its vocabulary by syntactic category as it discovers constituents, whereas the distilled student reaches the same parse accuracy without clustering its word embeddings by category, so category structure is a by-product of how structure is induced, not a prerequisite for parsing.

Two caveats bound these claims, and Section 4.8 takes up both in full. The reported results are a distribution over independently seeded pools rather than a single number, and one hyperparameter, the number of models retained, was chosen with knowledge of gold-scored results. Gold trees, by contrast, are used only to evaluate the final model, never in training, model selection, or the combination of the models' parses (the consensus).

Section 2 places the method among grammar induction, chart-based marginalisation and neural latent-tree models. Section 3 describes the autoencoder, the chart, and the pipeline that turns many models into one. Section 4 presents the experiments, the aggregation choice, the seed lottery, the combiner, the seven-pool result and what the latent space encodes, and closes with the limitations and future work. Section 5 answers the research question.

References (25)