Elamur Research

How do different tokenizers perform on downstream tasks in scriptio continua languages?: A case study in Japanese

Paper · 2023 · Takuro Fujii, Koki Shibata, Atsuki Yamaguchi et al.

Summary

A Japanese sentence usually gives readers few spaces to tell them where one word ends and another begins. A system has to make those divisions before it can learn from the sentence. In tokenization, one way to make the divisions is to find word-like units first, then break any of those units into smaller pieces as needed. Another is to let a subword tokenizer work directly on the text. Fujii and colleagues test both approaches. Their question is whether these early decisions make a difference later, when a system has to recognize a name, judge the similarity of two sentences, or recover the grammatical structure of a sentence.

The authors pair MeCab, Juman++, Sudachi and Vaporetto with Byte-Pair Encoding (BPE), WordPiece and Unigram. Each sub-word method also has a version that skips the morphological analyzer, the component that identifies the initial word-like units. The authors learn a separate vocabulary for each configuration and pretrain a fresh BERT system with it. They use the same base architecture and evaluate the systems on seven Japanese tasks. This lets them compare the presence or absence of an analyzer, different analyzers paired with the same sub-word method, and different sub-word methods paired with the same analyzer.

For all three sub-word methods, the version without an analyzer has the lowest reported average across the tasks in its group. The effect varies widely. On the held-out Japanese Wikipedia named entity recognition evaluation, BPE reaches 85.1 F1 with Juman++ and 62.9 F1 by itself. Direct WordPiece encounters a more severe problem. It can take a long unspaced span as one unit and substitute a single unknown marker if it cannot split the unit completely. In that configuration the reported proportion of unknown tokens per pretraining sample is 99.8 ± 4.9%, and pretraining loss is unstable.

The comparisons among working pairs give different answers for different tasks. Vaporetto does well on sentence similarity, Juman++ on entity recognition, and Sudachi on dependency parsing, which asks how words are grammatically linked. With an analyzer in place, BPE and Unigram each outperform WordPiece significantly in some comparisons. On the tasks they evaluate, the authors observe no significant difference between BPE and Unigram. The study supports putting a morphological analyzer before sub-word segmentation in this Japanese BERT setup and evaluating the choice of analyzer on the intended task. The authors made the code and pretrained systems available.

Deep dive: How do different tokenizers perform on downstream tasks in scriptio continua languages?: A case study in Japanese

Fujii and colleagues test how Japanese word segmentation and subword tokenization affect BERT across tasks such as entity recognition and parsing. · about 35 minutes to read

The problem and its context

What the spaces would have supplied

The paper uses scriptio continua for writing in which word boundaries lack explicit separators. Japanese is its case study, and Chinese and Thai are other examples it names. The difficulty is specific to what the written line supplies. A Japanese sentence has words and other meaningful units, but a program cannot generally recover their divisions by finding spaces. Decisions that a space-based pipeline can take from the input have to come from somewhere else.

The paper illustrates the issue with parallel sentences about research on morphological analyzers. In the English version, spacing already gives an extent for the word analyzers. A sub-word procedure can then divide material inside that extent. In the Japanese version, 私 and は are adjacent in the original string. A first pass can identify them as separate units and keep 形態素 together as another unit. A second pass can divide that last unit into 形態 and 素. Both passes place boundaries, but a boundary between grammatical units and a division made to fit a learned inventory are answers to different questions.

In this setting the relevant job of morphology is to supply a useful first division. The paper describes Japanese morphological analysis as a way of identifying meaningful pieces roughly comparable to words in the English example. A dictionary can propose pieces that recur in the language, while a prediction procedure decides which pieces fit the sentence at hand. The term word-like leaves room for differences among analyzers. A unit appropriate for one analyzer or for one level of granularity might be handled as several units by another.

Sub-word segmentation has a different source of evidence. It learns a finite vocabulary from a corpus, meaning a collection of texts. When the algorithm encounters a unit, it represents it with entries from that vocabulary. Some spans can be represented intact. Others require several entries, each of which can also serve in other contexts. This lets a vocabulary cover text without dedicating one entry to every full expression it might encounter.

In a pipeline where the sub-word procedure works within analyzer units, the first set of boundaries constrains the second. Put a break between two characters and the next stage treats the material on either side separately. Keep those characters inside one unit and the next stage can consider a piece spanning both. This distinction matters during vocabulary learning as well as during conversion of new text into tokens. Changing the first division changes what the second stage gets to learn from.

Why the comparison has to reach the downstream task

For a pretrained language model, the tokenizer determines what occupies a position in the input. A piece can correspond to a character, a larger part of an expression, or a whole unit from the analyzer. A sentence represented with many small pieces occupies a different sequence of positions from the same sentence represented with longer pieces. In masked pretraining, those pieces also determine what can be hidden and what the system has to predict. The importance of segmentation therefore extends beyond the appearance of the encoded sentence.

The later tasks can be sensitive to different consequences of that encoding. A review judgment needs enough evidence to classify the whole text. An entity recognizer needs evidence about where an expression starts and stops and what kind of entity it denotes. A dependency parser needs representations that support judgments about grammatical relations. The paper studies downstream scores because it wants to know which choices help when the learned representations are put to use. Two tokenizers can produce visibly different sequences without the visual difference alone telling a reader which will serve a particular task better.

The authors describe earlier research as having established that tokenization choices affect downstream performance. They cite work on the performance of multilingual systems in individual languages, on different ways to treat spaces, and on different sub-word algorithms. They also say that much of the research had concentrated on languages that explicitly mark word boundaries. Earlier investigations included Japanese and Thai, but the authors identify a gap in how broadly combinations of analyzers and sub-word methods had been evaluated. How Good is Your Tokenizer?, Byte Pair Encoding is Suboptimal for Language Model Pretraining.

