---
title: 'AGNOMIN: Architecture-Agnostic Function Prediction'
url: https://www.emergentmind.com/topics/agnomin
type: topic
---

# AGNOMIN: Architecture-Agnostic Function Prediction

AGNOMIN, short for **Architecture Agnostic Multi-Label Function Name Prediction**, is an architecture-agnostic, multi-label function name prediction system for stripped binaries. It is designed to close the semantic gap created when symbol tables are removed by predicting informative, compositional labels that reconstruct function names across CPU architectures. The system combines **Feature-Enriched Hierarchical Graphs (FEHGs)**, a **hierarchical graph neural network**, and a **Ren-inspired decoder** with an attention-based head tailored to extreme multi-label spaces. On a corpus of **396,096 functions** from **9,000 ELF executables** spanning **amd64, armel, and i386**, it reports improvements of up to **27.17% in precision** and **55.86% in recall** over state-of-the-art baselines, and achieves **5.89% higher recall** than the closest baseline on an unseen architecture [2509.25514].

## 1. Problem setting and motivation

Function name prediction in stripped binaries is a reverse-engineering task in which informative names must be inferred after symbols have been removed. The task is pivotal to understanding program semantics and enabling downstream tasks including **vulnerability discovery**, **patch matching**, **crypto migration**, and **malware triage**. AGNOMIN is framed around the observation that vulnerable programs and malware are routinely cross-compiled and deployed across multiple architectures, so architecture-specific predictors degrade when retargeted and make scalable security assessment and patching impractical [2509.25514].

The system targets three difficulties identified in prior work. The first is **architecture-specific limitation**: many approaches rely on features tied to a particular ISA, whereas AGNOMIN uses **PCode**, Ghidra’s intermediate representation, to learn architecture-neutral semantics. The second is **data scarcity and label imbalance**: rare function names and uncommon architectures degrade generalization, motivating a multi-label formulation, hierarchical label embeddings, and propensity-aware evaluation. The third is **naming convention diversity**: function names appear in forms such as `snake_case`, `camelCase`, `PascalCase`, and concatenated strings, so AGNOMIN normalizes and tokenizes names with heuristics, dynamic programming segmentation, and abbreviation expansion [2509.25514].

A central conceptual shift is that AGNOMIN predicts **semantic tokens** rather than directly generating a single monolithic string. This multi-label formulation allows a function to be described compositionally, which is better aligned with the heterogeneity of naming conventions and the long-tail label distribution observed in real binary corpora. A plausible implication is that the model is optimized for semantic recoverability rather than exact string reproduction.

## 2. Feature-Enriched Hierarchical Graphs

AGNOMIN represents each binary as a **Feature-Enriched Hierarchical Graph** that combines local control-flow structure, inter-procedural calling structure, and learned PCode-derived semantics. At the binary level, the FEHG is defined as

$$
G = (V, E, \Psi),
$$

where $V = \{f_1, \dots, f_n\}$ are function nodes, $E$ encodes call-graph edges, and $\Psi$ maps each function to its learned feature set. Each function $f_i$ is itself a **Feature-Enriched CFG**,

$$
f_i = (B_i, E_i^{cfg}, \psi_i),
$$

where $B_i = \{bb_1, \dots, bb_{m_i}\}$ are basic blocks, $E_i^{cfg}$ are intra-function CFG edges, and $\psi_i(bb)$ gives learned PCode features for basic blocks [2509.25514].

At the basic-block level, the representation uses

- $X_i^{bb} \in \mathbb{R}^{m_i \times p}$ for basic-block features,
- $A_i^{cfg} \in \{0,1\}^{m_i \times m_i}$ for CFG adjacency.

Pooling yields a function-level representation:

$$
H_i^{func} = S_i^\top H_i^{bb} \in \mathbb{R}^{1 \times d},
$$

with assignment $S_i \in \{0,1\}^{m_i \times 1}$, and a scalar self-structure summary

