# IECI: A Pipeline Framework for Iterative Event Causal Identification with Dynamic Inference Chains
## 3 Methodology
### Prompt-Based Event Detection
#### 3.1.4 Event Prediction  
The output of the table after cross-attention is \(\rm H^{dec}\), and each slot vector \(\rm h^{(slot)}\in\mathbb{R}^{d}\) is used to predict the start and end positions of events. Two learnable vectors \(\rm w_{start}\), \(\rm w_{end}\in\mathbb{R}^{d}\) are introduced, and the slot vectors are subjected to dot-product operation with the context to compute their scoring corresponding to each token as start and end:  
\[\rm q^{start}=h^{(slot)}\bigodot w_{start}, \tag{10}\]  
\[\rm q^{end}=h^{(slot)}\bigodot w_{end}, \tag{11}\]  
Then, with the context sequence \(\rm H^{ctx}=\left[h_{1}^{ctx},\dots,h_{L}^{ctx}\right]\) for correlation calculation to generate position scoring:  
\[\rm score_{i}^{start}=<h_{i}^{ctx},q^{start}>, \tag{12}\]  
\[\rm score_{i}^{end}=<h_{i}^{ctx},q^{end}>, \tag{13}\]where \(\rm h_{i}^{\rm ctx}\) denotes the hidden vector of the i-th token of the context. \(<\,,\,.>\) denotes the inner product operation, which measures the matching degree. The score \(\rm score_{i}^{start/end}\) indicates the scoring of the slot at the i-th position as a potential start or end point of the event span.  
Because a single slot may correspond to multiple candidate spans, a structural selector is introduced to determine whether each span should be retained.  
For candidate span \(\rm\left(s_{j},e_{j}\right)\), the fusion vector is formed after concatenating its contextual representation:  
\[g_{j}=\left[Z_{g_{j}};z_{e_{j}}\right], \tag{14}\]  
Use a linear classifier to determine its confidence level:  
\[\hat{P}_{j}=\sigma\left(w^{T}g_{j}+b\right), \tag{15}\]  
where \(\sigma\) is the Sigmoid and \(\hat{p}\in[0,1]\) is the prediction confidence.  
In the training phase, the model may predict multiple candidate events, while the annotated data typically provide only a few or a single ground-truth labels. The Hungarian matching algorithm is introduced to optimally match the predictions with the true labels to address this mismatch.  
Each predicted span \(\rm\left(\hat{s_{i}},e_{i}\right)\) is matched with the corresponding true span \(\rm\left(s_{i},e_{i}\right)\). If the predicted number is more than the true number, zero-padding is applied to maintain alignment. After matching, losses are computed using cross-entropy losses for the start and end positions, respectively:  
\[\mathcal{L}_{\rm start}=\frac{1}{N}{\sum_{i=1}^{N}CE(score_{i}^{start},s_{i})}, \tag{16}\]  
\[\mathcal{L}_{\rm end}=\frac{1}{N}{\sum_{i=1}^{N}CE(score_{i}^{end},e_{i})}, \tag{17}\]  
The final loss is  
\[\mathcal{L}_{\rm span}=\frac{1}{2}(\mathcal{L}_{\rm start}+\mathcal{L}_{\rm end }), \tag{18}\]  
After averaging over all samples and event types within the batch, the overall loss is  
\[\mathcal{L}_{\rm total}=\frac{1}{B}{\sum_{b=1}^{B}\frac{1}{M_{b}}{\sum_{j=1}^{ M_{b}}{\sum_{j=1}^{M_{b}}{\mathcal{L}_{\rm span}^{(bj)}}}}}, \tag{19}\]  
B denotes the size of the batch size, \(\rm M_{b}\) denotes the number of event slots in the b-th sample, and \(\mathcal{L}_{\rm span}^{(b,j)}\) denotes the loss value of the j-th slot.