Back to Blog
Sarah Drasner Makes Transformers Click With a Drawing
Trending Post

Sarah Drasner Makes Transformers Click With a Drawing

·AI Education

A deep dive into Sarah Drasner's viral visual explainer on AI Transformers, plus practical ways to learn and teach the basics fast.

TransformersAI explainersmachine learning basicsvisual learningLLM architectureLinkedIn contentviral postscontent strategysocial media marketing

Sarah Drasner, Sr Director of Engineering at Google: Web, Android, iOS, o11y, Experimentation and Multiplatform Core Infrastructure, recently shared something that made me stop scrolling: "💥 I did a drawing that breaks down Transformers in AI".

She added that she "spent a good amount of time on this one, breaking down concepts in a way that someone new to the subject could come away with basic high-level understanding" and that she hoped it would be useful. That combination of intent (teach beginners), craft (a thoughtful visual), and scope (Transformers, the engine behind modern LLMs) explains why the post resonated.

In the same spirit, I want to expand on what her drawing is trying to do: turn a dense, jargon-heavy topic into a mental model you can hold in your head. If you have ever heard words like "attention", "tokens", or "multi-head" and felt them blur together, this is for you.

Why a visual breakdown works for Transformers

Transformers are not a single trick. They are a stack of small ideas that interact: embeddings, position information, attention, feed-forward layers, residual connections, normalization, and repetition across many layers.

A text-only explanation often fails because you are asked to imagine a flow of information across time and across layers at once. A drawing forces you to see "what talks to what".

"Breaking down concepts" is not dumbing them down. It is choosing the few relationships that matter first.

The goal for a beginner is not to memorize equations. It is to understand the pipeline: input text becomes tokens, tokens become vectors, vectors interact through attention, and the model produces the next-token distribution.

The Transformer mental model in plain English

Here is a high-level walk-through of the major pieces you will see in most Transformer diagrams.

1) Tokens: the model reads pieces, not words

When you type a sentence, the model does not see characters or "meaning". It sees token IDs, which are integers that represent common text chunks.

Important beginner insight: the boundaries are not always words. "transform" and "ers" might be separate tokens. This is why prompts sometimes behave oddly and why spacing and punctuation can matter.

2) Embeddings: turning IDs into vectors

Each token ID is mapped to a vector (an embedding). Think of it as a learned coordinate in a high-dimensional space.

  • Similar tokens end up with embeddings that support similar behavior.
  • The embedding is not the meaning by itself, but it is a starting representation the network can shape.

3) Position: order has to be added explicitly

A core reason Transformers were a breakthrough is that they do not rely on recurrence (like RNNs) to process sequences. That means they need another way to represent order.

Two common approaches:

  • Positional encodings (classic) add a position pattern to each embedding.
  • Rotary or relative position methods (common in modern LLMs) bake position into attention itself.

Beginner takeaway: the model needs a signal for "this token came before that one".

Attention: the part everyone talks about

If you learn one concept first, make it attention.

4) Self-attention: each token looks at other tokens

Self-attention computes, for every token, a weighted mix of other tokens in the context. The weights are learned dynamically based on the current input.

A friendly way to say it:

  • Each token asks: "Who else should I pay attention to to do my job?"
  • The model answers by assigning attention weights.

Technically, this is done with queries (Q), keys (K), and values (V):

  • A query represents what a token is looking for.
  • Keys represent what each token offers.
  • Values represent the information that gets blended.

You do not need the full matrix math at first. You need the behavior: attention creates context-aware representations.

5) Causal masking: no peeking ahead

For language generation, the model must predict the next token without seeing future tokens. So the attention operation is masked so token i cannot attend to tokens after i.

This is a crucial reason LLMs are "next-token predictors" during inference.

6) Multi-head attention: multiple views at once

One attention pattern is rarely enough. Multi-head attention runs several attention computations in parallel.

A practical intuition:

  • One head might focus on syntax (subject-verb agreement).
  • Another might track references (pronouns to nouns).
  • Another might follow formatting patterns or code structure.

Then the heads are combined. Your mental model: multiple spotlights scanning the same text for different relationships.

The rest of the block: where the model transforms information

A Transformer layer is not only attention.

7) Feed-forward network: per-token processing

After attention mixes information across tokens, a feed-forward network (FFN) processes each token position independently.

This is where a lot of parameters live, and it helps the model build richer features. In many modern models, FFNs are replaced or enhanced with variants like gated linear units.

8) Residual connections and layer norm: stability and depth

Deep stacks are hard to train. Residual connections let the model carry forward earlier representations, and layer normalization stabilizes activations.

If your eyes glaze over here, keep one idea: these pieces help gradients flow and allow many layers to be stacked without collapsing.

9) Repeat the layer N times

A Transformer is a repeated block. Each layer refines the representations.

A helpful analogy: early layers capture local patterns, later layers capture more abstract, long-range structure.

Training vs inference: what changes and what stays the same

Beginners often mix up "how it learns" and "how it responds".

During training

  • The model sees many sequences.
  • It predicts next tokens.
  • Errors update weights through backpropagation.

During inference (chatting)

  • Weights are fixed.
  • The model repeatedly predicts the next token, appends it, and continues.
  • Sampling settings (temperature, top-p) change how deterministic or creative the output feels.

The architecture is the same. The difference is whether weights are being updated.

A simple example to make attention feel concrete

Take the sentence: "The keys are on the table because they are heavy."

When generating or interpreting "they", attention helps the model connect "they" back to "keys" rather than "table". It is not doing symbolic logic. It is using learned statistical patterns encoded in embeddings and attention weights.

This is why Sarah Drasner's visual approach is so effective: it shows the flow of information that makes reference resolution possible.

What Sarah Drasner got right about teaching this topic

Her post signals three teaching moves worth copying.

  1. Start with a high-level scaffold
    She aimed for "basic high-level understanding". That is exactly the right starting point. Once you have the scaffold, details like Q/K/V dimensions have somewhere to attach.

  2. Use a visual to show data flow
    Transformers are pipelines. Visuals clarify direction, repetition, and what happens "in parallel".

  3. Respect beginners
    A good explainer assumes the reader is smart, just new. It avoids gatekeeping vocabulary and introduces terms only when they earn their place.

A great technical drawing is a map: it tells you where you are, where you can go next, and what not to worry about yet.

Why the post likely went viral (and what to learn from it)

Even though the content is technical, the hook is simple: "I did a drawing". That is concrete. It promises value quickly.

From a content strategy perspective, a few things stand out:

  • It is curiosity-driven ("Transformers" is hot, but confusing).
  • It is artifact-based (a drawing people can save and share).
  • It is beginner-centered (broad audience).
  • It is generous ("I hope it's useful").

If you want to create LinkedIn content with similar pull, focus on producing a reusable asset: a diagram, checklist, glossary, or annotated example. Virality often follows usefulness.

Where to go next if you want to learn more

If Sarah Drasner's drawing gave you the overview, your next steps can be small and practical:

  • Learn tokenization by trying a tokenizer tool and seeing how your sentence splits.
  • Read one crisp attention explanation, then implement a tiny attention layer in a notebook.
  • Study a single Transformer block diagram until you can redraw it from memory.

You do not need to master everything at once. You need a mental model you can refine.

This blog post expands on a viral LinkedIn post by Sarah Drasner, Sr Director of Engineering at Google: Web, Android, iOS, o11y, Experimentation and Multiplatform Core Infrastructure. View the original LinkedIn post →