Token

W kontekście sztucznej inteligencji i NLP token jest podstawową jednostką tekstu, taką jak słowo, część słowa lub znak punktualny, używany do przetwarzania i analizy.

Tokenizacja to proces podziału tekstu na te tokeny. Jest to kluczowy krok w przygotowywaniu danych tekstowych dla modeli uczenia maszynowego, umożliwiający modelom zrozumienie i przetworzenie tekstu. Konkretne zasady tokenizacji mogą się różnić w zależności od zadania i używanego modelu, a różne tokenizatory dają różne wyniki.

Metody tokenizacji sięgają od prostego podziału na białe znaki po bardziej zaawansowane techniki, które uwzględniają jednostki podsłowne lub reprezentacje na poziomie znaków. Wybór tokenizatora znacząco wpływa na wydajność modeli NLP. Na przykład, tokenizator oparty na słowach może traktować 'cat' i 'cats' jako oddzielne tokeny, podczas gdy tokenizator podsłowny może podzielić 'cats' na 'cat' i 's'.

        graph LR
  Center["Token"]:::main
  Pre_cryptography["cryptography"]:::pre --> Center
  click Pre_cryptography "/terms/cryptography"
  Rel_machine_learning["machine-learning"]:::related -.-> Center
  click Rel_machine_learning "/terms/machine-learning"
  Rel_token["token"]:::related -.-> Center
  click Rel_token "/terms/token"
  Rel_tokenizer["tokenizer"]:::related -.-> Center
  click Rel_tokenizer "/terms/tokenizer"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧠 Sprawdzenie wiedzy

1 / 3

🧒 Wyjaśnij jak 5-latkowi

A [token](/pl/terms/token) is like a single Lego brick that makes up a sentence. AI breaks sentences into these bricks (words, parts of words, or punctuation) so it can understand and build new sentences.

🤓 Expert Deep Dive

Tokenization is a critical preprocessing step in NLP pipelines. Subword tokenization algorithms like BPE, WordPiece, and SentencePiece have become dominant because they balance vocabulary size with the ability to represent rare words and morphology. BPE iteratively merges frequent pairs of characters or bytes, while WordPiece uses a likelihood-based approach. SentencePiece treats text as a sequence of Unicode characters and learns subword units directly, making it language-agnostic. The choice of tokenizer impacts downstream tasks: a word-level tokenizer struggles with OOV words, while character-level tokenizers result in very long sequences. Subword tokenizers offer a compromise, allowing models to handle morphology (e.g., 'running' -> 'run', '##ing') and unknown words by composing them from known subwords. The mapping from tokens to numerical IDs and then to dense vector embeddings (e.g., Word2Vec, GloVe, or contextual embeddings from Transformers) is where semantic meaning is encoded for the model.

🔗 Powiązane terminy

Wymagana wiedza:

📚 Źródła