All models

K-BERT

A BERT-based model that injects knowledge graph triples into sentences as domain knowledge.

Language · 565 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 (18 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

Parameters
102.3M
Operations
565
Framework
PyTorch
Recurrent
No
Published
AAAI 2020
Cited by
827 (as of 29 October 2026)
Authors
Weijie Liu, Peng Zhou, Zhe Zhao and others
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
m17637
Graph hash
cea7c4145ba5b150e96d6d2b75902e3126237f67157f329770d465bbaf98ae76
Skeleton hash
5dad54b12f561d498739b22a71a70daefaa086cc59480fd36182339dea756e68
Architecture hash
bb45b7b416f94fffbb73ad83c222c202e3886c699a02b475eb5307b6212bd42f
Diagram SHA-256
a589808180184635e6c3b1a8eca3116ef0165c279b18977c638a1be4f52e0f3e
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

K-BERT is a language representation model that injects knowledge graph triples into sentences as domain knowledge. The motivation is that pre-trained models such as BERT learn a general language representation from large-scale corpora but lack domain-specific knowledge.

Adding too much knowledge may divert a sentence from its correct meaning, which the paper calls the knowledge noise issue. To limit the impact of knowledge, K-BERT introduces soft-position and a visible matrix. Because it can load model parameters from the pre-trained BERT, a knowledge graph can be attached without pre-training the model again.

The paper reports results on twelve NLP tasks and says K-BERT significantly outperforms BERT on domain-specific tasks in finance, law, and medicine. The released code is implemented based on the UER framework. Its classification script takes the name of a knowledge graph, which can be HowNet, CnDbpedia or Medical.

Key idea. K-BERT injects knowledge graph triples into sentences and uses soft-position and a visible matrix to limit knowledge noise, while loading parameters from the pre-trained BERT.

  • k-bert
  • kbert
  • knowledge graph
  • knowledge-enabled language representation
  • knowledge noise
  • visible matrix
  • soft-position
  • domain knowledge
  • text classification

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

Cite the paper

@misc{liu2019kbertenablinglanguagerepresentation,
      title={K-BERT: Enabling Language Representation with Knowledge Graph}, 
      author={Weijie Liu and Peng Zhou and Zhe Zhao and Zhiruo Wang and Qi Ju and Haotang Deng and Ping Wang},
      year={2019},
      eprint={1909.07606},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/1909.07606}, 
}