{"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/imposing-relation-structure-in-language-model","title":"Imposing Relation Structure in Language-Model Embeddings Using Contrastive Learning","arxiv_id":"2109.00840","date":"2021-09-02","proceeding":"CoNLL (EMNLP) 2021 11","authors":["Christos Theodoropoulos","James Henderson","Andrei C. Coman","Marie-Francine Moens"],"abstract":"Though language model text embeddings have revolutionized NLP research, their ability to capture high-level semantic information, such as relations between entities in text, is limited. In this paper, we propose a novel contrastive learning framework that trains sentence embeddings to encode the relations in a graph structure. Given a sentence (unstructured text) and its graph, we use contrastive learning to impose relation-related structure on the token-level representations of the sentence obtained with a CharacterBERT (El Boukkouri et al.,2020) model. The resulting relation-aware sentence embeddings achieve state-of-the-art results on the relation extraction task using only a simple KNN classifier, thereby demonstrating the success of the proposed method. Additional visualization by a tSNE analysis shows the effectiveness of the learned representation space compared to baselines. Furthermore, we show that we can learn a different space for named entity recognition, again using a contrastive learning objective, and demonstrate how to successfully combine both representation spaces in an entity-relation task.","url_abs":"https://arxiv.org/abs/2109.00840v2","url_pdf":"https://arxiv.org/pdf/2109.00840v2.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":"imposing-relation-structure-in-language-model","repo_url":"https://github.com/christos42/CLDR_CLNER_models","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"named-entity-recognition-1","task_name":"Named Entity Recognition"},{"task_slug":"named-entity-recognition-ner","task_name":"Named Entity Recognition (NER)"},{"task_slug":null,"task_name":"Relation"},{"task_slug":"relation-extraction","task_name":"Relation Extraction"},{"task_slug":"sentence","task_name":"Sentence"},{"task_slug":"sentence-embeddings","task_name":"Sentence Embeddings"},{"task_slug":"named-entity-recognition","task_name":"named-entity-recognition"}],"methods":[{"method_slug":"characterbert","method_name":"CharacterBERT"},{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"},{"method_slug":"gcn","method_name":"GCN"},{"method_slug":"supervised-contrastive-loss","method_name":"Supervised Contrastive Loss"}],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/relation-extraction-on-ade-corpus","task":"Relation Extraction","dataset":"Adverse Drug Events (ADE) Corpus","model":"CLDR + CLNER","rank_in_archive_order":10,"of":15,"metrics":{"NER Macro F1":"88.3","RE+ Macro F1":"79.97"},"uses_additional_data":false}],"syntology":{"atlas_url":null,"mcp":null,"developers":"https://syntology.ai/developers"},"arxiv_metadata":null,"syntology_extracted_results":null}