Existing systems already illustrate several designs. The original BERT uses WordPiece. The paper gives GPT-3 as an example of byte-level BPE and cites XLM-R as an instance of applying sub-word tokenization without a morphological analyzer. Those choices explain why both algorithm selection and the decision to segment first deserve attention. Comparing the published systems themselves would change much more than the tokenizer. A design that studies new runs of the same architecture can make the comparisons within a shared training setup. Language Models are Few-Shot Learners, Unsupervised Cross-lingual Representation Learning at Scale.

Japanese adds an interaction to the ordinary question of which sub-word method to choose. If the first pass gives one sub-word algorithm shorter spans that suit its assumptions, the algorithm's behavior can change markedly. Another algorithm could be less sensitive to that initial division. An analyzer that works well with one method can also make available a different set of useful pieces to another. Evaluating a few pipelines that each change both components would leave those possibilities hard to distinguish.

The paper responds with comparisons organized around three questions. To ask about the value of the morphological pass, it includes an analyzer-free condition for each sub-word method. To compare the analyzers themselves, it groups the runs by sub-word method. To compare the sub-word algorithms, it looks within groups that use the same analyzer. The variety of downstream tasks lets each question be asked again for different outputs, from a label on a review to a labeled relation between words. The goal is to judge a tokenizer as part of a complete training and evaluation pipeline.

The method, step by step

Start with a boundary procedure

An experimental run begins by deciding what sort of input the sub-word learner will see. It can see spans produced by a Japanese morphological analyzer or receive text without that pass. In the first case the analyzer decides where the word-like units end. In the second case the procedure for the particular sub-word method governs how it handles the text it receives. The results table calls the second choice Nothing, referring to the missing morphological stage. A vocabulary and a segmentation algorithm are still present.

The four analyzers fall into two families in the paper's description. A sequence predictor considers candidate divisions of the sentence jointly. Its dictionary supplies spans that could fit at different positions. A pointwise predictor examines a character gap and decides whether to put a boundary there based on nearby evidence. These approaches produce the same kind of output for the study, a sequence of units, in spite of making their decisions differently.

For sequence prediction the paper describes a lattice, a graph of the possible ways to cover the sentence. An edge represents a candidate unit at a particular position. A path through the graph selects units that together form a complete segmentation. If a dictionary supports a long unit at some position as well as several shorter alternatives, the graph can represent both. A scoring procedure decides which complete path to favor. Searching the lattice is a way to use evidence about combinations of units without exhaustively listing all complete segmentations.

MeCab builds a lattice from its dictionary and uses a sequence-labeling feature function to calculate costs. It applies the Viterbi algorithm to find the combination with the smallest cumulative cost. The search reuses results for partial paths as it considers how they can be extended. This makes the cost of a proposed segmentation a property of a sequence of choices. A decision about one span is made in the course of selecting a path for the sentence. Applying Conditional Random Fields to Japanese Morphological Analysis.

Juman++ also starts with a dictionary lattice. It combines a recurrent language score with a score from a feature-based linear predictor. Beam search keeps promising partial paths in consideration as the analysis proceeds, seeking a complete path with a high combined score. The choice of search and the evidence used to score a path distinguish this analyzer from MeCab even though both start from candidate spans in a lattice.

Sudachi, the other sequence predictor in the comparison, offers units at different levels of granularity. The authors choose its Middle setting, which they describe as close to words in an ordinary sense. Every result associated with Sudachi in the experiment belongs to that setting. A reader comparing the analyzers should therefore treat Sudachi as a configured tool. The setting determines which spans can reach the next stage intact.

Vaporetto takes the pointwise approach. It extracts features from characters inside a window around a prospective boundary. A linear classifier uses those features to decide whether to place a break. The unit of prediction is the gap, and the resulting set of breaks defines the units the sub-word method receives. Vaporetto adds a different boundary prediction approach to the comparison while still fitting the same two-stage interface.

Build an inventory and decide how to use it

Vocabulary learning and segmentation are distinct operations. Learning produces a collection of recognized pieces and the information the algorithm needs to use them. Segmentation applies what was learned to a particular input. For example, learning can make both a long piece and its shorter constituents available. The segmentation algorithm decides which option to use in that occurrence. The paper's comparison lets each method bring its own approach to both operations.

BPE increases its inventory by combining pieces. A pair of existing symbols receives a score based on frequency. The highest-scoring pair is merged, its combination is added to the vocabulary, and the operation repeats until the prescribed vocabulary size is reached. Joining a pair changes the symbols available for subsequent combinations. In this way the learner can build a piece larger than either of its immediate constituents. To tokenize a unit, the method starts from its characters and successively merges eligible pairs into larger pieces learned in the vocabulary. Neural Machine Translation of Rare Words with Subword Units.

WordPiece also constructs entries from combinations of symbols. The distinction made in the paper is that its pair score draws on the frequency of the combination and the separate frequencies of the two pieces. At segmentation time the authors follow BERT's longest-match procedure. The algorithm looks for the longest permitted vocabulary entry matching the beginning of the current span, takes that entry, and continues from the next unprocessed position. Its choice is greedy in the sense that it commits at each position before resolving the rest of the span.

The paper's example has a WordPiece division of 形態素 after an analyzer has identified the complete unit. The vocabulary supplies an initial piece corresponding to 形態 and a continuation corresponding to 素. The notation ## marks the latter as a continuation inside the unit. This example shows that boundaries from analysis can be retained while the word-like material between them is represented with finer pieces. It also gives a concrete case of why the start of a unit and a position inside it matter to the segmentation rule.

The fallback in the tested WordPiece procedure applies to a whole unit. If the algorithm cannot finish dividing it, an unknown marker, [UNK], represents the unit. When the morphological pass supplies small units, it also defines the extent of such a replacement. When an input stretch lacks blanks and there is no analyzer, WordPiece can take the stretch as one word. Any failure to complete its segmentation can then discard a much larger span. This property of the algorithm is part of what the analyzer-free trial tests.

