Built GPT-2, Llama 3, and DeepSeek from scratch in PyTorch - open source code + book [p]

Reddit - Machine Learning 1 min read

About this article

I spent the past year implementing five LLM architectures from scratch in PyTorch and wrote a book documenting the process. What's covered: Vanilla encoder-decoder transformer (English to Hindi translation) GPT-2 (124M), loading real OpenAI pretrained weights Llama 3.2-3B, showing the exact 4 component swaps from GPT-2 (RMSNorm, RoPE, SwiGLU, GQA), loading Meta's pretrained weights KV cache mechanics, MQA, GQA DeepSeek: Multi-Head Latent Attention with absorption trick and decoupled RoPE, Dee...

You've been blocked by network security.To continue, log in to your Reddit account or use your developer tokenIf you think you've been blocked by mistake, file a ticket below and we'll look into it.Log in File a ticket

Originally published on April 15, 2026. Curated by AI News.

Related Articles

Llms

Value Realignment is here.

The "value realignment" at the intersection of quantum computing, AI, and robotics feels like a necessary shift. We have spent so much ti...

Reddit - Artificial Intelligence · 1 min ·
Llms

Jailbreaks as social engineering: 5 case studies suggest LLMs inherit human psychological vulnerabilities from training data [D]

Writeup documenting 5 psychological manipulation experiments on LLMs (GPT-4, GPT-4o, Claude 3.5 Sonnet) from 2023-2024. Each case applies...

Reddit - Machine Learning · 1 min ·
Llms

One of the fastest ways to lose trust in a self-hosted LLM: prompt injection compliance

One production problem that feels bigger than people admit: a model looks fine, sounds safe, and then gives away too much the moment some...

Reddit - Artificial Intelligence · 1 min ·
Llms

Comparison of AI code generation: looking for insights

Supposedly C3 Code won an AI coding shootout. I’d be very interested in anyone who’s got a knowledgeable critique of this. The box score ...

Reddit - Artificial Intelligence · 1 min ·
More in Llms: This Week Guide Trending

No comments

No comments yet. Be the first to comment!

Stay updated with AI News

Get the latest news, tools, and insights delivered to your inbox.

Daily or weekly digest • Unsubscribe anytime