LLM Lab · 8 architectures · open recipe

Build a Large Language Model. Train it. Talk to it.

Every LLM on Earth is the same stack — data, tokens, embeddings, attention, MLPs, an optimizer and a lot of GPUs. Pick an architecture, snap the real parts together, launch the training loop, and watch it stream tokens back. No proprietary weights, no secret sauce — just how frontier models actually work.

Architectures
Parts bay
Assistant · 7B
params
7B
active
7B
layers
32
d_model
4096
ctx
128k
tok/param
~20
pretrain FLOPs
630e21
H100-hrs
630k
Assembly view
assemble
Input— missing —
Encode— missing —
Transformer × 32· + · + ·
Decode— missing —
Cluster
PCIe
Missing: 20

How any LLM actually works

Data

The corpus is the model

Frontier runs ingest 10-20T tokens: filtered web, code, books, math, multilingual, synthetic. Quality (dedup, classifier scoring, decontamination) matters more than raw size after ~1T.

corpus
10-20T tok
web %
50-70%
code %
10-25%
dedup
MinHash LSH
Compute

Chinchilla, then compute-optimal

For a fixed FLOP budget the loss-minimising ratio is ~20 tokens per parameter. Modern inference-optimised runs over-train (100-300 tok/param) to shrink deploy cost.

70B run
~15T tok
FLOPs
6·N·D
GPUs
8-16k H100
wall
weeks-months
Arch

Transformer, refined

RMSNorm pre-norm, SwiGLU MLP, RoPE positions, GQA, FlashAttention. Optional MoE for sparse scaling. Very few papers change the recipe — most add data or scale.

norm
RMSNorm
act
SwiGLU
attn
GQA + Flash
pos
RoPE + YaRN
Align

From base model to assistant

SFT on instruction data → preference optimisation (DPO or PPO). Constitutional AI / RLAIF replaces some human labels with model critiques. Safety evals gate release.

SFT rows
10k-1M
pref pairs
50k-500k
evals
MMLU, MT-Bench
red-team
days-weeks
Serve

Inference is a systems problem

vLLM PagedAttention + continuous batching + speculative decoding + FP8 quant. A single H100 serves 10-30 concurrent 70B chats when tuned.

engine
vLLM / TRT-LLM
quant
FP8 / AWQ
batch
continuous
spec
4-8 draft
Cost

Where the dollars go

Roughly: 80% pre-training compute, 10% data + eval, 5% alignment, 5% safety + serving. Inference eventually dominates once deployed at scale.

pretrain
70-85%
align
3-8%
eval
2-5%
serve
→ dominant

Open sources only. Content is synthesised from public research (Vaswani 2017, Chinchilla, LLaMA 1-3, Mixtral, DeepSeek, GPT-4 tech reports, o1 blog), open-source stacks (PyTorch, DeepSpeed, FSDP, vLLM, Megatron-LM, FlashAttention, tiktoken, SentencePiece) under Apache-2.0 / BSD / MIT, and Wikipedia (CC BY-SA). No proprietary weights, training data or internal docs are used or redistributed.

Trademarks. OpenAI, Anthropic, Meta, Google, Mistral, DeepSeek, xAI and other product / company names are trademarks of their respective owners, mentioned only as editorial and educational references (nominative fair use). This site is not affiliated with, endorsed by, or sponsored by any of them.