# IECI: A Pipeline Framework for Iterative Event Causal Identification with Dynamic Inference Chains
## 3 Methodology
### Prompt-Based Event Detection
#### 3.1.1 Semantic-Based Context Embedding  
**Raw input is modeled with a subword mapping mechanism. ** The input of \(\text{C}=\{\text{c}_{1},\text{c}_{2},\dots,\text{c}_{n}\}\) is a character sequence of length \(n\), where \(w_{i}\) denotes the i-th character. After being tokenized by the BERT tokenizer based on the WordPiece algorithm [35], the character sequence is converted into subword sequences:  
\[\text{S}=\{\hat{w}_{1},\hat{w}_{2},\dots,\hat{w}_{m}\},\quad n\geq m, \tag{1}\]  
where \(\hat{w}_{j}\) denotes the j-th subword. The WordPiece algorithm divides characters into subwords by analyzing statistical patterns in the training corpus, as in the following formula:  
\[\text{M}_{\text{C}\to\text{S}}=\big{\{}\big{(}\text{s}_{j},\text{e}_{j}\big{)} \big{|}\text{s}_{j},\text{e}_{j}=1,\dots,n\big{\}}, \tag{2}\]  
where \(\big{(}\text{s}_{j},\text{e}_{j}\big{)}\) represents the start and end of the character sequence corresponding to the j-th subword in S.  
**Context embedding. ** The subword sequence \(\text{S}=\{\hat{w}_{1},\hat{w}_{2},\dots,\hat{w}_{m}\}\) is first converted into input embeddings \(\text{X}\in\mathbb{R}^{m\times d_{\text{BERT}}}\) through tagging, positional embedding, and segment embedding. \[\text{X}=\text{E}_{\text{tok}}+\text{E}_{\text{pos}}+\text{E}_{\text{seg}}, \tag{3}\]  
where \(\text{E}_{\text{tok}}\), \(\text{E}_{\text{pos}}\), and \(\text{E}_{\text{seg}}\) represent token embeddings, positional embeddings, and segment embeddings, respectively. Then, the X is input into a pre-trained BERT encoder to extract contextual representations:  
\[\text{H}_{\text{BERT}}=\text{Encoder}(\text{X})=\{\text{h}_{1},\text{h}_{2}, \dots,\text{h}_{n}\cdot\}\in\mathbb{R}^{m\times d_{\text{BERT}}}, \tag{4}\]  
Figure 1: PRED module diagram. where \(\mathsf{h}_{\mathsf{j}}\) is the hidden representation of the \(\mathsf{j}\)-th subword in the context and \(\mathsf{d}_{\text{BERT}}\) is the hidden layer dimension of the BERT output. BiLSTM is a recurrent neural network that can simultaneously capture contextual information. In order to enhance the ability to model sequential structures, this paper introduces BiLSTM on top of BERT output for further modeling to obtain the deep hidden states:  
\[\text{H}_{\text{BiLSTM}}=\text{BiLSTM}(\text{H}_{\text{BERT}})=\left[ \overset{\rightarrow}{\mathsf{h}_{\mathsf{1}}};\overset{\leftarrow}{\mathsf{h}_ {\mathsf{1}}}\right],\ldots,\left[\overset{\rightarrow}{\mathsf{h}_{\mathsf{ n}}};\overset{\leftarrow}{\mathsf{h}_{\mathsf{m}}}\right]\in\mathbb{R}^{m \times 2\mathsf{d}_{\text{lstm}}}, \tag{5}\]  
where \(\overset{\rightarrow}{\mathsf{h}_{\mathsf{i}}};\overset{\leftarrow}{\mathsf{h} _{\mathsf{i}}}\) denote the forward and backward hidden states of the \(\mathsf{i}\)-th token and \(2\mathsf{d}_{\text{lstm}}\) denotes the hidden layer dimension of the BiLSTM. **Positional alignment and semantic role attention mechanism. ** For each word representation, its start position \(\mathsf{s}_{\mathsf{i}}\) and end position \(\mathsf{e}_{\mathsf{i}}\) are extracted according to their original subword position mapping \(\text{M}_{\text{C}\to\text{S}}\). In addition, a role attention mechanism is introduced to guide the module to assign higher attention weights to important semantic slots:  
\[\alpha_{\mathsf{ij}}=\frac{\exp\left(\mathsf{h}_{\mathsf{i}}^{\mathsf{T}} \text{Wh}_{\mathsf{j}}+\text{SRL}_{\mathsf{ij}}\right)}{\sum_{\mathsf{k}=1}^{ \mathsf{n}}\exp\left(\mathsf{h}_{\mathsf{i}}^{\mathsf{T}}\text{Wh}_{\mathsf{k }}+\text{SRL}_{\mathsf{ik}}\right)}, \tag{6}\]  
where \(\mathsf{h}_{\mathsf{i}}=[\overset{\rightarrow}{\mathsf{h}_{\mathsf{1}}}; \overset{\leftarrow}{\mathsf{h}_{\mathsf{1}}}]\in\mathbb{R}^{2\mathsf{d}_{ \text{lstm}}}\) is the BiLSTM hidden vector representation of the \(\mathsf{i}\)-th token. \(\text{SRL}_{\mathsf{ij}}\) is defined as \(\text{SRL}_{\mathsf{ij}}=\lambda\) if token \(\mathsf{i}\) and \(\mathsf{j}\) appear within the same predicate-argument structure, and \(0\) otherwise; here, \(\lambda\) is a trainable scalar.