Labs

Take one mechanism and play with it. Every lab runs on small example numbers you can edit — sized so that every number fits on the screen and changing an input visibly changes the result — and every number is computed by the same functions the modules use, so a lab and a module never disagree.

BERT, step by step

The route goes through BERT from text to the training step. Each step is one part of the model, with the lab that takes it apart on numbers you can edit; take them in order, or start where you need to. Steps 2 and 8 share one small input: what the embeddings lab outputs is what step 8's lab, One encoder block, receives, one row (vector) per token. The other labs use their own small example numbers, sized for the one part they show.

  1. 1

    Tokenize

    Text cut into the subword tokens the model has rows for.

  2. 2

    Embed

    Each token's row, its sentence's row and its position's row, summed and normalised.

  3. 3

    Position

    A closer look at the position row step 2 adds: attention alone cannot see order. BERT learns its position table; the lab shows the fixed ones.

  4. Inside one encoder block

    Steps 4 to 7 are the parts of one encoder block, not four stages in a row: attention (with its heads) and the feed-forward are the block's two sublayers, and add & norm wraps each. Step 8 assembles them.

    1. 4

      Attention

      Each token scores every token, itself included, and mixes their values by those weights.

    2. 5

      Heads

      The same attention split into heads that look for different things, then mixed back into one row by an output matrix.

    3. 6

      Add & norm

      The sublayer's input added back, then every row normalised.

    4. 7

      Feed-forward

      Each token on its own: widened, activated, narrowed back.

  5. 8

    One block

    The four parts above chained into one block — BERT-base stacks twelve of them.

  6. 9

    Masked words

    Hide some tokens and predict them from both sides — BERT's first training task.

  7. 10

    Sentence pair

    The [CLS] row through the pooler (a dense layer and tanh), then asked whether sentence B follows A — the second task.

  8. 11

    Sentence vector

    Many token vectors made one, and two of those compared.

  9. 12

    Training

    A loss, its gradient sent back through every layer, and a step taken.

The whole route, end to end: The traced BERT — 3 sentences, then 64IT/ML track — this module is not part of the language-professional track — every block on one small model, every number on the page.

Concept labs

One mechanism, on test data you can edit, sized to show everything it does.

Worked examples

One small model computed end to end, every number on the page.

Workflows

The concepts connected, on a real corpus.

Real cases

The platform applied to your own text or to a production lifecycle.

Labs — TransformerLab