$$
A_i^{func} = S_i^\top A_i^{cfg} S_i = [deg(f_i)].
$$

At the binary level, $X^{func} \in \mathbb{R}^{n \times d}$ concatenates pooled embeddings with function-level PCode features $\mu_i$, and $A^{fcg} \in \{0,1\}^{n \times n}$ is the function call graph adjacency. The paper also gives a merged formalization,

$$
A^{merge} = w_{cfg} I_n + w_{fcg} A^{fcg},
$$

while noting that AGNOMIN processes the hierarchy explicitly rather than as a single merged matrix [2509.25514].

PCode features are obtained with a pre-trained **T5 encoder**. For a basic block and a function, respectively,

$$
\nu_{i,k} = T5(PCode(bb_k \in f_i)), \qquad \mu_i = T5(PCode(f_i)).
$$

These features populate the basic-block and function-level inputs. Feature fusion is then defined by concatenating the pooled block embedding $\theta(f_i)$ with function-level PCode semantics:

$$
x_i = [\mu_i \mid \theta(f_i)] \in \mathbb{R}^{2d}, \qquad
\psi(f_i) = \sigma(W_{fc} x_i + b_{fc}).
$$

This representation encodes both **intra-function control** and **inter-function context**. The explicit use of PCode suggests that architecture invariance is sought primarily at the IR-semantic level rather than by forcing direct alignment between raw instruction sequences.

## 3. Hierarchical graph encoder and cross-architecture regularization

The encoder is a two-level **hierarchical graph neural network**. Within each function, AGNOMIN applies a normalized GCN over the CFG:

$$
\tilde{A}_i = A_i^{cfg} + I, \qquad
\tilde{D}_i = diag\!\left(\sum_j \tilde{A}_i[j]\right),
$$

$$
H_i^{(l+1)} = \sigma\!\left(\tilde{D}_i^{-1/2} \tilde{A}_i \tilde{D}_i^{-1/2} H_i^{(l)} W^{(l)} + b^{(l)}\right),
$$

initialized with $H_i^{(0)} = X_i^{bb}$. After $L$ layers, block embeddings are pooled to obtain the function representation:

$$
\theta(f_i) = \sum_{bb_k \in f_i} H_i^{bb}[k].
$$

Across functions, AGNOMIN uses a **graph attention network** over the FCG. For function nodes $f_i$ and $f_j$,

$$
e_{ij} = LeakyReLU(a^\top [W \theta(f_i) \mid W \theta(f_j)]), \qquad
\alpha_{ij} = softmax_j(e_{ij}),
$$

$$
GAT(\theta(f_i)) = \sum_{f_j \in N(f_i)} \alpha_{ij}(W \theta(f_j)), \qquad
\xi(f_i) = tanh(GAT(\theta(f_i))).
$$

The final fused function embedding is

$$
\psi(f_i) = \sigma(W_{fc} [\mu_i \mid \xi(f_i)] + b_{fc}).
$$

The paper reports that replacing the GAT with a fully connected layer degrades performance, which it interprets as evidence that **inter-procedural attention** is materially useful [2509.25514].

To promote **cross-architecture consistency**, AGNOMIN trains a Siamese head with contrastive loss. For semantically similar cross-architecture pairs,

$$
D(\psi(f_i), \psi(f_j)) = ||\psi(f_i) - \psi(f_j)||_2,
$$

$$
L_{ctr} = y D^2 + (1-y)\max(0, m-D)^2,
$$

where $y=1$ for semantically similar pairs and $m$ is a margin. This regularizer is intended to pull architecture-equivalent functions together in embedding space. It does not imply that architecture-specific variation disappears entirely; rather, the learned representation is optimized so that semantic similarity dominates architecture-specific surface differences.

## 4. Multi-label name prediction and decoder design

AGNOMIN’s decoder is described as **inspired by Renee**, an end-to-end extreme multi-label classification model, but the system explicitly decouples encoder and decoder so that the encoder can preserve architecture-agnostic function semantics. On top of encoder outputs $E \in \mathbb{R}^{N \times d}$, a multi-head self-attention layer computes

