ChineseBERT: Chinese Pretraining Enhanced by Glyph and Pinyin Information

Zijun Sun, Xiaoya Li, Xiaofei Sun, Yuxian Meng, Xiang Ao, Qing He, Fei Wu, Jiwei Li

Introduction

Most large-scale pretrained models, such as BERT or RoBERTa, were originally designed for alphabetic languages like English. When adapted to Chinese, these models typically treat each character as an atomic, unique ID. This approach, however, ignores two vital sources of linguistic information: glyphs (visual structure) and pinyin (phonetics).

Chinese characters are logographic; their visual components, or radicals, often carry semantic meaning (e.g., characters related to water sharing the "氵" radical). Furthermore, Chinese is rich in heteronyms—characters that look identical but have different meanings based on pronunciation. Standard models struggle with these nuances without heavy contextual lifting.

Methods: The ChineseBERT Architecture

ChineseBERT enhances the standard Transformer architecture by incorporating a specialized input layer that fuses three distinct types of embeddings:

  1. Char Embedding: Standard learnable embeddings for character IDs.
  2. Glyph Embedding: Captures visual features by rendering characters in three historical and modern fonts (FangSong, XingKai, and LiShu). These are processed through a fully connected layer to produce a visual vector.
  3. Pinyin Embedding: Uses the pypinyin library to identify pronunciation in context. The pinyin sequence is processed by a CNN to create a phonetic vector.
The overall architecture of ChineseBERT, illustrating the fusion of character, glyph, and pinyin embeddings before entering the Transformer blocks.

These three embeddings are concatenated and passed through a Fusion Layer to map them to the model's hidden dimension. This fused representation, combined with positional embeddings, is then fed into standard Transformer blocks. The model is pretrained from scratch using Masked Language Modeling (MLM) with both Whole Word Masking (WWM) and Char Masking (CM).

Key Insights and Performance

A significant finding is that glyphs and pinyin act as strong regularization, providing the model with "prior knowledge" about the language's structure. This allows ChineseBERT to outperform baselines particularly when training data is scarce.

Comparison of Test F1-score across different training sizes, showing ChineseBERT's superior performance and robustness in low-data regimes compared to BERT and RoBERTa.

ChineseBERT achieved new State-of-the-Art (SOTA) results across a wide range of benchmarks, including Machine Reading Comprehension (MRC), Natural Language Inference (NLI), and Named Entity Recognition (NER). Notably, it reached higher performance with significantly fewer training steps than traditional models (e.g., 1M steps vs. 2M for BERT-wwm).

Conclusion

By integrating visual and phonetic information, ChineseBERT addresses fundamental limitations in how models process logographic languages. While requiring training from scratch due to its unique input architecture, the model demonstrates that language-specific features can significantly enhance both performance and training efficiency. Future work may extend these multi-modal features to other logographic languages like Japanese.

Summary updated

BibTeX
@inproceedings{sun2021chinesebert,
  author = {Zijun Sun and Xiaoya Li and Xiaofei Sun and Yuxian Meng and Xiang Ao and Qing He and Fei Wu and Jiwei Li},
  title = {{ChineseBERT: Chinese Pretraining Enhanced by Glyph and Pinyin Information}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.161},
}
Figure