## 3 Framework
### Path Distance-Weighted Attention (PDWA) Model  
**Theoretical foundation:** The PDWA mechanism is grounded in the semantic similarity hypothesis for cross-document reasoning: document paths with higher semantic similarity should receive proportionally higher attention weights during relation inference. This principle is formalized through three key components: (1) _Semantic distance computation_ using normalized cosine similarity in learned representation space; (2) _distance-to-weight transformation_, ensuring semantically closer paths receive exponentially higher attention; and (3) _attention matrix adjustment_, that preserves the original attention distribution while incorporating semantic proximity bias. This approach provides a principled method for attention allocation that goes beyond uniform weighting by explicitly modeling the semantic relationships between document paths. To account for varying semantic distances between document paths in feature space, our approach adjusts attention weights accordingly. Path pairs with shorter semantic distances (exhibiting higher semantic similarity) should intuitively receive greater attention compared to paths with larger semantic gaps. We therefore introduce a \"document path-pair distance\" mechanism that applies corrective weights to the attention scores between path pairs, ensuring that semantically similar paths contribute more substantially to the attention matrix computation. For any document path \(p\), we aim to identify its most relation-relevant elements with respect to the target relation \(r\). We accomplish this by calculating the sentence \(s\) most relevant to the target relation through an attention network, which serves as the path's mapping in the target relation space: \(f:P\times R\longrightarrow S\). For a document path pair \(p_{i}\) and \(p_{j}\), we first derive their sentence representations \(s_{i}\) and \(s_{j}\) using an attention mechanism that employs the target relation representation as the query vector and sentence representations as both key and value vectors:  
\[s =\text{Attention}(r_{ht},s,s) \tag{17}\] \[=\text{Softmax}\left(\frac{W^{Q}p_{ht}W^{K}s^{\top}}{\sqrt{d_{k }}}\right)s \tag{18}\]  
Here, \(s\) represents sentence embeddings within the document path (computed by averaging word embeddings), and \(r_{ht}\) denotes the target relation representation. Subsequently, these sentence representations are processed through a binary classification linear layer that produces a probability distribution indicating the likelihood of each sentence being selected. Using GumbelSoftmax, we sample the highest-probability sentence to serve as the mapping vector \(s_{i}\) of path \(p_{i}\) in the target relation space. \[s_{i}=GumbelSoftmax(s) \tag{19}\]  
GumbelSoftmax is calculated as follows:  
\[\pi(\bar{X})=Linear(\bar{X}) \tag{20}\]  
\[z^{st}=\frac{exp(\frac{\xi_{i}+log\pi(x_{i})}{\tau})}{\sum_{j=1,\dots,L}exp( \frac{\xi_{j}+log\pi(x_{j})}{\tau})} \tag{21}\]  
where \(g_{i}=-log(-log(u_{i}))\), \(u_{i}\sim U(0,1)\) is Gumbel noise, \(L\) is the number of path words of the document, and \(\tau\) is the temperature parameter that controls the smoothness of the sample; a lower \(\tau\) is closer to the true discrete distribution. Consider using the similarity between vectors \(s_{i}\) and \(s_{j}\) as the basis for calculating the attention weights for the correspondence relation sub-matrix between \(p_{i}\) and \(p_{j}\). If thevectors related to the target in the two paths are more similar in the feature space, the distance between the two document paths will be closer. And in the original attention matrix, the attention weights of the corresponding sub-matrix for these two paths should be larger.