Tokenizer pipeline: from a typed sentence to token IDs

Tokenizer pipeline: from a typed sentence to token IDs A data-flow diagram generated by Archify. 01 / Raw text 02 / Normalization 03 / Subword 04 / To numbers 05 / Into the Transformer Typed sentence · any Unicode string · 01 / Raw text · no numbers yet Typed sentence any Unicode string no numbers yet Unicode variants · ắ composed vs a + marks · 01 / Raw text Unicode variants ắ composed vs a + marks Normalizer · NFC · NFKC · case · 02 / Normalization · can be lossy Normalizer NFC · NFKC · case can be lossy Pre-tokenizer · regex cuts rough pieces · 02 / Normalization · sets boundaries Pre-tokenizer regex cuts rough pieces sets boundaries Segmentation · BPE · WordPiece · Unigram · 03 / Subword · tokens take shape Segmentation BPE · WordPiece · Unigram tokens take shape Vocabulary · token → ID table · 03 / Subword Vocabulary token → ID table Token IDs · [921, 44, 7211, …] · 04 / To numbers · just indices Token IDs [921, 44, 7211, …] just indices Special tokens · BOS · EOS · role · PAD · 04 / To numbers Special tokens BOS · EOS · role · PAD Embedding lookup · E[id] → d-dim vector · 05 / Into the Transformer · meaning begins Embedding lookup E[id] → d-dim vector meaning begins raw text normalized token pieces look up a row of E same glyph rough pieces table lookup also take space Legend primary data data store data flow