$$
Q = E W_Q, \qquad K = E W_K, \qquad V = E W_V,
$$

with per-head attention

$$
\mathrm{Attn}(Q, K, V) =
\mathrm{softmax}\!\left(\frac{QK^\top}{\sqrt{d_h}}\right)V,
$$

and projection

$$
\tilde{E} = \mathrm{Concat}(\mathrm{Attn}_1,\dots,\mathrm{Attn}_H)W_O.
$$

With label embeddings $U \in \mathbb{R}^{L \times d}$, label scores and predictions are

$$
s = \tilde{E} U^\top, \qquad \hat{y} = \sigma(s).
$$

Hierarchical label embeddings and **dynamic label pruning** are used to reduce search space and capture label relations in extreme multi-label settings [2509.25514].

The label space is constructed by decomposing function names into semantic tokens. The normalization pipeline includes splitting on non-alphanumeric delimiters and case changes, dynamic programming segmentation into longest non-overlapping dictionary words, fallbacks using subsequence and Levenshtein similarity, and abbreviation expansion via a curated dictionary. Rare or noisy labels are pruned to focus on the **$N$ most common labels**, with $N \in \{512, 1024, 2048, 4096\}$ [2509.25514].

For function $i$, the decoder predicts a binary vector over labels,

$$
\hat{y} = \sigma(Wh+b), \qquad h=\tilde{E}_i,
$$

with binary cross-entropy

$$
\mathcal{L}_{\mathrm{BCE}}
= -\sum_{j=1}^L \big[y_j \log \hat{y}_j + (1-y_j)\log(1-\hat{y}_j)\big].
$$

To address class imbalance, AGNOMIN uses class-weighted BCE:

$$
\mathcal{L}
= -\sum_{j=1}^L w_j \big[y_j \log \hat{y}_j + (1-y_j)\log(1-\hat{y}_j)\big],
$$

with larger $w_j$ for rare labels. The encoder’s contrastive loss is added during embedding training, while the decoder is trained on fixed embeddings [2509.25514].

A common misunderstanding is to treat AGNOMIN as direct sequence generation. The formulation in the paper is instead **extreme multi-label prediction over normalized semantic tokens**. This matters because evaluation, pruning, imbalance handling, and label embeddings are all built around token-level prediction rather than autoregressive string decoding.

## 5. Dataset, evaluation protocol, and reported results

The experimental corpus is the **Diverse Architecture Binary (DAB-9k)** dataset, drawn from **ALLSTAR (Debian Jessie packages)**. It contains **9,000 ELF executables** and **396,096 functions** across **amd64, armel, and i386**. The train/test split is a **package-aware non-random 9:1 split**, so binaries from the same package do not cross splits. Reported test subsets include **DAB-amd-test**, **DAB-i386-test**, **DAB-armel-test**, and a combined **DAB-3arch-test** [2509.25514].

Evaluation uses both standard and propensity-aware extreme multi-label metrics. These include

$$
P@k = \frac{1}{k}\sum_{l \in \mathrm{rank}_k(\hat{y})} y_l,
$$

$$
R@k = \frac{\sum_{l \in \mathrm{rank}_k(\hat{y})} y_l}{\sum_l y_l},
$$

$$
PSP@k = \frac{1}{k}\sum_{l \in \mathrm{rank}_k(\hat{y})} \frac{y_l}{p_l},
$$

along with PSDCG@k, PSnDCG@k, and standard Precision, Recall, and F1 [2509.25514].