Unigram begins with a large inventory and reduces it. Frequent substrings are one way to form the initial candidate set. The learner fits a unigram probability distribution to the current entries. Here unigram refers to assigning probabilities to individual pieces. The learner asks how much worse the training corpus would score if it lost a particular symbol and removes the symbol with the smallest degradation. The comparison of log likelihoods described in the paper can be written as follows. Subword Regularization.

D(x) = Lbefore − Lwithout(x)

x is the entry being considered for removal, and D(x) is its removal cost. Lbefore is the training corpus's log likelihood using the fitted unigram probabilities with the current inventory. Lwithout(x) is the corresponding log likelihood with entry x removed. Log likelihood expresses how well the probability assignment accounts for the corpus on a logarithmic scale. The subtraction measures the degradation attributable to dropping the candidate. The learner favors removal when that degradation is smallest.

When segmenting a unit, Unigram uses Viterbi inference to find the division with the highest likelihood under its learned probabilities. One candidate path can start with a long piece, while another begins with several shorter pieces. The likelihood assigns a score to the entire candidate segmentation, so the choice at the start can depend on the pieces available for the rest. With WordPiece, the available longest prefix is taken immediately. With BPE, eligible merges determine how the pieces grow. The three procedures can therefore give different divisions of the same analyzer span.

Train each tokenizer, then pretrain with it

The design includes 12 analyzer and sub-word pairings and three more configurations with no analyzer. The authors use Japanese Wikipedia for vocabulary training, randomly sampling 10M sentences. Each learned vocabulary has a size of 30k. The common inventory size makes the comparison about how different procedures allocate their entries within the same nominal budget. Neither the shared source nor the shared size requires the resulting vocabularies to contain the same pieces.

In describing the Wikipedia data preparation, the authors say that they filter out sentences shorter than 30 characters and remove sentences with the marker for a category or with table symbols. Pretraining uses Japanese Wikipedia and CC-100. The paper gives their respective sample counts as 2.2 and 1.1M and sets the maximum pretraining sequence length to 512. The Wikipedia sentence count for vocabulary learning describes a separate operation from the sample counts for BERT pretraining.

A fresh base BERT system is trained for each tokenizer. The authors report 125M parameters, 12 hidden layers and attention heads, hidden dimension 768 and intermediate dimension 3072. The hidden dimension is the width of the representation the architecture maintains at a position. The intermediate dimension gives the width of the intermediate representation inside a layer. Architecture is held fixed so that the comparison can follow the effect of the tokenizer through training without also switching to a different network design.

Pretraining uses masked token prediction. The system is given a sequence with selected content obscured and learns to recover what belongs at those positions. Its vocabulary determines the possible answers at a masked position, and the tokenizer determines the units in the surrounding sequence. Changing the tokenizer can alter both sides of that learning problem. For instance, an expression encoded with one available piece provides a different prediction target from the same expression divided into a series of pieces.

The pretraining schedule uses 500,000 steps with batches of 128. The optimizer is AdamW. The reported learning rate is 1e-4, with linear warmup over 10,000 steps. Warmup increases the rate during the initial training period. The optimizer settings are 1e-8 for epsilon, 0.9 and 0.999 for the two decay coefficients used in its running estimates, and 0.01 for weight decay. Attention dropout and the other dropout setting are both 0.1. This is a shared schedule across the new runs. Its sequence length is counted in token positions, so the original text covered by a sequence can still depend on the tokenizer. Decoupled Weight Decay Regularization.

Training and evaluating each Japanese tokenizer configuration

The steps in order.

Training and evaluating each Japanese tokenizer configurationStep 1: Choose a morphological analyzer or bypass that stage1. Choose a morphological analyzer or bypass that stageStep 2: Learn subword entries from sampled Wikipedia sentences2. Learn subword entries from sampled Wikipedia sentencesStep 3: Encode the pretraining text with the resulting tokenizer3. Encode the pretraining text with the resulting tokenizerStep 4: Train base BERT to recover masked pieces4. Train base BERT to recover masked piecesStep 5: Adapt the pretrained system to each downstream task5. Adapt the pretrained system to each downstream taskStep 6: Compare task scores within the experimental groups6. Compare task scores within the experimental groups

Adapt the pretrained representations

Fine-tuning takes the pretrained system and adjusts it using examples with the outputs required by a particular task. The tokenizer accompanies the pretrained system into this phase. A sequence of pieces therefore serves first as material for masked prediction and later as input for supervision specific to the benchmark. Training for each task can adapt the representations to its requirements, within the input encoding determined earlier.

The fine-tuning batch size is 32. The reported schedule uses 5 epochs for JGLUE and entity recognition and 10 for Universal Dependencies. An epoch is a pass through the training examples for a run. The sequence length settings are task-dependent. The authors use 512 for MARC-ja and Japanese-GSD, 348 for JSQuAD, 128 for JSTS, JNLI and entity recognition, and 64 for JCommonsenseQA. A shared limit for all tokenizers on a task makes the comparison consistent at the level of token positions.

The learning rate for JGLUE and entity recognition is 3e-5. The parser experiment has separate rates, 5e-5 for the BERT component and 1e-3 for the biaffine attention parser. Linear warmup covers 10% of fine-tuning steps. The reported fine-tuning settings retain the pretraining values for the Adam coefficients, epsilon, weight decay and both kinds of dropout. Where task requirements call for a separate prediction component, the study keeps that component's setup fixed within the tokenizer comparison for the task.

For Japanese-GSD, the authors place a deep biaffine attention parser on top of BERT. For each token, they take its hidden representations from the top four layers and average them. The parser takes the resulting representation as input. Its job is to select arcs, the links between words, and assign relation labels to those arcs. The features passed to the biaffine components have dimension 500 for arcs and 100 for relations. The authors use SuPar and follow its default parser configuration as described in the paper. The parsing score reflects the way tokenization, pretrained representations and supervised parsing work together. Deep Biaffine Attention for Neural Dependency Parsing.

