Zenaique
Part ofAI Product Manager·Week 1: AI Fundamentals for PMsView roadmap →

Which components make up a standard transformer block?

MCQ·Easy·4.5 · 119·~1 min·Asked atGoldman SachsMistral AINVIDIA·Relevant atAnthropicMeta
Attempt it
TL;DR

A transformer block stacks multi-head attention and a feed-forward network, each wrapped in a residual connection and a layer norm. The four ingredients stay the same in every variant.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine an assembly line where each station takes a sentence, processes it, and hands it on. The first station, attention, lets every word in the sentence look at every other word and gather context. The second station, the feed-forward network, gives each word a chance to think privately about what it just learned. Around each station, a forklift carries the original input through the back so nothing gets lost (that is the residual connection). A quality inspector rescales the output so it stays in a healthy range (that is the layer norm). Stack 32 of these stations and you have GPT. The four ingredients never change. Only their order and the size of each station vary.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

The transformer block is the single most stable design in deep learning. Vaswani and colleagues defined it in 2017, and every frontier LLM still uses the same template: two sublayers, each wrapped in a residual and a norm. What changed is everything inside the boxes: the attention variant, the normalization, the activation. What did not change is the block.

The two sublayers and what they each do

A transformer block has exactly two sublayers and they do different jobs.

Multi-head attention mixes information across the sequence dimension. Each token computes a query and looks at every other token's key and value to gather context. Without attention, the model has no way for a token's representation to depend on any other token.

The feed-forward network processes each token independently. It is a two-layer MLP with a non-linearity between, typically 4 x d_model wide in the hidden dimension. This is where the model stores the bulk of its memorized knowledge and where most of the compute per token happens.

The division of labor is deliberate. Attention is the cross-sequence operation. FFN is the computation for each position. Stacking them alternates the two operations, which is what gives transformers their expressive power.

Why the residual and the norm are non-negotiable
Where the parameters live
The modern modifications inside the recipe
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
ComponentOriginal (2017)Modern
AttentionMulti-head attention (MHA)GQA, MQA, or MLA for KV efficiency
FFN activationReLUSwiGLU or GeGLU
NormalizationLayerNorm (post-norm)RMSNorm (pre-norm)
ResidualsTwo per blockTwo per block (unchanged)

Real products, models, and research that use this idea.

  • Llama 4 Maverick stacks transformer blocks with RMSNorm, SwiGLU FFN, and GQA attention; the block layout matches the original 2017 template.
  • OpenAI's GPT models are widely understood to be decoder-only transformer stacks; their exact architecture and hyperparameters are unpublished.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QWhy is the FFN sublayer 'position-wise' and what does that buy you?
A

The same MLP processes each token independently. This makes the operation trivially parallel and lets the attention sublayer carry all the cross-token mixing.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Treating attention as the entire transformer block. The feed-forward network carries about two-thirds of the parameters and most of the per-token compute.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • The four ingredients of a transformer block

  • Why residual connections are non-optional at depth

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Explain scaled dot product attention.
Short answer·Medium