Course review9 questions

Questions from the whole course

Each question comes from one lesson of NLP and Transformers, and they are mixed, so you meet each idea away from its lesson. A wrong answer says why, and takes you back to that lesson.

Review

9 questions from across the course. Answer as often as you like.

1 of 9

From Language modeling

A language model learns from plain text, and nobody writes answers in. So what does it practice on?

2 of 9

From Queries, keys, values and heads

In a tiny model whose keys have four numbers, "swim" sees two tokens: "Seals", key [1, 0, 2, 0], and itself, key [0, 2, 0, 1]. Its query is [2, 0, 0, 0]. What share does it give "Seals"?

3 of 9

From Word embeddings

Nobody told the model that "Monday" is like "Tuesday", yet their rows sit close together. How did they get close?

4 of 9

From Recurrent networks and their limit

One text of 12 tokens, each a vector of 64 numbers, goes into PyTorch's recurrent layer. What does this print?

import torch
from torch import nn

rnn = nn.RNN(input_size=64, hidden_size=64, batch_first=True)
x = torch.zeros(1, 12, 64)
out, h = rnn(x)
print(out.shape, h.shape)

5 of 9

From Tokenization

A model can write a whole essay, but counting the r's in "strawberry" is hard for it. Why?

6 of 9

From The transformer block

Take one of the model's 28 blocks out, and run the other 27. For most blocks, it still guesses "Antarctic". Why?

7 of 9

From Attention

"Seal" starts from the same row in "The penguin swam away from the seal." and in "The box was closed with a seal." Does it come out of attention with the same vector?

8 of 9

From Position

With no position signal, attention reads "The penguin ate the fish." and "The fish ate the penguin." Does the period take in the same blend in both?

9 of 9

From Encoders and decoders

A decoder reads "The box was closed with a seal.", 8 tokens. In its grid of shares, each row is one token. How many of the grid's 64 cells are open, where a token may look?

cells