LatticeBERT
Lattice-BERT is a Chinese pre-trained language model that reads a lattice of characters and words.
Language · 544 operations Checked
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
- Task
- Language
- Parameters
- 99.4M
- Operations
- 544
- Framework
- PyTorch
- Recurrent
- No
- Published
- NAACL 2021
- Paper
- Lattice-BERT: Leveraging Multi-Granularity Representations in Chinese Pre-trained Language Models
- Cited by
- 3 (as of 30 October 2026)
- Authors
- Yuxuan Lai, Yijia Liu, Yansong Feng and others
- Source
- GitHub: alibaba/AliceMind
- 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 file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m17875
- Graph hash
- 34408a7359afaceebda414925e36fe91c699bf2421c2d845af51a145cdb6379f
- Skeleton hash
- fcca3cedee30b8a1c4e8d137887d3299c81c4a46d59dd746e55a6b4b643ebfca
- Architecture hash
- c969ac3340959e0e1a5f39dbd9468559fdb2276e2cd7ede5dca0013d3a62da17
- Diagram SHA-256
- f9cdbd9b4d843f95d0bbafd97884ff8d44cedb977b8b0524de48be2b5d9998f2
- 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
Lattice-BERT is a BERT-style pre-trained language model for Chinese that reads words as well as characters. Chinese pre-trained models usually process text as a sequence of characters, yet the paper points out that the meanings of many Chinese words cannot be fully understood by composing the meanings of their characters. Lattice-BERT therefore builds a lattice graph from the characters and words in a sentence and feeds all of these text units into the transformer.
Two changes make this work. Lattice position attention adds three position-related terms to each attention score, encoding absolute positions, distance and the positional relationship between tokens. And because a character can occur both on its own and inside several words, random masking would let the model guess a masked token by looking at unmasked tokens that overlap it. Pre-training therefore uses masked segment prediction, which masks out all the tokens in a segment and predicts all of them.
The base-size model has 12 layers, a hidden size of 768 and 12 attention heads, and it adopts the embedding decomposition of ALBERT so that the large vocabulary does not add too many parameters to the embedding matrix. The paper reports 100M parameters at base size, 11% more than its character-level counterpart. Across 11 Chinese natural language understanding tasks, the paper reports an average increase of 1.5% in the 12-layer setting over a baseline that takes only characters as input.
Key idea. Lattice-BERT pre-trains a Chinese language model on word lattices of characters and words, using lattice position attention and masked segment prediction to exploit the lattice structure.
- Lattice-BERT
- LatticeBERT
- LBERT
- Chinese pre-trained language model
- word lattice
- multi-granularity representations
- lattice position attention
- masked segment prediction
- Chinese NLU
- CLUE benchmark
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{lai2021latticebertleveragingmultigranularityrepresentations,
title={Lattice-BERT: Leveraging Multi-Granularity Representations in Chinese Pre-trained Language Models},
author={Yuxuan Lai and Yijia Liu and Yansong Feng and Songfang Huang and Dongyan Zhao},
year={2021},
eprint={2104.07204},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2104.07204},
}