Physics of Language Models: Part 4.2, Canon Layers at Scale where Synthetic Pretraining Resonates in Reality
HTML
361
8 commits
updated Aug 21, 2026
Author: Zeyuan Allen-Zhu
Repository update: I no longer work at FAIR. This repository has moved to github.com/zhuzeyuan/PhysicsLM4, where all future updates will be maintained.
Welcome to this code repository for the Physics of Language Models series. This repository provides all the resources required to reproduce results from the series' Part 4, as well as relevant contributions from Parts 1, 3.1, and 3.3. Below, we describe the key components of this release.
data-synthetic-pretrain and data-reallife-evalThe synthetic pretraining playground includes the Depo, Brevo, Capo, Mano, and Lano datasets introduced in Physics of Language Models: Part 4.1 — Architecture Design and the Magic of Canon Layers. Three are trivial to reimplement; the remaining two are provided here:
The real-life experiments in Part 4.1 also used the following evaluation tasks:
huggingface and huggingface_linearHuggingface-style models that add Canon layer supports, as highlighted in Physics of Language Models: Part 4.1:
huggingface)huggingface_linear)lingua_modifiedA modified version of Meta’s Lingua codebase which is optimized for efficient pretraining. Key modifications include:
LlamaCanon model (bonus: a load_from_lingua_state method for seamless loading of Lingua state_dicts).cd lingua_modified
python -m lingua.stool script=apps.main.train nodes=1 config=apps/main/configs/canon_1B.yaml account=<bla> qos=<bla>
cd lingua_modified
python -m lingua.stool script=apps.gla.train nodes=1 config=apps/gla/configs/gla5_1B.yaml account=<bla> qos=<bla>
python -m lingua.stool script=apps.gla.train nodes=1 config=apps/gla/configs/gdn2_1B.yaml account=<bla> qos=<bla>
python -m lingua.stool script=apps.gla.train nodes=1 config=apps/gla/configs/mamba2_1B.yaml account=<bla> qos=<bla>
canon_llama_recipesComprehensive training recipes (YAML files) for reproducing our 16 released Llama/LlamaCanon model weights on Hugging Face.
canon_llama_resultsComplete evaluation results for the 16 released Llama models:
Strong controlled experiments to highlight the benefits of Canon layers by comparing Llama vs. LlamaCanon in real-world pretraining settings.
Includes interactive training-time charts for benchmarks like MMLU.
Benchmarks our models against other open-source models, demonstrating that we have conducted evaluations in a realistic pretraining setup rather than relying on artificial scenarios.
canon_linear_recipesComprehensive training recipes (YAML files) for reproducing our 48 linear model weights (GLA5/GDN2/Mamba2 with and without Canon layers).
canon_linear_resultsComplete evaluation results for the 48 linear models vs 18 Llama models.
These results from real-life pretraining may be officially published as part of Physics of Language Models: Part 4.2 if time permits.
If you use this repository in your research, please cite the following:
@inproceedings{Allen2025-canon,
author = {{Allen-Zhu}, Zeyuan},
title = {{Physics of Language Models: Part 4.1, Architecture Design and the Magic of Canon Layers}},
year = {2025},
booktitle = {Proceedings of the 39th Conference on Neural Information Processing Systems},
series = {NeurIPS~'25},
note = {Full version available at \url{https://ssrn.com/abstract=5240330}}
}
@misc{Allen2025-resonate,
title = {{Physics of Language Models: Part 4.2, Canon Layers at Scale where Synthetic Pretraining Resonates in Reality}},
author = {{Allen-Zhu}, Zeyuan},
year = {2025},
url = {https://physics.allen-zhu.com/part-4-architecture-design/part-4-2},
note = {Code released at \url{https://github.com/facebookresearch/PhysicsLM4}},
}
lingua_modified/README.md for details).7 commits
1 commits
HTML
84.4%
Python
15.6%
Physics of Language Models: Part 4.2, Canon Layers at Scale where Synthetic Pretraining Resonates in Reality
HTML
361
8 commits
updated Aug 21, 2026
Author: Zeyuan Allen-Zhu
Repository update: I no longer work at FAIR. This repository has moved to github.com/zhuzeyuan/PhysicsLM4, where all future updates will be maintained.
Welcome to this code repository for the Physics of Language Models series. This repository provides all the resources required to reproduce results from the series' Part 4, as well as relevant contributions from Parts 1, 3.1, and 3.3. Below, we describe the key components of this release.
data-synthetic-pretrain and data-reallife-evalThe synthetic pretraining playground includes the Depo, Brevo, Capo, Mano, and Lano datasets introduced in Physics of Language Models: Part 4.1 — Architecture Design and the Magic of Canon Layers. Three are trivial to reimplement; the remaining two are provided here:
The real-life experiments in Part 4.1 also used the following evaluation tasks:
huggingface and huggingface_linearHuggingface-style models that add Canon layer supports, as highlighted in Physics of Language Models: Part 4.1:
huggingface)huggingface_linear)lingua_modifiedA modified version of Meta’s Lingua codebase which is optimized for efficient pretraining. Key modifications include:
LlamaCanon model (bonus: a load_from_lingua_state method for seamless loading of Lingua state_dicts).cd lingua_modified
python -m lingua.stool script=apps.main.train nodes=1 config=apps/main/configs/canon_1B.yaml account=<bla> qos=<bla>
cd lingua_modified
python -m lingua.stool script=apps.gla.train nodes=1 config=apps/gla/configs/gla5_1B.yaml account=<bla> qos=<bla>
python -m lingua.stool script=apps.gla.train nodes=1 config=apps/gla/configs/gdn2_1B.yaml account=<bla> qos=<bla>
python -m lingua.stool script=apps.gla.train nodes=1 config=apps/gla/configs/mamba2_1B.yaml account=<bla> qos=<bla>
canon_llama_recipesComprehensive training recipes (YAML files) for reproducing our 16 released Llama/LlamaCanon model weights on Hugging Face.
canon_llama_resultsComplete evaluation results for the 16 released Llama models:
Strong controlled experiments to highlight the benefits of Canon layers by comparing Llama vs. LlamaCanon in real-world pretraining settings.
Includes interactive training-time charts for benchmarks like MMLU.
Benchmarks our models against other open-source models, demonstrating that we have conducted evaluations in a realistic pretraining setup rather than relying on artificial scenarios.
canon_linear_recipesComprehensive training recipes (YAML files) for reproducing our 48 linear model weights (GLA5/GDN2/Mamba2 with and without Canon layers).
canon_linear_resultsComplete evaluation results for the 48 linear models vs 18 Llama models.
These results from real-life pretraining may be officially published as part of Physics of Language Models: Part 4.2 if time permits.
If you use this repository in your research, please cite the following:
@inproceedings{Allen2025-canon,
author = {{Allen-Zhu}, Zeyuan},
title = {{Physics of Language Models: Part 4.1, Architecture Design and the Magic of Canon Layers}},
year = {2025},
booktitle = {Proceedings of the 39th Conference on Neural Information Processing Systems},
series = {NeurIPS~'25},
note = {Full version available at \url{https://ssrn.com/abstract=5240330}}
}
@misc{Allen2025-resonate,
title = {{Physics of Language Models: Part 4.2, Canon Layers at Scale where Synthetic Pretraining Resonates in Reality}},
author = {{Allen-Zhu}, Zeyuan},
year = {2025},
url = {https://physics.allen-zhu.com/part-4-architecture-design/part-4-2},
note = {Code released at \url{https://github.com/facebookresearch/PhysicsLM4}},
}
lingua_modified/README.md for details).7 commits
1 commits
HTML
84.4%
Python
15.6%