AMBERT: A Pre-trained Language Model with Multi-Grained Tokenization

Xinsong Zhang, Pengshuai Li, Hang Li

TL;DR

This paper introduces AMBERT, a novel pre-trained language model that leverages both fine-grained (e.g., words, characters) and coarse-grained (e.g., phrases) tokenizations simultaneously. By using two parallel encoders with shared parameters, AMBERT captures richer contextual representations, leading to significant performance improvements over standard BERT on various NLU tasks in both English and Chinese.

What Problem Does This Paper Address?

Traditional pre-trained language models like BERT typically rely on a single type of tokenization, usually fine-grained (words or sub-words for English, characters for Chinese). While effective, this approach can miss the semantic richness of multi-word expressions (e.g., "New York," "ice cream") which function as single semantic units. Conversely, coarse-grained tokenization (like phrases) can better capture these units but may suffer from segmentation errors and less robust representations due to sparser data for these units. The paper addresses the limitation of single-grained tokenization by proposing a method that benefits from both fine-grained and coarse-grained representations, aiming to achieve superior performance and robustness.

Methods

AMBERT extends the BERT architecture by incorporating two parallel encoders: one for fine-grained tokens and another for coarse-grained tokens. These encoders share parameters at each layer, reducing the overall parameter count compared to having two independent models. The fine-grained encoder processes sequences of words (or characters for Chinese), while the coarse-grained encoder processes sequences of phrases (or words for Chinese). Both encoders generate contextualized representations, which are then combined.

For pre-training, AMBERT uses Masked Language Modeling (MLM) at both fine-grained and coarse-grained levels. Fine-tuning involves using the [CLS] representations from both encoders, and optionally incorporating an agreement regularization term to encourage consistency between the predictions of the two encoders.

The authors also propose an efficient inference method where only one of the two encoders is used, allowing for a trade-off between performance and computational cost, potentially matching BERT's efficiency.

Datasets

The paper uses several benchmark datasets for evaluation:

  • Chinese: CLUE (including TNEWS, IFLYTEK, CLUEWSC2020, AFQMC, CSL, CMNLI for classification, and CMRC2018, ChID, C³ for machine reading comprehension).
  • English: GLUE (excluding WNLI, including COLA, SST-2, MRPC, STS-B, QQP, MNLI, QNLI, RTE) and MRC tasks like SQuAD v1.1, SQUAD v2.0, and RACE.

For pre-training, they use:

  • Chinese: A corpus of 25 million documents (57GB) from Jinri Toutiao.
  • English: A corpus of 13.9 million documents (47GB) from Wikipedia and OpenWebText.

Key Insights and Ideas

  • Multi-grained tokenization is beneficial: The core idea is that combining fine-grained and coarse-grained representations captures more nuanced semantic information than either alone.
  • Parameter sharing is key to efficiency and effectiveness: Sharing parameters between the fine-grained and coarse-grained encoders makes AMBERT computationally comparable to BERT while enabling it to learn more robust representations. The paper suggests this sharing helps align the "ways of combining representations" across different granularities.
  • Chinese benefits more: AMBERT shows a larger performance improvement on Chinese tasks compared to English. The authors attribute this to the higher proportion of multi-word expressions in Chinese text that naturally lend themselves to phrase-level understanding.
  • Single-encoder inference is viable: The proposed method for using only one encoder during inference significantly speeds up computation with minimal performance degradation, making AMBERT practical for deployment.

Key Results

  • English: AMBERT outperforms Google BERT by 2.0% on GLUE, 2.5% on RACE, and 5.1% on SQuAD.
  • Chinese: AMBERT improves the average score by over 2.7% on CLUE.
  • Comparison with alternatives: AMBERT consistently outperforms AMBERT-Combo (two independent encoders) and AMBERT-Hybrid (single encoder processing concatenated inputs), demonstrating the advantage of its shared-encoder architecture.
  • Efficient inference: AMBERT with a single encoder achieves performance comparable to the full AMBERT model while offering significant speedups, often matching or exceeding the performance of single-grained BERT models.

Limitations and Future Work

  • Computational Cost: While parameter sharing helps, AMBERT's dual-encoder structure still doubles the computational cost during training compared to BERT. The efficient inference method partially addresses this for deployment.
  • Tokenization Errors: Coarse-grained tokenization, especially for phrases, can sometimes lead to errors, which the paper acknowledges can impact performance (as seen in some examples).
  • Future Work: The authors suggest exploring model acceleration techniques (e.g., sparse attention), applying AMBERT to other pre-trained models (like XLNet), and extending its use to other NLU tasks. They also plan to investigate model acceleration methods in learning.

Summary updated

BibTeX
@inproceedings{zhang2021ambert,
  author = {Xinsong Zhang and Pengshuai Li and Hang Li},
  title = {{AMBERT: A Pre-trained Language Model with Multi-Grained Tokenization}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.findings-acl.37},
}
Figure