The table shows how two tokenizers split the same text. What do the ## and Ġ markers mean?
| Tokenizer | Tokens for "The unaffordable loan" |
|---|---|
| BERT WordPiece (uncased) | the un ##af ##ford ##able loan |
| GPT-2 byte-level BPE | The Ġun aff ordable Ġloan |
Show the answer and explanation
Correct answer: B, "##" marks a WordPiece piece that continues the previous word, while "Ġ" marks a byte-level BPE token that begins with a space, so word boundaries live in the tokens.
Explanation Tokenization
Subword tokenizers must record where words start; otherwise "un aff ordable" could not be turned back into "unaffordable". The two common conventions are mirror images:
| Tokenizer | Marker | Meaning | Example |
|---|---|---|---|
| WordPiece (BERT) | ## prefix | piece continues the previous word | un ##af ##ford ##able |
| Byte-level BPE (GPT-2, RoBERTa) | Ġ prefix | token starts with a space, i.e. a new word | Ġun aff ordable |
| SentencePiece (T5, LLaMA 2, XLM-R) | ▁ prefix | token starts with a space | ▁un aff ordable |
Ġ is simply how GPT-2's byte-to-unicode mapping displays the space byte. Because the space is part of the token, "loan" at the very start of a text and " loan" after a space are different tokens with different ids, which explains some surprising prompt-formatting effects: a trailing space at the end of a prompt forces an unusual token boundary and can change the next-token distribution.
Why the distractors fail: one option swaps the meanings of the two markers. The markers do not denote rare tokens added after training, and there is no separate embedding table; they are ordinary vocabulary entries. They have nothing to do with which tokens are masked in MLM, and padding uses a special token, not Ġ.
Practical consequence: when aligning NER labels to subwords, word starts are detected from these markers (or from word_ids() in Hugging Face tokenizers).
Interview tip: if asked why a prompt behaves differently with a trailing space, explain that byte-level BPE folds the space into the following token, so a dangling space leaves the model in a position it rarely saw during training.