The implementation uses the Tokenizers library for segmentation and PyTorch and Transformers for BERT. The authors use automatic mixed precision in FP16. They report four NVIDIA V100 GPUs with 32GB for pretraining and one GPU for fine-tuning. The released implementation is named compare-ja-tokenizer, and the pretrained checkpoints are available through Hitachi's Hugging Face account. These checkpoints preserve the configuration-specific BERT systems used to study the tokenizer choice. PyTorch, Transformers.

Compare vocabularies alongside downstream scores

In addition to keeping track of which method wins a particular comparison, the paper looks at how similar the learned inventories are. For a pair drawn from different sub-word methods, it counts entries present in both vocabularies. It expresses that count relative to their common size. This builds a common scale for comparing inventory pairs across the experiment.

Vocabulary similarity = |V₁ ∩ V₂| / |V|

V₁ and V₂ are the vocabulary sets of tokenizers T₁ and T₂. The sign ∩ gives their intersection, the entries that occur in both sets. Vertical bars around a set count its members. |V| is the common vocabulary size, and the slash denotes division by that size. Each shared entry contributes equally. That makes this a measure of inventory composition, independent of how frequently those entries occur during segmentation.

For each task the paper pairs vocabulary similarity with a measure of the distance between observed downstream scores. It sums the observed scores for each tokenizer, takes the absolute difference between the sums, and scales the result to the run average.

Performance difference = (1/5) × |Σᵢ s₁ᵢ − Σⱼ s₂ⱼ|

s₁ᵢ denotes observation i for T₁, and s₂ⱼ denotes observation j for T₂ on the same task. Each Σ adds the scores over its index, and − subtracts the second total from the first. Here the bars take the absolute value of that difference. The factor 1/5 divides by the number of runs, and × denotes multiplication. The resulting distance has no direction. Identifying which setting scored higher requires the original task results. The figure leaves out comparisons between configurations that use the same sub-word method.

Experiments and results

What the benchmarks ask the system to do

The benchmark suite includes JGLUE, a Japanese Wikipedia entity dataset, and Universal Dependencies Japanese-GSD. JGLUE supplies five of the tasks. Its test data were unavailable publicly, so the paper reports evaluation on its development sets. Fine-tuning uses five-fold cross-validation on the training material. In such a procedure the training collection is divided into folds, with different portions used for validation across runs. The development scores reported for JGLUE belong to the separate benchmark development material.

MARC-ja uses Japanese product reviews from the multilingual Amazon reviews corpus. It is a text classification task with a positive or negative label for each review. The dataset has 187,528 training examples and 5,654 development examples. The metric is accuracy, the share of correct labels. It assesses the prediction for the review as a whole, regardless of which passages in the review supplied evidence of its sentiment. The Multilingual Amazon Reviews Corpus.

JSTS takes a pair of sentences and requires a graded prediction of semantic similarity. The annotation scale runs from 0 for the least similar pairs to 5 for the most similar. The sentences come from Japanese caption data associated with MS COCO and YJ Captions. There are 12,451 training pairs and 1,457 development pairs. The metric is Spearman correlation. It measures agreement in rank, so what matters is whether the system and the annotations order pairs similarly from lower to higher similarity. The paper reports the correlation on the scale used in its results table. Microsoft COCO Captions.

JNLI presents sentence pairs from the same caption sources. Here the output is an inference label. The labels indicate that a sentence follows from the other, contradicts it, or has a neutral relationship to it. The authors cite SNLI for the label scheme. JNLI includes 20,073 training pairs and 2,434 development pairs, and the score is accuracy. The comparison with JSTS is instructive for reading the evaluations. A ranking of pairs by resemblance is a different objective from choosing the logical relationship for each pair, even when the same sources supply the sentences. SNLI.

The two question answering benchmarks also give the system different kinds of outputs to produce. JSQuAD provides a question and a Japanese Wikipedia passage and asks for a span from the passage. Its construction follows SQuAD v1.1. The Japanese benchmark includes 62,859 training examples and 4,442 development examples. The paper reports F1 for the selected answer. F1 balances overlap recovered from the reference with the precision of the predicted material. The placement of an answer's edges can consequently affect the result. SQuAD.

JCommonsenseQA gives five candidate answers and asks the system to select the best one. It follows the construction of CommonsenseQA, whose seed material came from ConceptNet. The Japanese benchmark has 8,939 training examples and 1,119 development examples. Accuracy gives credit for picking the annotated choice. Segmentation can change the representation of the question and answer candidates. The output remains an option from the supplied set. The results table abbreviates this benchmark as JCQA. CommonsenseQA.

The entity benchmark uses Japanese Wikipedia sentences with linguistic annotation by Stockmark. The required output identifies a named expression and its category. The supplied collection has 5,343 examples listed as training data and lacks a separate official development or test partition. The authors make a 9:1 split, using the larger share for fine-tuning with five-fold cross-validation and the smaller share for measurement. Their entity F1 rewards recovery of annotated entities while penalizing incorrect predictions. The resulting scores refer to that held-out share of the Stockmark collection.

Japanese-GSD comes from Universal Dependencies. It has 7,050 training sentences, 507 development sentences and 543 test sentences. The target is a rooted directed tree. Each grammatical link attaches a word to its head and carries a relation label. Labeled attachment score, or LAS, measures whether both parts of a predicted attachment are correct. The paper reports LAS for its Japanese-GSD evaluation. The separate dataset partitions distinguish Japanese-GSD from the JGLUE development protocol and the division the authors create for Stockmark.

Read the reference checkpoint and the experimental runs

