Abstract
Modern pre-trained language models (PLMs) predominantly utilize subword tokenization, which often compromises semantic integrity and increases vulnerability to character-level noise. We present CharBERT, a dual-channel architecture that integrates character-level representations directly into the Transformer framework. By employing a bidirectional GRU character encoder and a heterogeneous interaction module, CharBERT fuses subword and character information throughout the network. Furthermore, we introduce a Noisy Language Modeling (NLM) task to enhance robustness. Experimental results demonstrate that CharBERT consistently outperforms standard PLMs across various NLP benchmarks and exhibits significantly higher resistance to typos and misspellings.
Introduction
State-of-the-art PLMs like BERT and RoBERTa rely on subword units (e.g., WordPiece) to handle out-of-vocabulary words. However, this approach has two primary drawbacks: it can obscure fine-grained character-level patterns and makes models brittle when faced with real-world noisy text. A single character swap can drastically alter a subword sequence, leading to model failure. CharBERT is designed to be "character-aware," providing a more cohesive word representation that is inherently more robust.
Methodology
The core of CharBERT is its dual-channel architecture, which processes subword and character sequences in parallel.
Character Encoder
Unlike traditional CNN-based character encoders, CharBERT utilizes a bidirectional Gated Recurrent Unit (Bi-GRU) over the entire input character sequence. This allows the model to capture contextual dependencies both within and across subword boundaries, effectively "stitching" together information that subword tokenization might otherwise fragment.
Heterogeneous Interaction Module
The interaction between channels occurs after each Transformer layer via the Heterogeneous Interaction Module. This module uses a CNN-based fusion mechanism to combine subword and character representations, followed by a split operation with residual connections to maintain the distinct channels. This iterative fusion allows both types of information to mutually enrich each other as they pass through the network depth.
Noisy Language Modeling (NLM)
To further fortify the character channel, we propose the Noisy Language Modeling task. During pre-training, noise (additions, deletions, or swaps) is intentionally injected into words. The model is then tasked with reconstructing the original word using the character-level channel, forcing it to learn noise-resistant representations.
Experimental Results
CharBERT was pre-trained on the English Wikipedia corpus and evaluated on a suite of downstream tasks, including SQuAD (1.1 and 2.0), CoNLL-2003 (NER), and GLUE benchmarks.
General Performance
CharBERT consistently outperformed BERT-base across all evaluated tasks. For instance, on SQuAD 2.0, CharBERT achieved an F1 score of 78.6 compared to BERT's 76.3. It also set a new state-of-the-art on the Penn Treebank POS tagging task with 98.09% accuracy. Despite the dual-channel approach, the character channel only adds about 5M parameters, making it a relatively lightweight addition to the base model.
Robustness Against Attacks
The model's most significant advantage is its performance on noisy data. We evaluated models on "Attack" versions of datasets containing synthetic typos (dropping, adding, swapping, and keyboard-proximity replacement). On the noisy QNLI dataset, BERT's accuracy plummeted from 90.7% to 63.4%, whereas CharBERT maintained a robust 80.1%.
Conclusion
CharBERT offers a lightweight yet powerful enhancement to standard Transformer architectures. By bridging the gap between subword and character-level information, it achieves superior performance on clean text and provides a massive leap in reliability for real-world, noisy applications. Future work will explore its application to morphologically rich languages and larger model scales.
Summary updated