## 3 Method
### Graph Learner  
The ACFG for a binary function is defined as \(G=<V,E,B>\), where \(V\) is the set of nodes (each representing a basic block), \(E\) is the set of edges, and \(B\) is the set of node features. For any node \(i\in V\), its initial feature \(b_{i}\) (\(b_{i}\in B\)) is derived from the Semantic Learner. The feature \(l_{ij}\) for an edge \((i,j)\in E\) is the concatenation of \(b_{i}\) and \(b_{j}\). Given two functions' ACFGs, \(G_{1}=<V_{1},E_{1},B_{1}>\) and \(G_{2}=<V_{2},E_{2},B_{2}>\), the Graph Learner uses GMN with enhanced attention to generate semantic embeddings of functions and computes their cosine similarity. The Graph Learner is divided into three parts: Encoder, Propagation Layers, and Aggregator, as shown in Figure 4.  
The Encoder uses multilayer perceptrons, \(MLP_{node}\) and \(MLP_{edge}\), to encode node and edge features, respectively, generating initial embeddings for nodes and edges as shown in Equations (6) and (7), where \(h_{i}^{(0)}\) represents the initial node embedding, and \(e_{ij}\) represents the edge embedding. \[h_{i}^{(0)}=MLP_{node}(b_{i}),\forall i\in V \tag{6}\]  
\[e_{ij}=MLP_{edge}(l_{ij}),\forall(i,j)\in E \tag{7}\]  
Figure 4: Graph Learner of GMN+. The Propagation Layer, based on ACFG, uses a GMN with enhanced dual-level attention to extract information within and between functions, ultimately generating robust function embeddings. Specifically, an intra-function attention mechanism is employed to focus on critical semantic details within each function. This mechanism allows the model to selectively emphasize information that reflects deeper semantic attributes of the function, enhancing its sensitivity to nuanced, function-specific patterns that may be indicative of vulnerabilities. The intra-function attention is shown in Equations (8)-(10). \[m_{j\to i}=f_{message}(h_{i}^{(t)}||h_{i}^{(t)}||e_{ij}),\forall(i,j)\in E \tag{8}\]  
\[a_{j\to i}=\frac{\exp(s_{c}(h_{i}^{(t)},h_{j}^{(t)}))}{\sum_{j^{\prime}}\exp( s_{c}(h_{i}^{(t)},h_{j^{\prime}}^{(t)}))},j^{\prime}\in N_{i} \tag{9}\]  
\[\gamma_{i}=\sum_{j}a_{j\to i}m_{j\to i},j\in N_{i} \tag{10}\]  
where \(f_{message}\) is a multilayer perceptron taking concatenated inputs \(h_{i}^{(t)}\), \(h_{j}^{(t)}\) and \(e_{ij}\), while \(m_{j\to i}\) is the massage transmitted from node \(j\) to node \(i\). \(N_{i}\) is the set of neighbor nodes of node \(i\). The term \(s_{c}\) is a similarity function. We use cosine similarity. \(a_{j\to i}\) is the attention weight for the information transmitted from node \(j\) to node \(i\). \(\gamma_{i}\) represents the aggregated information transmitted to node \(i\) from all its neighbor nodes. On the other side, an inter-function attention mechanism, i.e., graph matching attention [9], is used to capture key semantic distinctions between functions, facilitating the model's ability to detect homologous vulnerabilities across different but related functions. For the functions' ACFGs \(G_{1}\) and \(G_{2}\), assume \(\forall i\in V_{1},\forall s\in V_{2}\). The graph matching attention mechanism is defined by Equations (11) and (12). \[a_{s\to i}=\frac{\exp(s_{c}(h_{i}^{(t)},h_{s}^{(t)}))}{\sum_{s^{\prime}\in V_{ 2}}\exp(s_{c}(h_{i}^{(t)},h_{s^{\prime}}^{(t)}))} \tag{11}\]  
\[\mu_{s\to i}=a_{s\to i}(h_{i}^{(t)}-h_{s}^{(t)}) \tag{12}\]  
where \(a_{s\to i}\) represents the attention weight describing the proportion of information passed from note \(s\) of \(G_{2}\) to note \(i\) of \(G_{1}\), and \(\mu_{s\to i}\) represents the corresponding matching information. The aggregate of \(\mu_{s\to i}\), for each \(s\) in \(V_{2}\), is calculated as shown in Equation (13), capturing the differential information between \(h_{i}^{(t)}\) and the closest node in the graph for comparison. \[\omega_{i}=\sum_{s\in V_{2}}\mu_{s\to i}=\sum_{s\in V_{2}}a_{s\to i}(h_{i}^{(t) }-h_{s}^{(t)})=h_{i}^{(t)}-\sum_{s\in V_{2}}a_{s\to i}h_{s}^{(t)} \tag{13}\]  
At last, node embeddings are updated using a Gated Recurrent Unit (GRU). The update function, denoted by \(f_{update}\), is a GRU cell.