All models

ernie_m

The bidirectional Transformer encoder behind dozens of captured domain and language variants, with ERNIE-M documented.

Language · 377 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (36 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
BERT
Parameters
278M
Operations
377
Framework
PyTorch
Recurrent
No
Published
NAACL (arXiv 2018)
Cited by
33,913 (as of 9 October 2026)
Authors
Jacob Devlin, Ming-Wei Chang, Kenton Lee, Kristina Toutanova
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m4700
Graph hash
6063633412fe008fac735d91cb6afb6597ec05cdbcd58002cc9c879ee6b75829
Skeleton hash
5fa488dd99e0d85d9d8bd817c2fa8a643b8cb29e109d8600342b528100faf6a8
Architecture hash
1113d1867ef9a87febb7d2383000a3574cb886255068b4fe9328bb84fe9d493b
Diagram SHA-256
fc5c21f187f8ced1fd255f9dd33f8d269a004b5b15bbf34d08a2c9d14ff5de77
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

ERNIE-M is initialised from XLM-R rather than from BERT weights. It is trained to align the representation of multiple languages with monolingual corpora.

About this model's family

BERT, which stands for Bidirectional Encoder Representations from Transformers, is a language representation model. Unlike earlier language representation models, it is designed to pre-train deep bidirectional representations from unlabeled text by jointly conditioning on both left and right context in all layers. As a result, the pre-trained model can be fine-tuned with just one additional output layer to create state-of-the-art models for a wide range of tasks, such as question answering and language inference, without substantial task-specific architecture modifications. The paper describes BERT as conceptually simple and empirically powerful, with new state-of-the-art results on eleven natural language processing tasks. Those results included pushing the GLUE score to 80.5%, MultiNLI accuracy to 86.7% and SQuAD v1.1 question answering Test F1 to 93.2.

Among the captured members, the one with saved documentation is ERNIE-M, a multilingual model proposed by Baidu. ERNIE-M is a training method that encourages the model to align the representation of multiple languages with monolingual corpora, to overcome the constraint that the parallel corpus size places on model performance. Its key insight is to integrate back-translation into the pre-training process, generating pseudo-parallel sentence pairs on a monolingual corpus to learn semantic alignments between languages. In cross-attention masked language modeling, CAMLM, the model restores a MASK token in the source sentence relying only on the semantics of the target sentence, so it must learn to represent one language with the other. Back-translation masked language modeling, BTMLM, trains the model to generate pseudo-parallel sentences from monolingual sentences, which are then fed back to further align cross-lingual semantics.

ERNIE-M is implemented on the basis of XLM-R and its parameters are initialised from XLM-R. The base model uses a transformer encoder with 12 layers, 768 hidden units and 12 heads. It is trained with monolingual and parallel corpora that involved 96 languages. Experiments show ERNIE-M outperforms existing cross-lingual models and delivers new state-of-the-art results on various cross-lingual downstream tasks. The Hub checkpoint is a conversion of the PaddlePaddle weights to PyTorch by a third party, who notes they neither own nor trained the weights.

Key idea. BERT pre-trains a deep bidirectional Transformer encoder on unlabeled text by conditioning on both left and right context in every layer, so one pre-trained model fine-tunes to many tasks with a single added output layer.

  • bert
  • bidirectional encoder representations from transformers
  • pre-trained language model
  • masked language model
  • fine-tuning
  • glue
  • squad
  • ernie-m
  • cross-lingual
  • camlm
  • btmlm
  • xlm-r
  • domain-adapted bert
  • multilingual bert

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{devlin2019bertpretrainingdeepbidirectional,
      title={BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding}, 
      author={Jacob Devlin and Ming-Wei Chang and Kenton Lee and Kristina Toutanova},
      year={2019},
      eprint={1810.04805},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/1810.04805}, 
}