The paper includes bert-base-japanese, an existing checkpoint that uses MeCab and WordPiece, as a reference. Its development results include 95.5 ±0.1 accuracy on MARC-ja, 85.3 ±0.3 Spearman correlation on JSTS and 86.4 ±0.2 F1 on JSQuAD. It reaches 85.6 ±0.2 F1 on the held-out Stockmark evaluation and 93.3 ±0.1 LAS on Japanese-GSD. Its reported average across the tasks is 87.1.

The authors' own MeCab and WordPiece run has the same named components at the tokenizer level. Its development results include 95.5 ±0.1 accuracy on MARC-ja, 82.4 ±0.5 Spearman correlation on JSTS and 89.2 ±0.3 F1 on JSQuAD. Sharing tokenizer family names therefore does not fix the measured outcome. For the research questions, the useful controls are the conditions the authors trained under their common experimental protocol. The reference checkpoint situates those results among scores from an existing Japanese system.

In the main table, the number following the plus-minus sign is the standard deviation over five runs. For instance, 88.4 ±0.3 for Sudachi with Unigram on JNLI gives both its mean development accuracy and the spread of the run results. The reported task average condenses the results into a single value for each tokenizer configuration. Its ingredients are scores for different metrics and tasks. A high average describes performance across this particular suite, and the individual columns provide the evidence about particular capabilities.

The effect of adding morphological analysis

The analyzer-free condition has the lowest reported average within each sub-word family. For BPE the average is 83.3 without an analyzer and 87.2 with Juman++. For Unigram it is 85.9 without analysis, while the configurations with Juman++, Sudachi and Vaporetto each report 87.1. WordPiece's analyzer-free result is 33.5, while the configurations using Juman++ or Vaporetto reach 86.5. These are the paper's reported task averages. They give a common direction across tokenizer families and reveal the especially severe deterioration when WordPiece receives the text directly.

The differences vary across individual tasks. On MARC-ja, direct BPE reaches 95.4 ±0.2 development accuracy, and Vaporetto with BPE reaches 95.6 ±0.1. On JSQuAD, the corresponding comparison between direct BPE and Sudachi with BPE gives 88.7 ±0.3 and 90.2 ±0.2 development F1. The Stockmark results show a much larger separation. For Juman++ with BPE versus direct BPE the authors report a difference of 22.2 in held-out entity F1.

BPE configurations on held-out Stockmark Japanese Wikipedia entity F1

All analyzer pairings improve on direct BPE, and Juman++ gives the highest mean.

BPE configurations on held-out Stockmark Japanese Wikipedia entity F1Direct BPE: 62.9Direct BPE62.9BPE with Sudachi: 83.5BPE with Sudachi83.5BPE with MeCab: 83.7BPE with MeCab83.7BPE with Vaporetto: 84.1BPE with Vaporetto84.1BPE with Juman++ (this paper): 85.1BPE with Juman++ (this paper)85.1
The numbers
System or settingF1
Direct BPE62.9
BPE with Sudachi83.5
BPE with MeCab83.7
BPE with Vaporetto84.1
BPE with Juman++ (this paper)85.1

Unigram retains more of its entity performance when used directly. Its F1 on the held-out Stockmark data is 76.9 ±1.0. With Juman++ or Vaporetto it records 84.1 ±0.4. Direct Unigram can be close to the strongest paired configuration on another task. On JCommonsenseQA it achieves 74.6 ±0.4 development accuracy, while Juman++ with Unigram reaches 74.9 ±1.2. The direct mean on that task is higher than some of the paired Unigram means. The direction of the average is thus compatible with exceptions in individual cells.

Direct WordPiece gives a sharply different profile. It reaches development accuracy of 85.5 ±0.0 on MARC-ja and 55.3 ±0.0 on JNLI. On JCommonsenseQA its development accuracy is 20.0 ±0.8. On Stockmark its entity F1 is 0.0 ±0.0, and on Japanese-GSD its LAS is 63.8 ±0.9. JSTS is reported as N/A for the direct WordPiece condition. The missing result should be kept distinct from the reported zero for the entity task.

Subword tokenization without an analyzer on JSQuAD development F1

Unigram has the highest mean among the direct settings, with WordPiece far behind both alternatives.

Subword tokenization without an analyzer on JSQuAD development F1Direct WordPiece: 10.1Direct WordPiece10.1Direct BPE: 88.7Direct BPE88.7Direct Unigram (this paper): 89.3Direct Unigram (this paper)89.3
The numbers
System or settingF1
Direct WordPiece10.1
Direct BPE88.7
Direct Unigram (this paper)89.3

The JSQuAD comparison makes the scope of the failure especially visible. Direct WordPiece has development F1 of 10.1 ±0.1. Its paired versions all report much stronger scores on the same evaluation, including 89.8 ±0.3 with Juman++. BPE and Unigram achieve development F1 of 88.7 ±0.3 and 89.3 ±0.1, respectively, without a first pass. The severe degradation is specific to the tested direct WordPiece pipeline among these three analyzer-free configurations.

Which pairs lead on particular tasks

The range at the top of the MARC-ja column is narrow. Vaporetto with BPE and Sudachi with Unigram both give a mean of 95.6 development accuracy, with standard deviations of ±0.1 and ±0.2, respectively. The two systems use different methods at both stages and achieve the same rounded mean. JNLI shows a small cluster of leading scores as well. Sudachi with Unigram reaches 88.4 ±0.3 development accuracy, MeCab with Unigram 88.3 ±0.4, and Sudachi with BPE 88.2 ±0.3. The means are useful for describing the leaders, while the controlled tests address which separations can be detected reliably.

On sentence similarity, the best BPE mean comes from Vaporetto at 84.8 ±0.2 JSTS development Spearman correlation. Juman++ with BPE reaches 84.6 ±0.4. The Unigram group also contains a mean of 84.8, from Sudachi with a standard deviation of ±0.5. The authors single out Vaporetto in their account of the analyzer comparisons. That finding combines evidence about analyzer choices within sub-word families with the overall table of scores, where more than one route produces a high mean.