The paper reports several headline comparisons. Against **XFL (amd64)**, AGNOMIN improves **P@1 by 29.83%**, **P@5 by 27.17%**, **Recall by 54.32%**, **PSP by 44.53%**, and **PSnDCG by 33.64%**. Against **SymLM**, it improves **precision by up to 11.88%** and **recall by up to 55.86%** across architectures. SymLM’s cross-architecture transfer is reported to degrade severely, with **recall 3.91% when tested on i386 from an amd64-trained model**, whereas AGNOMIN retains **47.25% recall** under the same transfer setting. For **unseen architecture generalization** with training on amd64+armel and testing on i386, AGNOMIN achieves **3.12% higher precision** and **5.89% higher recall** than **CFG2VEC**, the closest baseline. Across all three architectures, its cross-architecture model beats CFG2VEC by **25.56% P@5** and **35.51% recall** [2509.25514].

Ablations attribute a substantial portion of the gain to **128-dimensional PCode features** and the **attention head**. The encoder is also reported to outperform CFG2VEC in name-level matching, with a representative figure of **91.55% vs \~69–71% across architectures**. The paper summarizes the source of these gains as the combination of FEHG structure, PCode/T5 semantics, hierarchical aggregation, attentive decoding, and the multi-label formulation [2509.25514].

## 6. Practical utility, implementation, and limitations

AGNOMIN is implemented as a **Ghidra plugin** that extracts CFGs, FCGs, and PCode; the encoder and decoder are implemented in **PyTorch**; the attention head uses `torch.nn.MultiheadAttention`; and PCode features are obtained via a **pre-trained T5 encoder**. The encoder is trained for **100 epochs** while varying PCode feature configurations at **32/64/128** dimensions for basic-block and function-level features. Decoder attention depth is tuned, with a **default of 5 heads**. Label-space pruning is performed for **$N \in \{512, 1024, 2048, 4096\}$**, with **512 often yielding highest metrics** while **4096 retains stable performance** because of hierarchical label embeddings [2509.25514].

Reported runtime on **NVIDIA V100/A30/A100 GPUs** is approximately **46h / 35h / 32h** for encoder training and **13.4h / 9h / 9h** for decoder training. Inference per binary is **about 0.4–0.7s** for the encoder and **about 37–43s** for the decoder. The decoupled encoder allows function embeddings to be precomputed and reused across tasks, while dynamic label pruning is intended to keep inference practical in extreme label spaces [2509.25514].

The system was also validated in **DARPA-sponsored hackathons**. In a **NASA rover scenario (AARCH64 v8A)**, without training on AARCH64, AGNOMIN’s function matching identified **51/64 (79.7%) targets top-1**, increasing to **92.1% top-3**, which enabled precise micro-patch insertion through **“sharpen” function redirection**. In a **deprecated crypto remediation** case, the model matched vulnerable crypto routines in a stripped binary to a secure reference and reduced the search space for patching. Example predicted label sets such as `{"lib", "string", "in", "hmac", "fin"}` are presented as compositional cues that map toward canonical crypto helper or HMAC finalization routines [2509.25514].

The paper also delineates several limitations. **Heavy obfuscation** and **aggressive compiler transformations** can distort control structure and semantics despite the use of PCode IR and hierarchical GNNs. **Rare naming conventions** and **domain-specific vocabularies** remain difficult despite pruning and propensity-aware evaluation. Cross-architecture claims are validated on **amd64, armel, and i386**, while broader validation on **MIPS, PPC, s390x, and AARCH64** is identified as future work. The paper proposes future directions including **obfuscation-aware features**, **cross-binary contrastive augmentation**, **expanded multilingual/token dictionaries**, and unifying inference with **patch graph alignment** [2509.25514].

Taken together, AGNOMIN defines a specific architecture-agnostic approach to binary semantic recovery: it uses PCode-mediated FEHGs to encode binaries as graph-structured semantic objects, regularizes embeddings for cross-architecture consistency, and treats function naming as an extreme multi-label prediction problem over normalized semantic tokens. This design is aimed not merely at label prediction in isolation, but at enabling scalable reverse engineering, vulnerability analysis, and patching workflows across heterogeneous architectures.

Source: https://www.emergentmind.com/topics/agnomin