[Paper Review] LambdaKG: A Library for Pre-trained Language Model-Based Knowledge Graph Embeddings
LambdaKG is a unified, open-source library for knowledge graph embedding (KGE) using pre-trained language models (PLMs), supporting both discrimination-based and generation-based methods across diverse tasks like knowledge graph completion, question answering, recommendation, and knowledge probing. It integrates BERT, BART, T5, GPT-3, and ChatGPT, offering a modular, extensible framework with unified training, evaluation, and optimization tools, achieving state-of-the-art performance on benchmarks such as FB15k-237 and ATOMIC2020.
Knowledge Graphs (KGs) often have two characteristics: heterogeneous graph structure and text-rich entity/relation information. Text-based KG embeddings can represent entities by encoding descriptions with pre-trained language models, but no open-sourced library is specifically designed for KGs with PLMs at present. In this paper, we present LambdaKG, a library for KGE that equips with many pre-trained language models (e.g., BERT, BART, T5, GPT-3), and supports various tasks (e.g., knowledge graph completion, question answering, recommendation, and knowledge probing). LambdaKG is publicly open-sourced at https://github.com/zjunlp/PromptKG/tree/main/lambdaKG, with a demo video at http://deepke.zjukg.cn/lambdakg.mp4 and long-term maintenance.
Motivation & Objective
- To address the lack of a comprehensive, open-source library specifically designed for pre-trained language model (PLM)-based knowledge graph embeddings (KGE).
- To unify diverse PLM-based KGE methods—both discrimination-based and generation-based—into a single, extensible framework.
- To support a broad range of downstream tasks, including knowledge graph completion, question answering, recommendation, and knowledge probing.
- To provide a modular, maintainable, and extensible toolkit with standardized training, evaluation, and optimization components for reproducible research.
- To enable rigorous benchmarking and comparison of new KGE methods using state-of-the-art PLMs like GPT-3 and ChatGPT.
Proposed method
- LambdaKG employs a unified KG encoder that converts knowledge graph triples into natural language prompts, enabling PLMs to understand both structural and textual information.
- It supports two main paradigms: discrimination-based models (e.g., fine-tuning BERT for link prediction) and generation-based models (e.g., using T5 or GPT-3 for answer generation).
- The library includes a modular Trainer and Evaluator class with customizable training steps, loss computation, and early stopping, enabling flexible training pipelines.
- A Metric class implements standard evaluation metrics such as hits@k (k=1,3,10) and mean rank (MR), with BLEU-1 for generation tasks.
- A 'Bag of Tricks' module integrates techniques like label smoothing, exponential moving average, top-k negative sampling, and early stopping to improve training stability and performance.
- Entity representations are enhanced via a pluggable entity embedding module, improving factual recall in knowledge probing tasks.
Experimental results
Research questions
- RQ1Can a unified, open-source library effectively support diverse PLM-based KGE methods across multiple downstream tasks?
- RQ2How do small PLMs (e.g., BERT, T5) and large language models (e.g., GPT-3, ChatGPT) compare in performance on knowledge graph completion tasks?
- RQ3To what extent do generation-based models like GPT-3 and ChatGPT outperform discrimination-based models in zero-shot knowledge graph completion and question answering?
- RQ4Does the integration of PLM-based KGE with external knowledge improve factual recall in knowledge probing tasks?
- RQ5How does the model performance vary across different relation types, particularly in 1-1 versus 1-n link prediction scenarios?
Key findings
- LambdaKG achieves competitive performance on FB15k-237, with KGT5 outperforming other models in knowledge graph completion.
- ChatGPT demonstrates superior performance over text-davinci-003 on FB15k-237, particularly in 1-1 link prediction, with higher hits@1 scores.
- Performance drops significantly in 1-1 versus 1-n relation cases, indicating challenges in handling multi-tail predictions due to ambiguity and model reasoning limitations.
- On the ATOMIC2020 commonsense KG completion benchmark, GPT-3 shows limited performance, while ChatGPT generates more contextually relevant but less accurate responses, as confirmed by manual scoring.
- The integration of a pluggable entity embedding module improves factual knowledge recall in LAMA probing tasks, with BERT and RoBERTa showing measurable gains.
- LambdaKG enables effective sequential recommendation on ML-20m by leveraging PLM-generated movie embeddings, outperforming BERT4Rec under the same setup.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.