KnowRA: Knowledge Retrieval Augmented Method for Document-level Relation Extraction with Comprehensive Reasoning Abilities
Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. Main Track. Pages 8186-8194.
https://doi.org/10.24963/ijcai.2025/910
Keywords
- Data Mining: DM: Mining text, web, social media
- Natural Language Processing: NLP: Information extraction
- Knowledge Representation and Reasoning: KRR: Common-sense reasoning
- Natural Language Processing: NLP: Applications
Abstract
Document-level relation extraction (Doc-RE) aims to extract relations between entities across multiple sentences. Therefore, Doc-RE requires more comprehensive reasoning abilities like humans, involving complex cross-sentence interactions between entities, contexts, and external general knowledge, compared to the sentence-level RE. However, most existing Doc-RE methods focus on optimizing single reasoning ability, but lack the ability to utilize external knowledge for comprehensive reasoning on long documents. To solve these problems, a knowledge retrieval augmented method, named KnowRA, was proposed with comprehensive reasoning to autonomously determine whether to accept external knowledge to assist Doc-RE. Firstly, we constructed a document graph for semantic encoding and integrated the co-reference resolution model to augment the co-reference reasoning ability. Then, we expanded the document graph into a document knowledge graph by retrieving the external knowledge base for common-sense reasoning and a novel knowledge filtration method was presented to filter out irrelevant knowledge. Finally, we proposed the axis attention mechanism to build direct and indirect associations with intermediary entities for achieving cross-sentence logical reasoning. Extensive experiments conducted on two datasets verified the effectiveness of our method compared to the state-of-the-art baselines. Our code is available at https://anonymous.4open.science/r/KnowRA.
- [Beltagy et al., 2020] Iz Beltagy, Matthew E. Peters, and Ar- man Cohan. Longformer: The long-document trans- former. In arXiv: 2004.05150, 2020.
- [Dai et al., 2022] Qin Dai, Benjamin Heinzerling, and Ken- taro Inui. Cross-stitching text and knowledge graph en- coders for distantly supervised relation extraction. In Pro- ceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 6947-6958, 2022.
- [Ding et al., 2022] Yang Ding, Jing Yu, Bang Liu, Yue Hu, Mingxin Cui, and Qi Wu. Mukea: Multimodal knowledge extraction and accumulation for knowledge-based visual question answering. In IEEE/CVF Conference on Com- puter Vision and Pattern Recognition, pages 5079-5088, 2022.
- [Fan et al., 2022] Shengda Fan, Shasha Mo, and Jianwei Niu. Boosting document-level relation extraction by min- ing and injecting logical rules. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 10311-10323, 2022.
- [Guo et al., 2023] Jia Guo, Stanley Kok, and Lidong Bing. Towards integration of discriminability and robustness for document-level relation extraction. In Proceedings of the 17th Conference of the European Chapter of the Asso- ciation for Computational Linguistics, pages 2598-2609, 2023.
- [Huang et al., 2023] Quzhe Huang, Yutong Hu, Shengqi Zhu, Yansong Feng, Chang Liu, and Dongyan Zhao. More than classification: A unified framework for event tempo- ral relation extraction. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics, pages 9631-9646, 2023.
- [Huang et al., 2024] Heyan Huang, Changsen Yuan, Qian Liu, and Yixin Cao. Document-level relation extraction via separate relation representation and logical reasoning. In ACM Transactions on Information Systems, pages 22:1- 22:24, 2024.
- [Li et al., 2021] Bo Li, Wei Ye, Canming Huang, and Shikun Zhang. Multi-view inference for relation extraction with uncertain knowledge. In Thirty-Fifth AAAI Conference on Artificial Intelligence, pages 13234-13242, 2021.
- [Man et al., 2022] Hieu Man, Nghia Trung Ngo, Linh Ngo Van, and Thien Huu Nguyen. Selecting optimal context sentences for event-event relation extraction. In Thirty- Sixth AAAI Conference on Artificial Intelligence, pages 11058-11066, 2022.
- [Orogat and El-Roby, 2022] Abdelghny Orogat and Ahmed El-Roby. Smartbench: Demonstrating automatic genera- tion of comprehensive benchmarks for question answering over knowledge graphs. In Proc. VLDB Endow., pages 3662-3665, 2022.
- [Peng et al., 2022] Xingyu Peng, Chong Zhang, and Ke Xu. Document-level relation extraction via subgraph reason- ing. In Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence, pages 4331-4337, 2022. IJCAI
- [Qi et al., 2024] Kunxun Qi, Jianfeng Du, and Hai Wan. End-to-end learning of logical rules for enhancing document-level relation extraction. In Proceedings of the 62nd Annual Meeting of the Association for Computa- tional Linguistic, pages 7247-7263, 2024.
- [Sun et al., 2023] Qi Sun, Kun Huang, Xiaocui Yang, Pengfei Hong, Kun Zhang, and Soujanya Poria. Uncer- tainty guided label denoising for document-level distant relation extraction. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics, pages 15960-15973, 2023.
- [Tan et al., 2022a] Qingyu Tan, Ruidan He, Lidong Bing, and Hwee Tou Ng. Document-level relation extraction with adaptive focal loss and knowledge distillation. In Findings of the Association for Computational Linguistics, pages 1672-1681, 2022.
- [Tan et al., 2022b] Qingyu Tan, Lu Xu, Lidong Bing, Hwee Tou Ng, and Sharifah Mahani Aljunied. Revisit- ing docred -addressing the false negative problem in rela- tion extraction. In Proceedings of the 2022 Conference on Empirical Methods in NaturalLanguage Processing, pages 8472-8487, 2022.
- [Vaswani et al., 2017] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Sys- tems 30: Annual Conference on Neural Information Pro- cessing Systems, pages 5998-6008, 2017.
- [Wang et al., 2022a] Xinyi Wang, Zitao Wang, Weijian Sun, and Wei Hu. Enhancing document-level relation extrac- tion by entity knowledge injection. In The Semantic Web - ISWC 2022 -21st International Semantic Web Conference, pages 39-56, 2022.
- [Wang et al., 2022b] Ye Wang, Xinxin Liu, Wenxin Hu, and Tao Zhang. A unified positive-unlabeled learning frame- work for document-level relation extraction with different levels of labeling. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 4123-4135, 2022.
- [Wei and Li, 2022] Ying Wei and Qi Li. Sagdre: Sequence- aware graph-based document-level relation extraction with adaptive margin loss. In The 28th ACM SIGKDD Con- ference on Knowledge Discovery and Data Mining, pages 2000-2008, 2022.
- [Xu et al., 2021a] Benfeng Xu, Quan Wang, Yajuan Lyu, Yong Zhu, and Zhendong Mao. Entity structure within and throughout: Modeling mention dependencies for document-level relation extraction. In Thirty-Fifth AAAI Conference on Artificial Intelligence, pages 14149-14157, 2021.
- [Xu et al., 2021b] Wang Xu, Kehai Chen, and Tiejun Zhao. Discriminative reasoning for document-level relation ex- traction. In Findings of the Association for Computational Linguistics, pages 1653-1663, 2021.
- [Xu et al., 2021c] Wang Xu, Kehai Chen, and Tiejun Zhao. Document-level relation extraction with reconstruction. In Thirty-Fifth AAAI Conference on Artificial Intelligence, pages 14167-14175, 2021.
- [Xu et al., 2022] Wang Xu, Kehai Chen, Lili Mou, and Tiejun Zhao. Document-level relation extraction with sen- tences importance estimation and focusing. In Proceed- ings of the 2022 Conference of the North American Chap- ter of the Association for Computational Linguistics: Hu- man Language Technologies, pages 2920-2929, 2022.
- [Xu et al., 2024] Zhentao Xu, Mark Jerome Cruz, Matthew Guevara, Tie Wang, Manasi Deshpande, Xiaofeng Wang, and Zheng Li. Retrieval-augmented generation with knowledge graphs for customer service question answer- ing. In Proceedings of the 47th International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 2905-2909, 2024.
- [Xue et al., 2022] Zhongxuan Xue, Rongzhen Li, Qizhu Dai, and Zhong Jiang. Corefdre: Document-level re- lation extraction with coreference resolution. In arXiv: 2202.10744, 2022.
- [Yang et al., 2023] Zhe Yang, Yi Huang, and Junlan Feng. Learning to leverage high-order medical knowledge graph for joint entity and relation extraction. In Findings of the Association for Computational Linguistics: ACL 2023, pages 9023-9035, 2023.
- [Yao et al., 2019] Yuan Yao, Deming Ye, Peng Li, Xu Han, Yankai Lin, Zhenghao Liu, Zhiyuan Liu, Lixin Huang, Jie Zhou, and Maosong Sun. Docred: A large-scale document-level relation extraction dataset. In Proceedings of the 57th Conference of the Association for Computa- tional Linguistics, pages 764-777, 2019.
- [Ye et al., 2020] Deming Ye, Yankai Lin, Jiaju Du, Zheng- hao Liu, Peng Li, Maosong Sun, and Zhiyuan Liu. Coref- erential reasoning learning for language representation. In Proceedings of the 2020 Conference on Empirical Meth- ods in Natural Language Processing, pages 7170-7186, 2020.
- [Yuan et al., 2023] Changsen Yuan, Heyan Huang, Yixin Cao, and Yonggang Wen. Discriminative reasoning with sparse event representation for document-level event-event relation extraction. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics, pages 16222-16234, 2023.
- [Zaporojets et al., 2021] Klim Zaporojets, Johannes Deleu, Chris Develder, and Thomas Demeester. Dwie: an entity- centric dataset for multi-task document-level information extraction. In Inf. Process. Manag., page 102563, 2021.
- [Zeng et al., 2020] Shuang Zeng, Runxin Xu, Baobao Chang, and Lei Li. Double graph based reasoning for document-level relation extraction. In Proceedings of the 2020 Conference on Empirical Methods in Natural Lan- guage Processing, pages 1630-1640, 2020.
- [Zeng et al., 2021] Shuang Zeng, Yuting Wu, and Baobao Chang. Sire: Separate intra-and inter-sentential reason- ing for document-level relation extraction. In Findings of the Association for Computational Linguistics, pages 524- 534, 2021.
- [Zhang et al., 2021a] Ningyu Zhang, Xiang Chen, Xin Xie, Shumin Deng, Chuanqi Tan, Mosha Chen, Fei Huang, Luo Si, and Huajun Chen. Document-level relation extraction as semantic segmentation. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, pages 3999-4006, 2021. IJCAI
- [Zhang et al., 2021b] Zhenyu Zhang, Bowen Yu, Xiaobo Shu, and Tingwen Liu. Na-aware machine reading com- prehension for document-level relation extraction. In Re- search Track -European Conference ECML/ PKDD, pages 580-595, 2021.
- [Zhang et al., 2023a] Liang Zhang, Jinsong Su, Zijun Min, Zhongjian Miao, Qingguo Hu, Biao Fu, Xiaodong Shi, and Yidong Chen. Exploring self-distillation based rela- tional reasoning training for document-level relation ex- traction. In Thirty-Seventh AAAI Conference on Artificial Intelligence, pages 13967-13975, 2023.
- [Zhang et al., 2023b] Ruoyu Zhang, Yanzeng Li, and Lei Zou. A novel table-to-graph generation approach for document-level joint entity and relation extraction. In Pro- ceedings of the 61st Annual Meeting of the Association for Computational Linguistics, pages 10853-10865, 2023.
- [Zhou et al., 2021] Wenxuan Zhou, Kevin Huang, Tengyu Ma, and Jing Huang. Document-level relation extraction with adaptive thresholding and localized context pooling. In Thirty-Fifth AAAI Conference on Artificial Intelligence, pages 14612-14620, 2021.
References were extracted automatically from the PDF and may contain errors.
Full text extracted automatically from the PDF; figures, tables and equations may differ. The PDF is the version of record.
1 Introduction
The document-level relation extraction (Doc-RE) task aims to extract pre-defined relation triples from documents containing multiple sentences. Compared with the existing sentencelevel RE task, Doc-RE is not only more complicated but also more fundamental for real-world applications, like retrieval augmented generation (RAG) method for large language model (LLM) [Dai et al., 2022; Yang et al., 2023;
Xu et al., 2024], automatic question and answering [Ding et al., 2022; Orogat and El-Roby, 2022], and event extraction [Man et al., 2022; Huang et al., 2023; Yuan et al., 2023].
Obviously, Doc-RE models need to have comprehensive reasoning abilities for Doc-RE. Previous studies divided these abilities into four categories [Yao et al., 2019]: pattern recognition, co-reference reasoning, common-sense reasoning, and logical reasoning, as shown in Figure 1.
| Reasoning Type | Examples |
|---|---|
| Pattern recognition | [S1] Niklas Bergqvist (born 6 October 1962 in Stockholm) is a Swedish songwriter ... [S2] ... |
| Relation: < Niklas Bergqvist, date_of_birth, 6 October 1962 > | |
| Co-reference reasoning | [S1] Dwight Tillery is an American politician of the Democratic Party ...[S2] ... [S3] He also holds a law degree from the University of Michigan Law School. |
| He Dwight Tillery University of Michigan Law School Co-reference R1: educated_at R2: educated_at <head entity> <tail entity> | |
| Common- sense reasoning | [S1] The news that British's Prince Harry is engaged to his partner Meghan Markle has attracted widespread attention from England, America and around the world. [S2] … [S10] Meghan Markle's parents Thomas Markle and Doria Ragland said in a statement: ... |
| Prince Harry Thomas Markle Megan Markle America R1: spouse R2: parent R3: country_of_citizenship Reasoned from external knowledge | |
| Logical reasoning | [S1] Eminem Show is the fourth studio album by American rapper Eminem, rel-eased on May 26 2002 by …[S2] It includes the commercially successful singles "Without Me", …, [S3] … |
| Eminem Show It R1: publication_date R2: part_of R3: publication_date Logic reasoned with intermediary words: {Eminem Show, It includes…} W M May 26 2002 Without Me |
However, the existing Doc-RE models were mostly optimized for partial reasoning abilities but lacked comprehensive reasoning abilities. For pattern recognition, most recent methods constructed graph structures [Xu et al., 2021c; Wei and Li, 2022; Peng et al., 2022; Zhang et al., 2023b] to establish long-distance associations between entities. For logical reasoning, several models used bridge/intermediary entities or evidence sentences to establish relations between two entities that are not directly connected [Zhang et al., 2023a; Huang et al., 2024; Xu et al., 2022]. Considering that entity mentions often appear in the form of co-reference pronouns in the document, methods based on co-reference reasoning have been proposed [Ye et al., 2020] and focused on identifying co-reference pronouns of entities, which were used as bridge entities to establish indirect relations between entities.
Also, the Doc-RE model requires the ability of commonsense reasoning because some relations cannot be directly inferred from the document itself, and external knowledge is needed to assist in Doc-RE. However, few existing Doc-RE models combined external knowledge for common sense reasoning [Wang et al., 2022a].
To summarize, the main challenges for Doc-RE lie in: 1) How to integrate the comprehensive reasoning abilities required by Doc-RE. 2) How to represent and integrate external knowledge with the internal semantics of the document. 3) How to autonomously determine whether to accept external knowledge, considering that external knowledge may be lagging, one-sided, or even wrong.
To solve above mentioned problems, we proposed a comprehensive reasoning method for Doc-RE with knowledge retrieval augmentation and filtration, as shown in Figure 2. Firstly, a heterogeneous multi-level document graph was constructed for semantic encoding of entities, mentions, and sentences of the document. Then, a pre-trained co-reference resolution model was introduced to establish associations between entities and their corresponding pronouns for coreference reasoning. Moreover, the document graph was extended with the retrieved external knowledge for commonsense reasoning. On this basis, a novel knowledge filtration method was proposed to determine whether to accept external knowledge. Finally, an axial attention method was proposed to use intermediary entities for realizing logical reasoning across multiple sentences.
The main contributions of our work are three folds:
- A comprehensive method for Doc-RE was proposed by achieving document semantic encoding with a multilayer heterogeneous document graph, integrating the coreference resolution model, injecting external knowledge, and introducing the axial attention mechanism.
- A knowledge augmentation and filtration method was proposed to judge whether to accept external knowledge, for filtering out irrelevant knowledge.
- Extensive experiments performed on two public datasets demonstrated the superiority of our method compared to the state-of-the-art (SOTA) baselines.
2 Our Methodology
2.1 Construction of document graph
Firstly, a pre-trained language model was employed to perform semantic encoding operations on the input document. Then, a multi-level heterogeneous document graph was present to model the connections among different entities, mentions, sentences in a document, defined as follows:
Definition 1. Multi-level Heterogeneous Document Graph (MHDG). MHDG=< V,E >, where V = {v|v ∈ V M ⋃ V S ⋃ V D } represents the node set and E = {< vi, vj > |vi, vj ∈ V, i ̸= j}, which represents edges between nodes vi and vj .
According to definition 1, we defined three types of node in MHDG: Mention node (V M ), Sentence node (V S ), and Document node (V D ). Then, four types of edges were given:
- Document-Sentence Edge: EDS = {< vD i , vS j > |vD i ∈ V D , vS j ∈ V S }. The document node and all sentence nodes are connected through these edges.
- Sentence-Sentence Edge: ESS = {< vS i , vS j > |vS i , vS j ∈ V S , i ̸= j}. Two adjacent sentences are connected by sentence-sentence edges.
- Mention-Sentence Edge: EMS = {< vM i , vS j > |vM i ∈ V M , vS j ∈ V S }, connecting mention nodes and the sentence node appearing with the same one sentence.
- Mention-Mention Edge: Two mention nodes are connected by the Mention-Mention Edge (MME), which can be further divided into two categories: Co-Occurrence Mention-Mention Edge (CO-MME) means different mentions appear in the same sentence, formalized as: ECO-MME = {< vM i , vM j > |vM i , vM j ∈ V M }. CoReference Mention-Mention Edge (CR-MME) means that different mentions refer to the same entity, formalized as: ECR-MME = {< vM i , vM j > |vM i , vM j ∈ V M }.
Then, the semantic representation was performed on the MHDG with a graph-based neural network, denoted as:
where Tinput represents the input tokenized sequence, L represents the length of the document. The representations of three kinds of nodes are as follows:
where HD ∈ Rd represents the d dimension semantic representation of the document node. Hmij represents the semantic embedding of mention node for the j-th mention of the i-th entity, and P i,j e represents the position of the j-th mention of the i-th entity, and "*" denotes for the special symbol placed before the mention mij . HSi represents the semantic representation of sentence node Si.
Then, the Graph Attention Network (GAT) was used to calculate association score AS(ei,j ) for each edge between node i and j:

[S1] Dwight Tillery is an American politician of the Democratic Party… [S2] Tillery grew up in the city's West End … [S3] … [S4] Tillery served as mayor of Cincinnati from 1991 to 1993. [S5] … [S6] … [S7] ... supporting the election campaigns of African American candidates.
Figure 2: Overview of the proposed comprehensive reasoning method with knowledge augmentation and filtration for Doc-RE.
where ⊕ represents the concatenation operation. The updated node representations based on MHDG are as follows:
where Wα ∈ Rd and Wβ ∈ Rd×d are trainable parameters. N(i) represents the number of adjacent nodes to node i.
2.2 Co-reference reasoning component for Doc-RE
To solve the co-reference reasoning problem, we firstly pretrained a co-reference resolution model, Mcoref , and then used it to identify the co-reference pronouns, as follows:
where Ci represents the set of identified co-reference pronouns and nci represents the number of the co-reference pronouns. Then, we used attention matrix between each input token and recognized co-reference pronouns to update semantic representations of co-reference pronouns, as follows:
where A ∈ RH×L×L is the attention matrix of all input tokens, H represents the number of attention heads, and L represents the length of input tokens. Qi ∈ RL, represents the averaged vector of attention value of entity Ei to its coreference pronouns. Ah,k i represents the h-th attention head of entity Ei to its k-th co-reference word. P i,k c represents the position of each co-reference pronoun.
Finally, we obtained the semantic representation of cik as shown in formula (11), where Q′i [P i,k c ] ∈ Rnci,k represents the normalized attention value of entity Ei to its k-th coreference pronoun. hP i,k c represents the semantic embedding of the co-reference pronoun ci,k.
2.3 Common-sense reasoning with knowledge augmentation and filtration
Construction of knowledge-augmented document graph
To introduce external knowledge for common-sense reasoning, we further constructed a knowledge-augmented document graph, denoted as K-MHDG.
Definition 2. Knowledge-retrieval-augmented Multi - level heterogeneous document graph (K-MHDG). KMHDG=< V, E ∪Eknow >, where V = {v|v ∈ V {M,S,D} } represents the entity node set, E ⊆ {< vi, vj > |vi,j ∈ V, i ̸= j} represents the relation edges between node vi and vj in MHDG, and Eknow represents the newly added edges, consisting of relations between entities, denoted as rknow, retrieved from the external knowledge base, formalized as: Eknow ⊆ {< vm, vn > |∃erknow =< vm, vn >∈ hasRel(QEi id , rknow,QEj id ), vm,n ∈ V M } .
We selected Wikidata as the external knowledge base to construct the K-MHDG. By utilizing the interface getQid(EntityName) provided by Wikidata, all possible entity identifiers, i.e., Qids, were obtained based on the corresponding entity name. Then, based on the hasRel(Qtid , rknow,Qhid ) interface in Wikidata, we can query all relation triples with the provided entity pairs. Finally, the newly retrieved relation ernew =< vM Enti , vM Entj > would be added to Eknow and the MHDG was augmented to K-MHDG.
Semantic encoding for the external knowledge
Based on K-MHDG, the representation of entity node Ei was updated as follows:
where ⊕ represents the concatenation operation, hmij represents the embedding of mention mij and nmi represents the number of mentions related to Ei. hcik and nci refer to the semantic embedding and number of the co-reference pronouns for entity Ei, respectively.
External knowledge filtration method
Considering that the external knowledge introduced is not always correct, we further proposed a new confidence-scorebased knowledge filtration method to help our model autonomously determine whether to accept external knowledge.
The confidence score for each edge, i.e., ei,j =< Ei, rk, Ej >, was denoted as τi,j and calculated as:
where diag(·) function represents the diagonal matrix with the vector rk as the diagonal element. The confidence score represents the likelihood of a relation existing between entity Ei and Ej. After calculating the confidence score, the entity representation of entity Ei was also updated as follows:
where σ(·) represents the sigmoid function, which is used to convert confidence score into probabilities with values between 0 and 1. ri,j represents the set of relations that exist between entities Ei and Ej .
Then, we used the correct relation label set provided by the annotated training set to train the model in a way that increases the confidence score for correct relations and decreases the confidence score for incorrect relations. The optimization function is:
(15)
where N represents the edge number in K-MHDG, and yn represents the annotated relation label in the training set, which value is 1 (correct relation) or 0 (incorrect relation).
2.4 Logical reasoning with axial attention
Semantic fusion based on common context of entity pair
Because Doc-RE is implemented based on the entity pairs, it is necessary to integrate context information into entity pairs for logical reasoning, not just context of individual entities.
Firstly, we used the attention mechanism proposed to obtain the context of the common concern of entity Ei and Ej, that is, the relevant context representation of entity pair < Ei, Ej >. The formula was given as follows:
where symbol "×" represents the outer product of embeddings, and "·" represents the dot product of embeddings.
Then, the semantic embedding for head and tail entities fused with the context of entity pair < Ei, Ej > was calculated as:
where zi and zj represent the entity embedding fused with the context information. W∗ ∈ Rd represents the trainable model parameters. Finally, the semantic representation of entity pair < Ei, Ej >, denoted as zi,j , was obtained.
Axial-attention-based method for logical reasoning across sentences
We arranged all entity pair representations zi,j in the document into an entity pair matrix of N × N, where N = |V | represents the number of entities. If there is an intermediary entity Ek between entity pair < Ei, Ej >, the purpose of our proposed method is to establish a multi-hop logical reasoning model by integrating semantic representations of all intermediary entities and the corresponding entity pairs.
In the entity pair matrix, the semantic information of the horizontal intermediary entity pair < Ei,Ek|k = 1, . . . ,N > in the same row was firstly fused into < Ei,Ej >, calculated as:
where qi,j, ki,j, vi,j = Wqzi,j,Wkzi,j,Wvzi,j is the query, key, and value vector obtained by linear transformation of zi,j. Wq,Wk,Wv ∈ Rd×d are query, key, and value vectors obtained by linear transformation.
Then, the similar operation was performed on all vertical entity pairs in the same column and calculated as follows:
Finally, all intermediary entity pairs < Ei,Ek > and < Ek,Ej > were fused and the final representation for < Ei, Ej > was obtained by :
Adaptive Relation Extraction Loss for Doc-RE
Considering Doc-RE is a multi-label classification task, we adopted adaptive threshold loss function [Zhou et al., 2021; Guo et al., 2023] with a threshold class, denoted as TH, to adaptively separate positive (R+) and negative (R-) relations:
where Li,j represents the probability that entity pair < Ei, Ej > belongs to each predefined relation type:
Through the joint training of the loss function LRE and LKRA, the final optimization function for Doc-RE is:
where λ is the pre-defined hyper-parameter.
3 Experiments and Analyses
3.1 Experimental Settings
Datasets. We evaluated our model on two public datasets for document-level RE. Re-DocRED [Tan et al., 2022b] is a high-quality revised version of DocRED [Yao et al., 2019]. Re-DocRED corrects the false negatives problem in dataset DocRED and contains 3,053 documents for training, 500 for development, and 500 for the test set. DWIE [Zaporojets et al., 2021] is sampled and annotated from the news website Deutsche Welle, containing 602, 98, 99 documents for training, development, and testing, respectively, with 43,373 entities, 21,749 relational facts, and 65 relation types.
Evaluation metrics. We used the micro F1 (F1), ignore F1 (Ign F1), Intra F1, and Inter F1 as the metrics for model performance, following previous work [Wang et al., 2022b]. Ign F1 is a revised version of F1, which excludes the shared relations between the training and development/test set. Intra F1 is used to evaluate F1 of relation triples that appear in the same sentence. Inter F1 is used to evaluate F1 of crosssentence relation triples.
3.2 Baselines
According to different model structures, the following models were selected for performance comparison.
- Sequence-based models: These models used different deep neural structures for relation extraction, including convolution neural network (CNN), Bi-LSTM, and Context-Aware LSTM [Yang et al., 2023].
- Graph-based models: These models used graph neural network for Doc-RE, including GAIN [Zeng et al., 2020], SIRE [Zeng et al., 2021], DRN [Xu et al., 2021b], SagDRE [Wei and Li, 2022].
- Transformer-based models: These Transformer-based models [Vaswani et al., 2017] include SSAN [Xu et al., 2021a], ATLOP [Zhou et al., 2021], ATLOP-MILR [Fan et al., 2022], DocuNET [Zhang et al., 2021a], KDDocRE [Tan et al., 2022a], UGDRE [Sun et al., 2023], and JMRL-DREEAM [Qi et al., 2024]. It should be
noted that documents in dataset DWIE are quite long, with over 50% of documents exceeding 768 tokens, and the maximum length reaches 2560 tokens. Therefore, for dataset DWIE, we replaced RoBERTa-large with LongFormer [Beltagy et al., 2020] as the backbone model, which supports a maximum of 4096 tokens. For dataset Re-DocRED, baseline models used RoBERTa-large as the cornerstone model.
- LLM-based models: We used 13B LLAMA-2 1 model as the large language model for Doc-RE, finetuned with LoRA 2 .
Considering that these baseline models used different datasets and cornerstone models in their original papers, we tried our best to rerun and fine-tune these models for fair comparison. For example, the rerun model JMRL-DREEAM even achieved better performance on dataset Re-DocRED compared to its original paper.
3.3 Main Results
Table 1 listed the performance of models on two datasets. We observed that: 1) Our KnowRA model outperformed other baseline models in almost metrics on two datasets. For dataset Re-DocRED and DWIE, KnowRA surpassed the existing SOTA model, JMRL-DREEAM, by 0.28 and 1.13 in F1 score, respectively. These experiments proved the superiority of our model for Doc-RE. 2) In terms of Intraand Inter-F1, our model achieved the second-best results in dataset Re-DocRED and the best performance in dataset DWIE. These experimental results proved the advantages of our model in cross-sentence relation extraction. Meanwhile, for dataset DWIE with longer document length, our method achieved better performance compared to the SOTA models, i.e., KD-DocRE and JMRL-DREEAM, which indicates that our model has stronger semantic reasoning ability for extracting long-distance document-level relations. 3) For both datasets, our model outperformed the LLaMA-2-based model in all metrics, which implies that large language models need to improve their effectiveness through relevant optimization technologies when applied to downstream tasks.
3.4 Ablation Experiments
Ablation experiments were shown in Table 2. For dataset ReDocRED, after removing the document graph (denoted as "- w/o graph") and axial attention (denoted as "-w/o axial atten."), the model performance decreased by 1.07 and 1.01 in F1 score, respectively. When both the two components were removed (denoted as "-w/o graph+axial"), the performances on F1 decreased by 1.28. The removal of the co-reference reasoning component (denoted as "-w/o coref ") also leads to a drop of 0.70 in terms of F1.
In addition, the common-sense reasoning component based on the knowledge-retrieval-augmentation (denoted as "-w/o knowAug.", representing the removal of the K-MHDG) is the most important component, as the F1 score decreased the most (-1.10 on Re-DocRED and -1.02 on DWIE) when it was removed. Also, when the knowledge filtration method (denoted as "-w/o knowFilt.") was removed from our complete model, the F1 score decreased by 0.97 and 0.79 on dataset Re-DocRED and DWIE, respectively, which proves that the filtration of the external knowledge is necessary for filtering out noise information and boosting performance. For dataset DWIE, we observed similar phenomena, which verifies the effectiveness of our comprehensive reasoning components.
1 https://github.com/meta-llama/llama.
2 https://github.com/microsoft/LoRA.
| Models | Re-DocRED | DWIE | ||||||
|---|---|---|---|---|---|---|---|---|
| Ign F1 | F1 | Intra-F1 | Inter-F1 | Ing F1 | F1 | Intra-F1 | Inter-F1 | |
| CNN [Yao et al., 2019] BiLSTM [Yao et al., 2019] Context-Aware [Yao et al., 2019] | 54.28±0.33 58.08±0.38 58.29±0.26 | 56.20±0.35 60.03±0.30 60.19±0.21 | 59.61±0.62 62.99±0.07 63.18±0.32 | 53.54±0.67 57.70±0.51 57.82±0.17 | 40.24±0.19 55.07±0.18 56.80±0.18 | 51.84±0.19 66.21±0.25 66.05±0.17 | 51.84±0.19 68.58±0.28 69.24±0.39 | 51.31±0.63 64.78±0.38 63.54±0.43 |
| GAIN [Zeng et al., 2020] SIRE [Zeng et al., 2021] DRN [Xu et al., 2021b] SagDRE [Wei and Li, 2022] | 73.55±0.15 73.10±0.40 72.37±0.23 73.44±0.29 | 74.89±0.21 74.55±0.38 73.28±0.22 74.56±0.23 | 77.46±0.31 77.28±0.46 76.28±0.15 76.99±0.18 | 72.68±0.15 72.22±0.63 70.58±0.34 72.46±0.38 | 63.49±0.57 63.01±0.27 63.13±0.32 63.37±0.27 | 68.62±0.32 68.31±0.22 69.32±0.23 69.61±0.31 | 68.97±0.34 68.07±0.29 71.51±0.23 69.84±0.26 | 68.28±0.43 67.74±0.37 67.07±0.38 68.98±0.35 |
| SSAN [Xu et al., 2021a] ATLOP [Zhou et al., 2021] ATLOP-MILR [Sun et al., 2023] DocuNET [Zhang et al., 2021a] KD-DocRE [Tan et al., 2022a] UGDRE [Sun et al., 2023] JMRL-DREEAM [Qi et al., 2024] | 72.64±0.32 76.85±0.29 75.99±0.24 77.19±0.22 77.34±0.33 78.15±0.30 78.57±0.06 | 73.88±0.28 77.48±0.30 76.68±0.17 77.88±0.26 78.12±0.30 78.87±0.27 78.97±0.06 | 75.28±0.38 79.54±0.28 78.95±0.21 79.89±0.21 80.19±0.29 81.05±0.24 80.13±0.29 | 72.20±0.35 75.65±0.34 74.69±0.19 76.11±0.41 76.31±0.35 76.93±0.35 77.96±0.18 | 76.26±0.24 78.67±0.24 79.95±0.29 79.41±0.21 80.22±0.24 72.08±0.59 80.60±0.55 | 81.06±0.10 83.21±0.19 84.66±0.41 84.18±0.13 84.87±0.19 76.35±0.61 85.27±0.36 | 86.10±0.24 87.25±0.11 87.04±0.68 87.88±0.18 88.01±0.35 79.51±0.72 87.88±0.34 | 77.09±0.39 80.84±0.32 82.29±0.14 80.84±0.32 81.57±0.32 73.44±0.60 82.68±0.72 |
| LLaMA-2 | 46.84±0.40 | 47.02±0.43 | 45.66±0.88 | 72.42±0.29 | 80.57±0.69 | 82.37±0.58 | 79.74±0.88 | 82.84±0.31 |
| KnowRA (ours) | 78.39±0.32 | 79.25±0.16 | 80.42±0.33 | 76.99±0.28 | 81.48±0.32 | 86.40±0.22 | 88.17±0.09 | 83.83±0.45 |
| Variant Models | Re-DocRED | DWIE F1 | ||
|---|---|---|---|---|
| KnowRA | F1 79.25 | ∆ | 86.40 | ∆ |
| -w/o graph | 78.18 | -1.07 | 85.65 | -0.75 |
| -w/o coref | 78.55 | -0.70 | 86.02 | -0.38 |
| -w/o knowAug. | 78.15 | -1.10 | 85.38 | -1.02 |
| -w/o knowFilt. | 78.28 | -0.97 | 85.61 | -0.79 |
| -w/o axial atten. | 78.24 | -1.01 | 85.57 | -0.83 |
| -w/o graph+axial | 77.97 | -1.28 | 85.25 | -1.15 |
3.5 Effects of Intra- and Inter-sentence Reasoning
The number of sentence intervals was used to present the distance between the head and tail entities in a relation triple. According to the results shown in Figure 3, we found that: 1) When the head and tail entities are in the same sentence (intervals = 0), our model performed better than the baselines. 2) When the head and tail entities are from different sentences (intervals > 0), our model was also superior to other baselines. 3) The performance of all models gradually decreased with the increase of sentence intervals, which indicates that our model performed well in both intra- and inter-senetence reasoning.
3.6 Effects of Context Length
We conducted experiments to quantitatively evaluate the impact of the context length on the performance of Doc-RE. For dataset DWIE, the length of most documents (94.81%) exceeds the maximum length supported by the RoBERTalargebased encoder. To this end, we replaced the original encoders with longFormer [Beltagy et al., 2020].