For JSQuAD the highest experimental mean is 90.2 ±0.2 development F1, from Sudachi and BPE. The BPE runs with MeCab and Juman++ each have a mean of 90.1, with standard deviations of ±0.3 and ±0.2, respectively. On JCommonsenseQA the highest mean reported for the experimental configurations is 74.9 ±1.2 development accuracy, from Juman++ and Unigram. Holding Juman++ fixed and switching to WordPiece gives 71.1 ±0.6. That comparison involves two fully segmented input pipelines and shows that the sub-word stage can make a difference even when the analyzer works in both conditions.

Parsing has a different leader. The highest mean in the Japanese-GSD column is 94.0 ±0.1 LAS with Sudachi and WordPiece. Sudachi gives 93.8 ±0.1 with BPE and 93.7 ±0.1 with Unigram. The remaining WordPiece pairings achieve 93.8 ±0.1 with Vaporetto and 93.6 ±0.1 with either MeCab or Juman++. The high Sudachi score is a specific success for WordPiece in a suite where its other results frequently favor BPE or Unigram. It is also an example of the practical importance of assessing the analyzer and the sub-word algorithm together.

Subword methods paired with Sudachi on Japanese-GSD labeled attachment score

WordPiece gives the highest parsing mean when Sudachi supplies the initial segments.

Subword methods paired with Sudachi on Japanese-GSD labeled attachment scoreSudachi with Unigram: 93.7Sudachi with Unigram93.7Sudachi with BPE: 93.8Sudachi with BPE93.8Sudachi with WordPiece (this paper): 94.0Sudachi with WordPiece (this paper)94.0
The numbers
System or settingLAS
Sudachi with Unigram93.7
Sudachi with BPE93.8
Sudachi with WordPiece (this paper)94.0

What the ablations show

Removing the first pass changes what the next pass can learn

The analyzer-free conditions act as component removals at the pipeline level. The authors rebuild the vocabulary and pretrain BERT for each such condition. This detail is important. If the authors merely turned an analyzer off at evaluation time, the tokenizer and BERT would have learned from material prepared with different boundaries. Training a new configuration tests the consequences of doing without the analyzer from the start. Those consequences include changes to the learned inventory, the segmentation of the training text, and the representations available after pretraining.

For named entity recognition, the authors propose an explanation based on annotation boundaries. The Stockmark annotations are at word level and tend to align with morphological units. An analyzer imposes breaks in linguistically motivated places, after which sub-word algorithms divide inside the units they receive. That can be helpful when the supervised task needs to associate a label with a span and identify its endpoints. The strong held-out entity results from adding an analyzer to both BPE and Unigram are consistent with that explanation.

The entity evidence is a comparison of final F1 scores. The paper does not quantify how frequently a tokenizer's boundaries coincide with annotated entity boundaries. Better alignment is a proposed link between the intervention and the result. Adding an analyzer changes other aspects of the input at the same time. The downstream observations support examining this link, and the particularly large BPE effect shows how consequential an analyzer can be for this benchmark. Direct Unigram's stronger score among analyzer-free conditions also indicates that the sub-word algorithm can affect how much of the entity signal survives.

Direct WordPiece supplies a diagnostic beyond final scores

The WordPiece failure is supported by measurements made during pretraining. For direct WordPiece, the reported mean encoded sequence length is 1.15 ± 3.28, and the unknown-token share per sample is 99.8 ± 4.9%. These figures refer to encoded pretraining samples. Read together, they describe a condition in which a short output sequence typically carries very little of the original content. An entire unsegmentable input unit can be represented by the same unknown marker, regardless of what its characters originally said.

The mechanism follows from the scope of the fallback. Without analyzer breaks, WordPiece can continue treating material up to a blank as a single word. If parts of that unit cannot be expressed with permitted pieces, a single marker replaces the entire unit. Even evidence in the part of the span that would have been segmentable is lost when the replacement covers the whole. The paper's very high unknown-token share gives direct evidence that the issue occurs often in pretraining for this configuration.

The pretraining loss curves show instability for direct WordPiece. Loss measures the system's error on the objective it is being trained to optimize. The curves and token statistics address different parts of the problem. The token statistics show what the system is given. The curves show the course of learning under that input condition. The downstream scores then show the practical consequences of carrying the same tokenizer into fine-tuning and evaluation. The agreement across these observations supports the authors' account of why the analyzer-free WordPiece condition deteriorates so severely.

With morphological analysis in place, the input to WordPiece is already a series of bounded units. The same fallback rule then operates over those units, and the pairing produces viable task scores. This makes the severe direct failure informative about an interaction, between an algorithm that expects manageable word-like spans and text that does not generally mark their limits with spaces. There is also a separate question about WordPiece's performance among viable pairings. The authors address that question through tests that omit the direct configurations.

Comparing analyzers under a fixed subword method

The analyzer analysis groups MeCab, Juman++, Sudachi and Vaporetto runs that share a sub-word method. The authors use the Kruskal–Wallis test to look for separation among the groups of observed scores. This test uses ranks across the observations. The paper marks significance when the p-value is below .05. A significant result from that test is evidence that the group of analyzers contains a difference. It does not by itself locate the difference between particular analyzers. The authors use Steel–Dwass pairwise tests for those follow-up comparisons, with the same stated threshold.

The omnibus pattern varies by task as well as by the sub-word method held fixed. JSTS and named entity recognition show significant analyzer effects in the BPE and WordPiece groups. Their Unigram groups show no significant analyzer effect. Japanese-GSD shows significant analyzer effects in all three sub-word groups. MARC-ja shows none in any of those groups. The comparison therefore distinguishes cases in which the measured variation across analyzers is detectable from cases that give weaker statistical evidence under the same testing scheme.

