Abstract
Most pretrained language models rely on subword tokenization, which processes text as a sequence of subword tokens. However, different granularities of text, such as characters, subwords, and words, can contain different kinds of information. Previous studies have shown that incorporating multiple input granularities improves model generalization, yet very few of them outputs useful representations for each granularity. In this paper, we introduce the entanglement model, aiming to combine character and subword language models. Inspired by vision-language models, our model treats characters and subwords as separate modalities, and it generates mutually informed representations for both granularities as output. We evaluate our model on text classification, named entity recognition, POS-tagging, and character-level sequence labeling (intraword code-switching). Notably, the entanglement model outperforms its backbone language models, particularly in the presence of noisy texts and low-resource languages. Furthermore, the entanglement model even outperforms larger pre-trained models on all English sequence labeling tasks and classification tasks. We make our code publically available.
Introduction
Modern Natural Language Processing (NLP) is dominated by subword-based models like BERT and RoBERTa. While efficient, subword tokenization is notoriously brittle; a single character change or typo (e.g., "palying" instead of "playing") can lead to an "out-of-vocabulary" error or a completely different tokenization, hindering performance on noisy text. Conversely, character-level models like CANINE are robust to noise and capture morphological nuances but often lack the semantic depth that subword models gain from massive pre-training.
The "Entanglement Model" addresses this gap by treating characters and subwords as distinct "modalities"—similar to how vision-language models align images and text. By allowing these granularities to inform one another through cross-attention, the model achieves superior performance on noisy and low-resource data without the need for expensive additional pre-training.
Methodology: The Entanglement Model
The core of the proposed approach is an architecture that facilitates interaction between subword and character representations.
The model consists of three primary components:
- Dual Backbones: It utilizes two pre-trained encoders: a subword encoder (e.g., RoBERTa or XLM-R) and a character encoder (e.g., CANINE).
- Co-Attention Layers: The model employs $m$ layers of "co-attention" (CO-TRM). In these layers, the subword side queries the character side for fine-grained morphological details, while the character side queries the subword side for broader semantic context.
- Mutually Informed Outputs: This interaction produces two sets of embeddings: character-aware subword embeddings ($H_*^s$) and subword-aware character embeddings ($H_*^c$).
This dual-output structure provides significant flexibility. Subword outputs can be used for standard classification, while character outputs are ideal for tasks requiring pinpoint accuracy, such as identifying language switches within a single word (intraword code-switching).
Experimental Results
The Entanglement Model was evaluated across several benchmarks, including English sequence labeling (WNUT-17, CoNLL-03), multilingual NER (MasakhaNER), and character-level tasks.
Performance on Noisy and Formal Text
On the noisy WNUT-17 dataset, which consists of social media text, the model significantly outperformed its backbone models. Notably, an Entanglement Model based on RoBERTa-base often surpassed the performance of the much larger RoBERTa-large on English NER and classification tasks.
As shown in the results, the subword side of the Entanglement Model with 2 layers achieves an F1 score of 57.97 on WNUT-17, outperforming RoBERTa-large (57.10) despite having fewer total parameters. This demonstrates that "entangling" the two views makes the system more resilient to errors.
Multilingual and Low-Resource Success
Using XLM-R as a backbone, the model achieved state-of-the-art (SOTA) results on 6 out of 10 African languages in the MasakhaNER benchmark. This suggests that the character-level "safety net" is particularly valuable for low-resource languages where subword tokenizers may be less optimal due to limited training data.
Character-Level Utility
Unlike most hybrid models, this one can perform character-level labeling tasks that subword-only models cannot do because subword boundaries don't always align with character-level changes. The model set new SOTA results for intraword code-switching (e.g., Spanish-Wixarika), outperforming specialized models like SegRNN.
Discussion and Conclusion
The "modality" analogy—treating different text granularities as different "senses"—is a powerful shift in perspective. It allows the model to resolve ambiguities where the subword side provides the "what" and the character side provides the "how."
While the model requires more memory and is approximately 1.7x slower than standard subword models due to the dual backbones, the performance gains on noisy and low-resource data are substantial. Future work may explore scaling this entanglement to larger models or integrating even stronger character-level backbones like ByT5 to further push the boundaries of robust language understanding.
Summary updated