# Testing Transformer Learnability on the Arithmetic Sequence of Rooted Trees

DevFeed: [Testing Transformer Learnability on the Arithmetic Sequence of Rooted Trees](<https://devfeed.tech/articles/testing-transformer-learnability-on-the-arithmetic-sequence-of-rooted-trees-99758.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2512.01870>)

Author: Alessandro Breccia, Federica Gerace, Marco Lippi, Gabriele Sicuro, Pierluigi Contucci

Published: 2026-10-26T04:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>)

Topics: [Language models](<https://devfeed.tech/topics/language-models.md>), [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [scaling laws](<https://devfeed.tech/topics/scaling-laws.md>)

Tags: [analysis](<https://devfeed.tech/tags/analysis.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [arithmetic](<https://devfeed.tech/tags/arithmetic.md>), [arxiv](<https://devfeed.tech/tags/arxiv.md>), [cond-mat-dis-nn](<https://devfeed.tech/tags/cond-mat-dis-nn.md>), [context-window](<https://devfeed.tech/tags/context-window.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [dataset](<https://devfeed.tech/tags/dataset.md>), [math-mp](<https://devfeed.tech/tags/math-mp.md>), [math-nt](<https://devfeed.tech/tags/math-nt.md>), [math-ph](<https://devfeed.tech/tags/math-ph.md>), [next-token-prediction](<https://devfeed.tech/tags/next-token-prediction.md>), [order](<https://devfeed.tech/tags/order.md>), [performance](<https://devfeed.tech/tags/performance.md>), [scaling](<https://devfeed.tech/tags/scaling.md>), [sequence](<https://devfeed.tech/tags/sequence.md>), [study](<https://devfeed.tech/tags/study.md>), [synthetic](<https://devfeed.tech/tags/synthetic.md>), [tasks](<https://devfeed.tech/tags/tasks.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>), [text](<https://devfeed.tech/tags/text.md>), [token](<https://devfeed.tech/tags/token.md>), [transformer](<https://devfeed.tech/tags/transformer.md>), [trees](<https://devfeed.tech/tags/trees.md>)

## AI overview

The study reports that a GPT-2 transformer trained on the first 10¹¹ elements of an arithmetic sequence of rooted trees achieved about 0.4 word accuracy on next-token and masked-token prediction, outperforming a Hidden Markov Model baseline. Performance remained stable on test blocks at 10¹³-10¹⁵. The trained model's likelihood also distinguished the sequence from controls preserving token frequencies but not order, with separation increasing with context, and from sequences containing more than three consecutive square-free integers, which the authors describe as arithmetically forbidden. The results suggest the model captures structure beyond token frequencies.

## Source excerpt

arXiv:2512.01870v3 Announce Type: replace Abstract: We study whether a transformer network can learn the deterministic sequence of trees generated by the iterated prime factorization of the natural numbers. Each integer is mapped into a rooted planar tree and the resulting sequence $\mathbb{N}\mathscr{T}$ defines an arithmetic text with measurable statistical structure. A transformer network (the GPT-2 architecture) is trained from scratch on the first $10^{11}$ elements and evaluated on next-token prediction and masked-token prediction tasks, with a Hidden Markov Model as baseline and a scaling analysis over context window, dataset size, vocabulary size and model size. The model reaches a word accuracy of about $0.4$, well above the baseline, and its performance remains stable on test blocks located at $10^{13}$-$10^{15}$, far beyond the training interval. Moreover, the likelihood assigned by the trained model separates the arithmetic text from two controls: synthetic token sequences that preserve the marginal token frequencies but not their order, with a separation that widens with the context, and sequences containing more than three consecutive square-free integers, a configuration that arithmetic forbids. These results indicate that the transformer captures regularities of the arithmetic text that go beyond its frequency profile.