# OpenArch: Hand-Written PyTorch Implementations of 72 Modern LLM Architectures for Learning

Original title: OpenArch – PyTorch implementations of modern LLM architectures

> Hacker News story 49693384 · language: en · submitted 2026-09-14
> Web version: https://zeli.app/story/49693384
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 139 · by [anuj0456](<https://news.ycombinator.com/user?id=anuj0456>) · 💬 32
[original](<https://github.com/anuj0456/OpenArch>) · [HN discussion](<https://news.ycombinator.com/item?id=49693384>)

## Summary

OpenArch is a GitHub repository with from-scratch PyTorch implementations of modern open-source LLM architectures like Llama, Qwen, DeepSeek, Gemma, GPT-OSS, and Kimi. Based on Sebastian Raschka's LLM Architecture Gallery, each model gets a single readable file that makes design choices—attention, normalization, MoE routing, positional encoding—explicit for side-by-side comparison. The goal is clarity and learning, not production performance. Contributions are welcome.

## Key quote

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

## HN discussion (32 comments)

### [anuj0456](<https://news.ycombinator.com/item?id=49693385>)

> I have been studying modern LLM architectures and started implementing them from scratch in PyTorch to better understand the design choices behind each model.
>
> OpenArch is a collection of these implementations, including Llama, Qwen, DeepSeek, Gemma, Kimi, GPT-OSS and others.
>
> The goal is to keep the code readable and useful as a reference when going from the paper to an actual implementation.
>
> Would be interested in feedback from people working on model architecture and training.

### [gfrangakis](<https://news.ycombinator.com/item?id=49703905>)

> Really cool. I know the sauce is in the layers and weights, but its kind of mind blowing how short / simple the implementations are

### [k__](<https://news.ycombinator.com/item?id=49694887>)

> I was yesterday years old when I learned that those open weight models need custom code to run.
>
> Somehow I expected inference engines are generic LLM runtimes that can execute any weight.
>
> So, to get this right.
>
> Someone trains a model.
>
> They release the weights and a reference implementation of the model architecture.
>
> Then a provider has to host this model either by running inference via the reference implementation, an open source implementation, or build their own.
>
> Does this mean, providers don't just differ in quantisation and configuration, but also in inference engine implementation?

### [theGeatZhopa](<https://news.ycombinator.com/item?id=49693515>)

> Hey anuj
>
> This is excellent for understanding. I'm having some trouble to get into understanding - pytorch is for me the RL which is used as gym/training. There I can chose ppo, dnq and other agents to perform some predefined actions in a predefined gym/world.
>
> The repo you are showing - I really have problems to get it into RL understanding of mine. What's the gym? What are the agents. Can it be used to train that models with pytorch?
>
> Sorry for the noob question. Papers are overwhelming my noob brain.

### [swimwiththebeat](<https://news.ycombinator.com/item?id=49698340>)

> This is really cool, great way to reinforce our understanding of model architectures! But how is the author confirming that these model architecture implementations are correct though? I don't see any details in the README.md.

---

## Cite

- Page: https://zeli.app/story/49693384
- Date: 2026-09-14
- Source: github.com (https://github.com/anuj0456/OpenArch)
- Hacker News: https://news.ycombinator.com/item?id=49693384

## Other languages

- zh: https://zeli.app/zh/story/49693384 · markdown: https://zeli.app/zh/story/49693384.md
- ja: https://zeli.app/ja/story/49693384 · markdown: https://zeli.app/ja/story/49693384.md
- ko: https://zeli.app/ko/story/49693384 · markdown: https://zeli.app/ko/story/49693384.md
- de: https://zeli.app/de/story/49693384 · markdown: https://zeli.app/de/story/49693384.md
- es: https://zeli.app/es/story/49693384 · markdown: https://zeli.app/es/story/49693384.md
- ru: https://zeli.app/ru/story/49693384 · markdown: https://zeli.app/ru/story/49693384.md