The experimental results are shown in Figure 4 and we found that: 1) Longer context can greatly improve the performance of Doc-RE. 2) As the context length gradually increases, the performance of all models first improves, and then the growth rate gradually slows down. Similar trends were also observed on other baselines. These results proved that our model can outperform SOTA models in different context length, which indicates a good scalability for our model.
3.7 Impact of Knowledge-augmentedMethod
We conducted a hyper-parameter analysis on weight λ of the LKRA loss function to quantitatively evaluate the impact of the proposed knowledge-retrieval-augmentation method.
As shown in Figure 5, it can be observed that: 1) For both datasets, the model performance shows a trend of first improving and then decreasing with the increase of parameter λ. 2) Introducing external knowledge through our proposed knowledge augmentation method can improve the model performance for Doc-RE. However, too high the weight value λ would lead to a decline for the model performance. One possible explanation is that external knowledge may be wrong or inconsistent with the internal information of the document.


3.8 Case Study
Figure 6 shows the construction of K-MHDG by introducing the common-sense knowledge from the external knowledge base. The nodes in the figure represent entities, where the numbers indicate the identification index of the entities. The directed edges between nodes represent the relations between entities, the words on the edges represent the relation types, and numbers on edges represent the confidence score, i.e., τ.
Our knowledge augmentation method can extend the relation triples that were not annotated in the original dataset, identify the correct relation triples, denoted by the green ✓, and also filter out noise external knowledge and incorrect relation triples, which are denoted by the red ×.
4 RelatedWork
For pattern recognition and logical reasoning, existing models mainly used intermediary entities or evidence sentences to achieve logical reasoning [Yuan et al., 2023; Zhang et al., 2021b; Wei and Li, 2022]. However, evidence sentences are not always available. Peng et al. [2022] proposed a subgraph seasoning model for Doc-RE, which places emphasis on key entities and integrates various paths between entity/mention pairs into a subgraph for relation reasoning.

