OpenArch launches PyTorch repo for readable LLM architecture implementations
A new open-source repository named OpenArch has been released, offering hand-written PyTorch implementations of modern large language model architectures. The project aims to provide clarity and educational value rather than production performance, targeting the 72 architectures cataloged in Sebastian Raschka's LLM Architecture Gallery. Each model is implemented in a single, readable file to…
Key points
- OpenArch provides hand-written PyTorch code for 72 LLM architectures, prioritizing readability over production speed.
- The repository covers models like Llama 3, Qwen 3, and DeepSeek V3, with some implementations ready for forward passes.
- The project is Apache 2.0 licensed and actively seeks contributors to implement missing models and add documentation.
The repository includes implementations for models such as GPT-2, Llama 3, Qwen 3, Grok 2.5, and DeepSeek V3, with some marked as complete for forward passes and others under construction. It explicitly states that it does not compete with production libraries like Hugging Face Transformers, which are optimized for speed and sharding. Instead, OpenArch prioritizes readability for developers and researchers who want to deepen their understanding of how modern LLMs are built from scratch.
The project is licensed under Apache License 2.0 and actively seeks contributions. Contributors are encouraged to implement missing models, document architectural choices, or add forward-pass tests. The initiative credits Sebastian Raschka and Machine Learning Mastery for their educational resources, which serve as the primary references for the implementations.
OpenArch – PyTorch implementations of modern LLM architectures
github.com · 14 September 2026Python implementations of modern open-source LLM architectures — written from scratch, one model at a time.
This repository contains hand-written PyTorch implementations of the model architectures cataloged in Sebastian Raschka's LLM Architecture Gallery. Each model is implemented to the best of my knowledge from the original papers, technical reports, reference config.json files, and the excellent writeups by Sebastian Raschka and Machine Learning Mastery.
The goal is not to compete with transformers or other production libraries. The goal is clarity and learning: a single readable file per architecture, with the structural choices (attention type, normalization, layer mix, MoE routing, positional encoding) made explicit and easy to compare side-by-side.
Modern LLM architectures share a common skeleton but differ in dozens of small, important choices:
- Attention: MHA, GQA, MQA, MLA, sliding-window, linear/DeltaNet hybrids
- Normalization: pre-norm, post-norm, QK-Norm, sandwich norm, RMSNorm
- Positional encodings: RoPE, NoPE, partial RoPE, YaRN
- Decoder type: dense vs sparse MoE (with or without shared experts), hybrid Mamba/attention
- Training-time tricks: Multi-token-prediction, latent experts, gated attention
Reading the official model code can be hard because production repos optimize for speed, sharding, and backward compatibility. This repo optimizes for reading.
Implementations marked ✅ are usable for forward passes; those marked 🚧 are under construction.
The full target list mirrors the 72 architectures in the Architecture Gallery. Contributions toward any of them are welcome.
OpenArch/
├── text/
│ ├── gpt2/
│ │ ├── model.py
│ │ └── README.md
│ ├── llama3/
│ ├── qwen3/
| ├── grok2.5/
│ └── deepseek_v3/
├── multimodal/
│ └── pali-gemma/
│ ├── model.py
│ └── README.md
├── README.md
└── requirements.txt
Each model lives in its own folder with respective model.py and a short README.md describing the architectural choices and references used.
I am actively looking for contributors. If you enjoy reading model papers, comparing config.json files, or just want to deepen your understanding of how modern LLMs are built, this is a friendly place to start.
Good first contributions:
- Pick an unimplemented model from the gallery and add a
model.pyfor it - Add a
README.mdfor an existing model documenting its architectural choices - Add a forward-pass test that loads the official weights and matches outputs on a few tokens
- Fix bugs, improve docstrings, or refactor shared components
Please open an issue before starting a large piece of work so we can avoid duplicating effort. Implementations should prioritize readability over performance — this is a learning resource first.
See CONTRIBUTING.md for more details.
This repository would not exist without the work of two outstanding educators:
- Sebastian Raschka — for the LLM Architecture Gallery, the Big LLM Architecture Comparison series, and the LLMs From Scratch book and codebase. The architecture diagrams, fact sheets, and side-by-side comparisons in the gallery are the primary reference behind every model in this repo.
- Jason Brownlee and the team at Machine Learning Mastery — for years of clear, accessible tutorials that have helped countless practitioners (myself included) build a working understanding of deep learning and transformer architectures from the ground up.
Any errors in the implementations here are entirely my own.
This project is licensed under the Apache License 2.0 — see LICENSE for details. Individual model implementations follow the licenses of the original models where applicable; see each model's folder for specifics.
These implementations are written to the best of my knowledge based on publicly available papers, technical reports, configuration files, and educational material. They are intended as a learning resource and are not affiliated with or endorsed by the original model authors. For production use, please use the official implementations or transformers.
This text was published by github.com . It is reproduced here with attribution so you can read it in full; the rights remain with the publisher. Read it at the source ↗
Coverage and discussion
1 source- Hacker News discussion · 43 points news.ycombinator.com
The headline, key points and digest above were generated by Digest AI's editorial model from the linked sources. Automated summaries can contain errors: the sources are the record. Spotted a mistake? Tell us.
More in Research
All →- Fields Medalists Sign Letter Criticizing OpenAI Over Math Proof Attribution · 3 src
- R2VC Boosts Fact‑Checking Accuracy by 13.74% on FEVER Using Modular Retrieval and Calibration · 1 src
- Study Finds Deictic Ambiguity Can Undermine Draft‑Verify‑Revise LLM Pipelines · 1 src
- New GLARE model improves meeting continuation forecasting on MDFB benchmark · 1 src
- Chopthin-Consensus Power Sampling Boosts LLM Reasoning Accuracy Without Retraining · 1 src
Comments
via GitHub Discussions