The sentence-similarity results illustrate how the statistical comparison relates to the strongest reported mean. Vaporetto performs well in the paper's pairwise analysis. In the BPE group it also has the highest mean on JSTS, 84.8 ±0.2 development Spearman correlation. Sudachi reaches 84.8 ±0.5 with Unigram, a group in which the omnibus test finds no significant analyzer difference. Both are high reported means, and the authors' analyzer preference draws on comparisons within groups where the question of analyzer choice is identifiable.

For Stockmark entity recognition, Juman++ emerges as the effective analyzer highlighted by the authors. With BPE it gives 85.1 ±0.6 F1, against 83.5 ±0.6 with Sudachi on the held-out data. With WordPiece it yields 84.7 ±0.5, against 82.4 ±0.6 with Sudachi. The Unigram versions of Juman++ and Vaporetto have the same reported mean and spread, 84.1 ±0.4, and the group gives no significant analyzer difference on that task. Taken together, the comparisons show why the study frames its conclusions around particular tasks while retaining the role of the sub-word method.

The parsing analysis favors Sudachi, whose Middle configuration serves as the initial segmentation. The highest Japanese-GSD mean goes to Sudachi in the BPE and WordPiece groups, and it shares the highest Unigram mean with Vaporetto. Here the significant analyzer differences across all sub-word groups make the choice relevant even where the raw numbers lie close together. The experiment evaluates the results of a configured analyzer, including its dictionary, scoring procedure and granularity. A separate test would be necessary to attribute its parsing advantage to one of those ingredients.

Comparing subword methods under a fixed analyzer

The complementary grouping asks how BPE, WordPiece and Unigram perform when each sees units from the same analyzer. The authors find significant omnibus differences on JSTS and JCommonsenseQA for every analyzer. The comparison gives no significant sub-word difference on MARC-ja or entity recognition for any analyzer. Entity recognition therefore has a distinctive pattern. Adding the morphological stage can change its F1 considerably, and analyzer choice is distinguishable in some groups, while switching the sub-word algorithm within a group defined by the analyzer gives less statistical separation.

The JCommonsenseQA scores show how the sub-word comparison works with the analyzer fixed. With MeCab, the development accuracies are 74.1 ±0.7 for BPE, 69.8 ±0.7 for WordPiece and 74.5 ±0.8 for Unigram. With Sudachi they are 74.2 ±0.6, 70.0 ±0.9 and 74.5 ±0.6 in the same order. These WordPiece scores come from pipelines with morphological analysis. Their lower means give a different basis for comparison from the failure of direct WordPiece, where the unknown-token fallback obscures much of the source content.

In the pairwise tests, the paper finds WordPiece significantly below BPE, Unigram or both in some tasks. The authors report no significant BPE–Unigram difference on any tested task. The absence of a detected difference concerns the observations and conditions of this study. The algorithms still use distinct rules, and can choose different divisions of individual inputs. For a task such as Japanese-GSD, the high Sudachi and WordPiece mean is also a reason to retain the individual configuration results alongside the broader comparison.

The same logic applies when a task has a large difference upon removal of morphology. That result shows sensitivity to the full preprocessing change. It can coexist with small measured differences between functioning sub-word pairings. Conversely, a task can show meaningful separation among sub-word methods even with every input already divided by an analyzer. The two controlled comparisons address different decisions a practitioner might make about how to represent Japanese text.

Inventory overlap points to a possible explanation

The vocabulary plot compares sub-word methods using both shared inventory and the magnitude of the score gap. The paper describes comparisons involving WordPiece as occupying the part of the plot with lower overlap and larger performance differences. Comparisons of BPE with Unigram appear in the region with higher overlap and smaller score gaps. The display thus shows that the division among the methods in vocabulary composition resembles the division seen in the performance comparisons.

This diagnostic has a useful distinction from a comparison of actual token sequences. Its overlap measure treats an entry as a member of an inventory. It gives a rarely selected entry the same count as one that appears frequently, and it does not record where in a sentence the entry can be used. Two tokenizers with similar inventories can allocate those entries differently when segmenting text. Likewise, the absolute score gap measures separation while remaining silent about direction. The performance table and the significance tests supply the evidence about which method is ahead in a particular case.

Vocabulary and the segmentation rule both change across methods. BPE can obtain a large piece through successive pair merges. WordPiece takes the longest matching vocabulary item at each position. Unigram chooses according to the likelihood of a complete segmentation. The authors suggest that differences in those procedures can contribute alongside the composition of the learned inventory. The overlap analysis supports that possibility as an association. It does not intervene on vocabulary alone, and the experiment does not exchange inventories among segmentation rules to identify their separate contributions.

Limitations

Limits the authors identify

The study fixes each vocabulary at 30k entries. The shared size controls the comparison, and the authors explicitly note that changing it could give different results. A vocabulary with a different budget changes which candidate entries can be retained and how frequently the encoding has to assemble an expression from smaller parts. The authors cite earlier work suggesting that vocabulary size may make little difference once it is sufficiently large, giving over 16k as an example. Their own Japanese experiments evaluate a single size, so that suggestion remains separate from the evidence collected here.

The authors also restrict the experiment to BERT. They identify T5 and GPT-3 as other architectures for future investigation. The outcomes here follow from tokenizing Japanese for a base BERT architecture, training it with masked prediction, and adapting it to the specified benchmarks. A different training objective or architecture could respond differently to the same division into input pieces. The study's matched architecture strengthens the internal comparison while limiting the architectural scope of its conclusion. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer.

Japanese is the only language tested. The authors motivate their work with the larger class of languages that lack explicit word separators, and they leave experiments on other such languages for future work. The evidence comes from Japanese text, analyzers designed for Japanese, and Japanese benchmarks. Similar writing conventions elsewhere can make the decision about a first pass relevant. The results establish how the tested choices work in this case, whose analyzers and downstream annotations give specific meaning to the boundaries being compared.

