OpenArch README

The project's README from github.com/anuj0456/OpenArch. As one markdown file: README.md.

OpenArch

Python 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.

Why this repo?

Modern LLM architectures share a common skeleton but differ in dozens of small, important choices:

Reading the official model code can be hard because production repos optimize for speed, sharding, and backward compatibility. This repo optimizes for reading.

What's implemented (so far)

Implementations marked ✅ are usable for forward passes; those marked 🚧 are under construction.

Modality Model Status Model Size Normalization Positional Encoding Attention Mixture of Experts
Text GPT-2 XL ✅ 1.5B - Absolute Multihead Attention No
Llama 2 ✅ 7B RMS Norm RoPE Multihead Attention No
Llama 3 ✅ 8B RMS Norm RoPE Grouped Query Attention No
OLMo 2 ✅ 7B RMS Norm & QK-Norm RoPE Multihead Attention No
DeepSeek R1 ✅ 671B RMS Norm & QK-Norm RoPE Multihead Latent Attention Yes
Gemma 3 ✅ 27B RMS Norm & QK-Norm RoPE Grouped Query Attention with Sliding Window No
Mistral 3 ✅ 24B RMS Norm RoPE Grouped Query Attention with Sliding Window No
Llama 4 Maverick ✅ 400B RMS Norm RoPE Grouped Query Attention Yes
Qwen 3 ✅ 4B RMS Norm & QK-Norm RoPE Grouped Query Attention No
30B-A3B RMS Norm & QK-Norm RoPE Grouped Query Attention Yes
Kimi K2 ✅ 1T RMS Norm RoPE Multihead Latent Attention Yes
GLM 4.5 ✅ 355B RMS Norm & QK-Norm RoPE Grouped Query Attention & Multi-Token Prediction Yes
GPT-OSS ✅ 20B RMS Norm RoPE Grouped Query Attention with Sliding Window Yes
Grok-2.5 ✅ 270B RMS Norm RoPE Grouped Query Attention Yes
Qwen3 Next 🚧 80B-A3B RMS Norm RoPE Gated Attention Yes
Multimodal PaliGemma ✅ 3B RMS Norm RoPE Multihead Attention No
Qwen3-VL 🚧 3B RMS Norm RoPE Multihead Attention No
Image Dall-e 🚧 - - - Transformer -

The full target list mirrors the 103 architectures in the Architecture Gallery. Contributions toward any of them are welcome.

Repository layout

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.

Contributing

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:

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.

Acknowledgements

This repository would not exist without the work of two outstanding educators:

Any errors in the implementations here are entirely my own.

License

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.

Disclaimer

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.

OpenArch (anuj0456/OpenArch)

Searching Database…

Что это такое?Набор написанных вручную реализаций на PyTorch современных open-source архитектур LLM (Llama, Qwen, DeepSeek, Gemma, GPT-OSS, Kimi и другие), созданных с нуля для читаемости и обучения.
Это библиотека, на основе которой можно строить своё, или коллекция кода для чтения?Учебный материал, а не production-библиотека: одна читаемая папка на архитектуру, где решения по дизайну — тип внимания, нормализация и роутинг в MoE — явно показаны и легко сравниваются бок о бок.
Как получить код и начать изучать модель?Склонируйте репозиторий и откройте папку модели: каждая архитектура лежит в своей папке с файлом model.py и коротким README, где описаны принятые решения и ссылки на источники.
Что нужно установить, чтобы запустить одну из этих моделей?Python и PyTorch: каждая архитектура — это один написанный вручную файл модели на PyTorch, который можно открыть и запустить; других зависимостей в репозитории не указано.
Можно ли с её помощью обучать модели или только запускать их?Это материал для чтения и запуска, а не production-код: записи с пометкой ✅ поддерживают forward-проход, записи с пометкой 🚧 ещё в разработке, а в README production-пользователей направляют к официальным реализациям или transformers.
Могу ли я свободно использовать код в своих проектах?Open source — в README указана Apache License 2.0 (в метаданных GitHub значится MIT), а отдельные реализации моделей подчиняются лицензиям оригинальных моделей, где это применимо.
Зачем переопределять эти модели, вместо того чтобы читать официальный код моделей?Production-репозитории оптимизированы под скорость, шардирование и обратную совместимость, из-за чего их трудно читать. OpenArch оптимизирован под чтение, поэтому ключевые архитектурные решения наглядны и их удобно сравнивать бок о бок.
Насколько большие модели здесь рассматриваются?От GPT-2 XL на 1,5 млрд параметров до Kimi K2 на 1 трлн, включая DeepSeek R1 (671B) и Llama 4 Maverick (400B). Репозиторий реализует архитектуры, но не содержит весов.
Проект завершён?Нет — из 103 архитектур в галерее Расчки реализовано пока 18, три записи всё ещё помечены как «в разработке», и автор активно ищет контрибьюторов.
Creator
anuj0456
Size
0.1 MB
Stars
426
Updated
CommitSep 26
Age
4mo
Commits · 90 Days