Models In a Spelling Bee: Language Models Implicitly Learn the Character Composition of Tokens

Itay Itzhak, Omer Levy

Abstract

Modern large language models (LLMs) utilize subword tokenization, which treats character sequences as atomic units. This study investigates whether LLMs implicitly recover and encode the internal character-level composition of these tokens within their embedding space. Using a generative probe called SpellingBee, we demonstrate that models like RoBERTa and GPT-2 store significant orthographic information. Our results show that spelling is an emergent property of the language modeling objective, particularly in morphologically rich languages like Arabic. Furthermore, we find that explicitly pre-infusing models with character information provides no significant advantage, as models naturally acquire this knowledge very early in training.

Introduction: The Orthographic Blindness Myth

Most modern language models do not process text letter-by-letter. Instead, they employ subword tokenization methods like Byte Pair Encoding (BPE), which decompose strings into frequent chunks. For instance, the word "unbelievable" might be represented as two discrete symbols: un and believable. Because models operate on these atomic IDs, it has long been assumed that LLMs are "orthographically blind"—oblivious to the fact that the token un is composed of the characters 'u' and 'n'.

This research challenges that assumption, investigating whether the pressure of standard language modeling objectives forces models to "recover" this hidden character information and store it within their internal vector representations (embeddings).

Methodology: The SpellingBee Probe

To interrogate the embedding layer of pretrained models, the authors introduced SpellingBee, a generative probe. SpellingBee is a Transformer-based decoder that takes a single, uncontextualized embedding vector from a model (e.g., RoBERTa-Large) as its sole input. Its task is to generate the sequence of characters that form that specific token.

To ensure the probe captures learned information rather than simply memorizing the vocabulary, the researchers implemented several rigorous controls:

  1. Unseen Token Evaluation: The probe is trained on a subset of the vocabulary and tested on 1,000 previously unseen tokens.
  2. Adversarial Filtering: To prevent the probe from "guessing" based on semantic or morphological similarity (e.g., spelling "cats" because it saw "cat"), the authors used Similarity and Lemma filters. These filters remove any training tokens related to the test set.
  3. Control Baseline: A control probe was trained on randomly initialized vectors to establish a baseline for non-informative embeddings.

Experimental Results

The study evaluated embeddings from RoBERTa-Base/Large, GPT2-Medium, and AraBERT-Large. The results indicate that LLMs encode a surprising amount of orthographic detail.

Exact Match (EM) scores for the SpellingBee probe across varying training sizes and filtering conditions.

As shown in Figure 1, SpellingBee achieved an Exact Match (EM) score of 31.8% for RoBERTa-Large on unseen tokens. When measured by chrF (character n-gram overlap), the score rose to 48.7, indicating that even when the probe misses the exact string, it captures most of the constituent characters. Notably, the control probe failed to spell a single word correctly (0% EM), confirming that the orthographic information is a product of the LLM's pretraining.

The researchers also observed that AraBERT-Large outperformed English models, achieving 40.9% EM. This suggests that morphologically rich languages, where small character shifts significantly alter meaning, provide a stronger incentive for models to encode character-level details.

The "Spelling is Free" Hypothesis

A key question is whether explicitly teaching a model to spell during its initial training phase would improve its performance. The authors initialized a model with embeddings already infused with character information and compared its learning curve to a standard, randomly-initialized model.

Validation loss curves for control and character-pretrained models, showing nearly identical convergence.

As illustrated in Figure 4, the learning curves for the "character-infused" and "randomly-initialized" models converged almost immediately. This supports the "Spelling is Free" hypothesis: LLMs are so efficient at picking up orthographic signals that they acquire nearly all necessary character knowledge within the first 1,000 steps of standard training. Explicit pre-infusion offers no measurable advantage in reaching lower perplexity faster.

Conclusion

This work demonstrates that LLMs are not orthographically blind. Through the process of learning to predict the next word or mask, models implicitly learn the character composition of their vocabulary. While this knowledge is most precise for short, frequent tokens, its presence across various architectures and languages suggests it is a fundamental byproduct of modern language modeling. Future research may explore how this implicit knowledge can be leveraged to improve model robustness against typos or enhance performance on rare, out-of-vocabulary terms.

Summary updated

BibTeX
@inproceedings{itzhak2022models,
  author = {Itay Itzhak and Omer Levy},
  title = {{Models In a Spelling Bee: Language Models Implicitly Learn the Character Composition of Tokens}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.naacl-main.373},
}
Figure