Automatic selection of an effective pair for a new task is also left for future work. The paper identifies some preferences after training and evaluation and gives evidence for choosing among the tested configurations. It offers no evaluated procedure that would infer the preferred pairing from the task before running those comparisons. The ethics discussion adds a separate scope limit. The authors say that they used public, nonsensitive data and that the released systems could behave unfairly in some circumstances. The task suite reports performance on the listed objectives and contains no fairness assessment of the released checkpoints. Bias, fairness & safety.

Limits that follow from the experimental design

Each analyzer is tested as a whole. For example, MeCab and Juman++ differ in how they score and search paths through their dictionary lattices. Sudachi contributes its selected granularity. Vaporetto contributes a pointwise decision procedure with local character features. The setup can identify that a configured analyzer helps on a particular task, while the individual mechanisms that produce the gain remain unresolved. The same consideration applies to the comparison of sub-word families. Vocabulary construction and segmentation behavior are bundled in each tested method.

The common step count and sequence limits also do not guarantee common exposure to raw text at the level of characters. Within a fixed limit, different tokenizers can cover different extents of the original material. A masked piece can cover a different span under different vocabularies. Those are consequences of repackaging the text for the shared training setup. The study does not report an experiment that equalizes exposure at the character level or separates the effect of different masked span lengths from other consequences of tokenization.

The direct WordPiece result should be read in light of the tested rule for treating unspaced input and its replacement of a failed unit with [UNK]. A different rule for supplying input units or handling failure would change the conditions of that comparison. The measured collapse establishes the behavior of the tested pipeline. The paired results provide the complementary evidence about WordPiece when an analyzer supplies suitable input units. A general claim about every possible WordPiece application to Japanese would require evidence beyond these configurations.

Evaluation protocols limit how the scores can be compared across settings. The JGLUE numbers are development evaluations, and the Stockmark numbers come from the authors' held-out portion of an annotated collection. The task average combines accuracy, rank correlation, F1 and LAS. In the direct WordPiece row, JSTS is listed as N/A even though the table supplies a task average. The safest reading is to retain that reported average and consult the individual outcomes, without treating the absent correlation as a measured score. Five-run variation and the tests help interpret close results within the setup. They leave the ordering on new data or under a different training protocol open.

The proposed explanations differ in how directly the paper measures them. In the direct WordPiece run, the input statistics show frequent unknown replacements, and the pretraining curves show unstable loss. For the entity alignment explanation, the relevant observed outcome is the downstream F1 change after altering the tokenizer. For vocabulary composition, the analysis plots an association using an unweighted count of common entries. These observations support different levels of inference. They explain why the paper can give a concrete diagnosis of one severe failure and a more tentative account of several narrower performance differences.

What came after

The later citations connect the experiment with broader surveys and with methods concerned with changing how text is represented. Their titles and citation relationships establish the scope of those connections. They give a basis for relating the questions each work addresses to the Japanese experiment. They do not establish that a later work reproduced the results, adopted a particular analyzer, or used the released checkpoints.

Kaddour and colleagues cite the Japanese study in a broad treatment of the challenges and applications of large-scale language systems. The concrete result available from Fujii and colleagues is a case where a preprocessing decision had measurable effects in spite of a shared base architecture and a shared training schedule. That is the connection to the survey's general scope. The Japanese study makes the input representation an experimentally varied part of the system and traces its effects through to applications measured by different tasks. Challenges and Applications of Large Language Models.

Qin and colleagues cite it in a survey of multilingual resources, classifications and research directions. The Japanese comparison contributes a case in which the writing conventions of one language make a specific preprocessing decision consequential. It studies an explicit, language-specific boundary stage alongside an approach that works directly on the text. For multilingual and cross-lingual NLP, the connection is to the choice of what linguistic resources the pipeline uses before it reaches a learned inventory. The relation is at the level of the problem and the documented Japanese evidence. Multilingual Large Language Model: A Survey of Resources, Taxonomy and Frontiers.

Fehér and colleagues cite the paper in work on retrofitting existing systems with dynamic tokenization. That topic moves the point of intervention. Fujii and colleagues choose each configuration before pretraining, so the vocabulary and initial training can be aligned from the beginning. Retrofitting concerns a system that has already learned from an input representation. The link is the importance of the tokenizer to the rest of the system. The later work addresses how tokenization can be changed at a stage where learned representations already exist. Retrofitting Large Language Models with Dynamic Tokenization.

Teklehaymanot and colleagues cite the study in LGSE, which addresses lexically grounded initialization of sub-word embeddings for adaptation to low-resource languages. An embedding gives an input entry a numerical representation. The Japanese experiment changes which entries exist and how they are selected, then learns representations in fresh pretraining runs. LGSE concerns how to initialize representations for sub-word entries in an adaptation setting. Its focus is the step immediately after text has been mapped to pieces, where the system needs a usable representation for each piece it receives. LGSE.

Cite

Cite as Takuro Fujii, Koki Shibata, Atsuki Yamaguchi, Terufumi Morishita and Yasuhiro Sogawa. 2023. How do different tokenizers perform on downstream tasks in scriptio continua languages?: A case study in Japanese. Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 4: Student Research Workshop).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2023.acl-srw.5

@inproceedings{fujii2023how,
  title = {{How do different tokenizers perform on downstream tasks in scriptio continua languages?: A case study in Japanese}},
  author = {Takuro Fujii, Koki Shibata, Atsuki Yamaguchi, Terufumi Morishita and Yasuhiro Sogawa},
  booktitle = {Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 4: Student Research Workshop)},
  year = {2023},
  doi = {10.18653/v1/2023.acl-srw.5},
  url = {https://doi.org/10.18653/v1/2023.acl-srw.5}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/fujii-2023-how-do-different-tokenizers-perform/