facebookresearch/PhysicsLM4
Physics of Language Models: Part 4.2, Canon Layers at Scale where Synthetic Pretraining Resonates in Reality
What it solves
This project provides the research code and data for the Physics of Language Models series, specifically focusing on the design of "Canon layers" to improve the architecture of Large Language Models (LLMs). It aims to bridge the gap between synthetic pretraining experiments and real-world performance, demonstrating how specific architectural changes can enhance model capacity and knowledge storage.
How it works
The repository implements several key architectural modifications and provides the tools to reproduce their results:
- Canon Layers: Implements "Canon-ABCD" and "Canon-AbCD" layers for both Transformer-based models (like Llama) and linear models (like GLA, GDN, and Mamba2).
- Model Implementations: Provides Hugging Face-compatible models such as
LlamaCanon, which includes QK-norm and partial RoPE support. - Optimized Training: Uses a modified version of Meta's Lingua codebase for efficient pretraining, incorporating z-loss and other stability improvements.
- Synthetic and Real-life Data: Includes data generators for synthetic datasets (Depo, Brevo, Capo, Mano, Lano) and real-life evaluation benchmarks (multi-hop and Babilong) to test the models' ability to retrieve and store knowledge.
Who it’s for
This is primarily for AI researchers and practitioners interested in the fundamental architecture design of LLMs, scaling laws, and the physics of how models learn hierarchical structures and store knowledge.
Highlights
- Architectural Innovations: Introduces Canon layers to both Transformer and linear models.
- Comprehensive Benchmarks: Provides training recipes and weights for 16 Llama-based models and 48 linear models.
- Crossover Validation: Validates synthetic pretraining findings in real-world pretraining settings.
- Integration: Seamlessly integrates with Hugging Face and Meta's Lingua framework.
Related
- Project
- Project
- Project
- Project
- Project