BERT with a side of knowledge graph
K-BERT grafts Chinese knowledge-graph triples onto BERT inputs for fine-tuning on classification, NER, and domain-specific tasks.

What it does
K-BERT is a 2020 research implementation that grafts external knowledge—entity triples from sources like CnDbpedia, HowNet, or a medical ontology—onto standard BERT input for downstream fine-tuning. Built atop the UER framework, it ships with training scripts for text classification and named entity recognition. The repo bundles benchmark results across sentiment analysis, natural language inference, and domain-specific finance, law, and medical tasks.
The interesting bit
The project treats knowledge graphs as swappable plug-in modules: you point the script at CnDbpedia, HowNet, or the medical KG at runtime and the README reports resulting accuracy and F1 scores across ten datasets. Notably, the documentation emphasizes empirical tables over architectural explanation, so the exact injection mechanism is unclear from the README alone.
Key highlights
- Built on the UER framework rather than Hugging Face Transformers
- Supports three Chinese knowledge graphs: CnDbpedia, HowNet, and a medical KG
- Reports dev/test accuracy for classification (Book review, ChnSentiCorp, XNLI, etc.) and F1 scores for NER
- Includes domain-specific benchmarks for finance, law, and medicine
- Later integrated into Alibaba’s EasyNLP toolkit
Caveats
- Requires downloading pretrained BERT weights and knowledge graph files from Weiyun cloud storage links
- README contains a typo (“Sorce”) and offers minimal explanation of the internal mechanism
- Appears focused on Chinese-language knowledge graphs and tasks; no English KG support is shown
Verdict A useful reference for researchers reproducing AAAI 2020 Chinese-NLP results or experimenting with domain-specific KG augmentation. Skip it if you need a modern, pip-installable Hugging Face component.
Frequently asked
- What is autoliuweijie/K-BERT?
- K-BERT grafts Chinese knowledge-graph triples onto BERT inputs for fine-tuning on classification, NER, and domain-specific tasks.
- Is K-BERT open source?
- Yes — autoliuweijie/K-BERT is an open-source project tracked on heatdrop.
- What language is K-BERT written in?
- autoliuweijie/K-BERT is primarily written in Python.
- How popular is K-BERT?
- autoliuweijie/K-BERT has 982 stars on GitHub.
- Where can I find K-BERT?
- autoliuweijie/K-BERT is on GitHub at https://github.com/autoliuweijie/K-BERT.