Word-Level Representation From Bytes For Language Modeling

Chu-Tak Lee, Qipeng Guo, Xipeng QiuarXiv 2022 · DOI

Introduction

Modern Natural Language Processing (NLP) predominantly relies on sub-word tokenization methods like Byte Pair Encoding (BPE) or WordPiece. While effective at balancing vocabulary size and performance, these methods suffer from inherent brittleness to noise (e.g., typos, casing changes), scaling inefficiencies due to massive embedding layers, and a trade-off between computational efficiency and granularity. Pure byte-level models offer robustness but are often computationally expensive due to long sequence lengths.

Byte2Word addresses these challenges by creating a "token-free" input model that maintains word-level efficiency. It builds word-level representations directly from raw bytes and predicts sub-words through a novel positional up-sampling mechanism. This approach achieves performance comparable to BERT-Large while using only 10% of the embedding parameters and demonstrating superior robustness to noise and cross-lingual transfer.

Architecture: The Byte2Word Framework

The Byte2Word framework introduces two primary architectural innovations designed to bridge the gap between byte-level robustness and word-level efficiency.

Cross-Attention Down-sampling

Instead of traditional 1D convolutions, Byte2Word employs a cross-attention mechanism to aggregate byte-level information. The bytes of a word serve as "keys" and "values," while a learnable query generates the "word-level" representation. This acts as an information bottleneck, forcing the model to compress raw byte sequences into a single, dense word-level vector. This shallow abstraction layer captures character-level patterns while leaving high-level semantic learning to the deeper Transformer layers.

Positional Up-sampling for Prediction

To maintain a manageable output space without a massive word-level dictionary, the model predicts sub-words. It takes the word-level hidden state and adds a "positional query" representing the $j$-th sub-word of that word. This up-samples the representation before it reaches the prediction head, allowing the model to remain token-free during inference while utilizing standard sub-word vocabularies for pre-training.

The Byte2Word architecture: Raw bytes are compressed into word-level representations via cross-attention, processed by a Transformer encoder, and then up-sampled for sub-word prediction.

Experimental Setup

The model was pre-trained on a 20GB corpus of English Wikipedia and BookCorpus. Evaluation was conducted across several benchmarks:

  • GLUE Benchmark: For general natural language understanding.
  • Noisy MNLI: To test robustness against synthetic noise (random drops, repetitions, casing changes).
  • XNLI: To evaluate cross-lingual transfer capabilities across languages such as Arabic, German, Spanish, French, and Urdu.

Results and Analysis

Byte2Word demonstrates that word-level representations can be effectively derived from bytes without sacrificing performance or efficiency.

Competitive Performance

Byte2Word (304M parameters) achieved an average score of 82.63 on the GLUE benchmark, nearly matching BERT-Large (82.97). This is particularly impressive given that Byte2Word's embedding layer is roughly 10% the size of BERT's, facilitating easier GPU parallelization and faster processing.

Performance comparison on the GLUE benchmark. Byte2Word achieves results comparable to BERT-Large while utilizing significantly fewer embedding parameters.

Robustness and Cross-Lingual Transfer

Byte2Word significantly outperforms BERT-Cased on "Random Case" noise tests (74.1 vs 73.5) and shows greater resilience to typos. The byte-level input allows the model to internally distinguish casing and character-level patterns, aiding in the processing of noisy real-world text. Furthermore, in zero-shot cross-lingual transfer (XNLI), Byte2Word outperformed BERT-Large Uncased in every tested language, suggesting that byte-level features generalize better across different scripts than fixed sub-word tokens.

Architectural Insights

The authors found that simple positional queries for up-sampling were more effective than complex attention-based methods. Additionally, the cross-attention down-sampling acts as a crucial bottleneck, capturing essential character-level patterns (e.g., distinguishing "live" from "liver") while delegating high-level semantic reasoning to the deeper Transformer layers.

Conclusion and Future Work

Byte2Word offers a compelling middle ground for language modeling, combining the robustness of byte-level inputs with the efficiency of word-level processing. While the current implementation relies on whitespace for word boundaries—presenting challenges for logographic languages like Chinese—it sets a strong foundation for future "token-free" architectures. Future research will explore optimal splitting strategies for non-spaced languages and the application of Byte2Word embeddings in generative tasks.

Summary updated

BibTeX
@misc{lee2022word,
  author = {Chu-Tak Lee and Qipeng Guo and Xipeng Qiu},
  title = {{Word-Level Representation From Bytes For Language Modeling}},
  year = {2022},
  eprint = {2211.12677},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.12677},
}
Figure