{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/kglm-integrating-knowledge-graph-structure-in","title":"KGLM: Integrating Knowledge Graph Structure in Language Models for Link Prediction","arxiv_id":"2211.02744","date":"2022-11-04","proceeding":null,"authors":["Jason Youn","Ilias Tagkopoulos"],"abstract":"The ability of knowledge graphs to represent complex relationships at scale has led to their adoption for various needs including knowledge representation, question-answering, and recommendation systems. Knowledge graphs are often incomplete in the information they represent, necessitating the need for knowledge graph completion tasks. Pre-trained and fine-tuned language models have shown promise in these tasks although these models ignore the intrinsic information encoded in the knowledge graph, namely the entity and relation types. In this work, we propose the Knowledge Graph Language Model (KGLM) architecture, where we introduce a new entity/relation embedding layer that learns to differentiate distinctive entity and relation types, therefore allowing the model to learn the structure of the knowledge graph. In this work, we show that further pre-training the language models with this additional embedding layer using the triples extracted from the knowledge graph, followed by the standard fine-tuning phase sets a new state-of-the-art performance for the link prediction task on the benchmark datasets.","url_abs":"https://arxiv.org/abs/2211.02744v2","url_pdf":"https://arxiv.org/pdf/2211.02744v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"kglm-integrating-knowledge-graph-structure-in","repo_url":"https://github.com/ibpa/kglm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"fraud-detection","task_name":"Fraud Detection"},{"task_slug":"knowledge-graph-completion","task_name":"Knowledge Graph Completion"},{"task_slug":"knowledge-graphs","task_name":"Knowledge Graphs"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"link-prediction","task_name":"Link Prediction"},{"task_slug":"question-answering","task_name":"Question Answering"},{"task_slug":"recommendation-systems","task_name":"Recommendation Systems"},{"task_slug":null,"task_name":"Relation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/link-prediction-on-fb15k-237","task":"Link Prediction","dataset":"FB15k-237","model":"KGLM","rank_in_archive_order":49,"of":75,"metrics":{"Hits@1":"0.200","Hits@10":"0.468","Hits@3":"0.314","MR":"125.9","MRR":".289"},"uses_additional_data":false},{"leaderboard":"/sota/link-prediction-on-umls","task":"Link Prediction","dataset":"UMLS","model":"KGLM","rank_in_archive_order":2,"of":10,"metrics":{"Hits@10":"0.995","MR":"1.19"},"uses_additional_data":false},{"leaderboard":"/sota/link-prediction-on-wn18rr","task":"Link Prediction","dataset":"WN18RR","model":"KGLM","rank_in_archive_order":8,"of":75,"metrics":{"Hits@1":"0.330","Hits@10":"0.741","Hits@3":"0.538","MR":"40.18","MRR":"0.467"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2211.02744","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2211.02744"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ibpa/kglm","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":5},"by_repo_kind":{"official":{"samples":5,"ran":0,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"2ce92b702160bbc7","entry":"calc_chunksize","repo":"ibpa/kglm","repo_kind":"official","path":"src/utils/utils.py","file_url":"https://github.com/ibpa/kglm/blob/HEAD/src/utils/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"2ce92b702160bbc7"}},{"code_sha256_prefix":"5f35d379d18bcd19","entry":"load_pkl","repo":"ibpa/kglm","repo_kind":"official","path":"src/utils/utils.py","file_url":"https://github.com/ibpa/kglm/blob/HEAD/src/utils/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5f35d379d18bcd19"}},{"code_sha256_prefix":"18b9c7deeedbe427","entry":"preprocess_data","repo":"ibpa/kglm","repo_kind":"official","path":"src/utils/preprocess_data.py","file_url":"https://github.com/ibpa/kglm/blob/HEAD/src/utils/preprocess_data.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"18b9c7deeedbe427"}},{"code_sha256_prefix":"91aa29c918ad6d38","entry":"read_data","repo":"ibpa/kglm","repo_kind":"official","path":"src/utils/utils.py","file_url":"https://github.com/ibpa/kglm/blob/HEAD/src/utils/utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"91aa29c918ad6d38"}},{"code_sha256_prefix":"23a2b85946f4ccc3","entry":"set_logging","repo":"ibpa/kglm","repo_kind":"official","path":"src/utils/logging.py","file_url":"https://github.com/ibpa/kglm/blob/HEAD/src/utils/logging.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"23a2b85946f4ccc3"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}