AI Terms Dictionary

A comprehensive multilingual AI terminology dictionary

Definition

WordPiece is a tokenization method widely used in natural language processing models like BERT and ALBERT. It breaks down words into smaller subword units to manage morphological richness and reduce vocabulary size. The algorithm starts with a base vocabulary and iteratively adds the most frequent character pairs until a target size is reached. This allows the model to represent rare or unseen words by combining known subwords, improving generalization and handling of linguistic variations effectively.

Summary

A subword tokenization algorithm that recursively merges the most frequent character pairs to handle out-of-vocabulary words.

Key Concepts

Use Cases

Code Example

1
2
3
4
from transformers import BertTokenizer
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
tokens = tokenizer.tokenize('unhappiness')
print(tokens)