For co-reference reasoning, this type of model has positive effects on improving the performance of modeling long-distance reasoning by reducing ambiguity between coreference entities and mentions involving multiple sentences [Xue et al., 2022], Ye et al. [2020] proposed mention reference prediction method to equip the language model with the capacity for capturing the co-reference relations. Wang et al. [Wang et al., 2022a] distilled the co-reference reasoning ability into the relation extraction model.
However, for common-sense reasoning, using only the information in the current document makes it difficult to establish implicit associations and determine relation types between different entities/mentions in multiple sentences, without the help of common sense distilled from external knowledge [Li et al., 2021]. Existing models rarely incorporate external knowledge into the Doc-RE model. To solve this problem, we introduced external knowledge into our model with the knowledge filtration method.
5 Conclusions
In this paper, we presented a comprehensive reasoning reasoning model for Doc-RE. Concretely, the proposed knowledge document graph and three different reasoning components, i.e., graph-based semantic encoding, co-reference resolution, knowledge augmentation and filtration, and axial attention method were integrated into our KnowRA model to enhance the comprehensive reasoning abilities. Experiments conducted on two benchmarks datasets demonstrated the superiority of the proposed model in Doc-RE.
Acknowledgments
This work was supported by the National Natural Science Foundation of China (Nos. 61572250 and 62476135), Jiangsu Province Science & Tech Research Program (BE2021729), Open project of State Key Laboratory for Novel Software Technology, Nanjing University (KFKT2024B53), Jiangsu Province Frontier Technology Research and Development Program (BF2024005), Nanjing Science and Technology Research Project (202304016) and Collaborative Innovation Center of Novel Software Technology and Industrialization, Jiangsu, China.
@inproceedings{ijcai2025p910,
title = {KnowRA: Knowledge Retrieval Augmented Method for Document-level Relation Extraction with Comprehensive Reasoning Abilities},
author = {Mai, Chengcheng and Wang, Yuxiang and Gong, Ziyu and Wang, Hanxiang and Huang, Yihua},
booktitle = {Proceedings of the Thirty-Fourth International Joint Conference on
Artificial Intelligence, {IJCAI-25}},
publisher = {International Joint Conferences on Artificial Intelligence Organization},
editor = {James Kwok},
pages = {8186--8194},
year = {2025},
month = {8},
note = {Main Track},
doi = {10.24963/ijcai.2025/910},
url = {https://doi.org/10.24963/ijcai.2025/910},
}
TY - CPAPER TI - KnowRA: Knowledge Retrieval Augmented Method for Document-level Relation Extraction with Comprehensive Reasoning Abilities AU - Mai, Chengcheng AU - Wang, Yuxiang AU - Gong, Ziyu AU - Wang, Hanxiang AU - Huang, Yihua T2 - Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence, IJCAI-25 PB - International Joint Conferences on Artificial Intelligence Organization PY - 2025 SP - 8186 EP - 8194 DO - 10.24963/ijcai.2025/910 UR - https://doi.org/10.24963/ijcai.2025/910 ER -Copied
Machine-readable versions of this paper, for tools and AI agents: