Decoupling topological and molecular features for interpretable biomolecular interaction prediction Authors: Qi Wu, Yinbo Liu, Feng Yang, Weihong Huang, Xiaolei Zhu, Juan Liu Published: 2026 ABSTRACT AbstractPredicting biomolecular interactions is fundamental to understanding cellular mechanisms and advancing drug discovery. However, biomolecular interactions exhibit immense diversity across multiple dimensions. Most existing computational methods are designed to handle one specific task or data modality, which limits their applicability and generalization capability in broader scenarios. To address this methodological rigidity, we propose a flexible framework for multi-modal feature fusion in biomolecular interaction prediction (FlexBIP). The core of FlexBIP lies in its modular architecture, which decouples intrinsic molecular features from complex graph topologies, enabling the adaptive integration of node attributes, edge properties, and auxiliary graph information. The flexible fusion methodology breaks through the limitations of task-specific models. This design enables FlexBIP to adaptively process and integrate biological data of different types and from various sources, including homogeneous interactions between molecules of the same type, heterogeneous interactions between different molecular classes, as well as qualitative binary, multi-class, and quantitative regression prediction tasks. Our research has yielded exciting results. In extensive testing across 15 benchmark datasets, covering 8 major categories of biomolecular associations, FlexBIP’s performance comprehensively surpasses that of 25 state-of-the-art specialized models. Crucially, in data-scarce “cold-start” scenarios that simulate the discovery of new molecules, FlexBIP continues to demonstrate remarkable robustness and predictive accuracy. Furthermore, FlexBIP provides robust and reliable interpretability for various downstream analysis tasks. Introduction Biological systems are governed by intricate molecular interaction networks spanning multiple organizational levels, where interactions between different biomolecules collectively form the fundamental regulatory framework underlying life processes. The systematic prediction of these interactions is crucial for elucidating disease mechanisms, discovering therapeutic targets, and ensuring clinical safety [1–3]. However, the predictive modeling of these networks faces a fundamental challenge rooted in their inherent diversity. Biomolecular interactions can be systematically categorized along two key dimensions. The first is Entity Type, where interactions can occur in homogeneous scenarios between molecules of the same type, or in heterogeneous scenarios between different molecular classes. The second is Prediction Goal, which, based on its complexity, can be divided into three task types: binary qualitative prediction, multi-class qualitative prediction, and quantitative prediction. This diversity has spurred the development of numerous highly specialized computational methods, which, despite their success, are often limited in their design to a single prediction task. For instance, in the field of protein–protein interactions (PPIs) [4], researchers have developed specialized models such as HIGH-PPI [5], which focuses on capturing the hierarchical structure of protein complexes; the DNE [6] framework, for learning network embeddings to identify functional modules; and the MCGLPPI [7] model, which balances predictive accuracy with computational efficiency through coarse-grained molecular representations. Similarly, in the domain of drug–drug interactions (DDIs), models also focus on specific sub-problems. For example, DGAT-DDI [8] is specifically designed to capture the prevalent asymmetry in these interactions, while EmerGNN [9] is dedicated to solving the cold-start challenge for emerging drugs. Furthermore, this trend of specialization extends to models for predicting a wide range of other associations, including drug–target interactions (DTIs) [10–13], drug–target affinities (DTAs) [14–16], circular RNA (circRNA)–drug interactions [17], drug–gene interactions [18], and miRNA–disease interactions [19]. Even though some methods can handle multiple subtasks, they are often limited to specific domains. For example, the DTIAM [16] model is capable of handling multiple subtasks within the drug and target, but it cannot be applied to other interaction classes like PPIs. While these specialized models demonstrate strong performance, critical gaps remain unaddressed. This “one model for one task” paradigm creates computational silos, limits the potential for cross-domain knowledge transfer, leads to redundancy in model development, and possesses insufficient capabilities for downstream biomolecular analysis. Flexible tools have become standard in many other areas of biological analysis. Fields like single-cell sequencing, spatial transcriptomics, and metabolomics analysis now benefit from simple, general, and flexible model frameworks with high generalization capabilities. In contrast, the field of molecular interaction prediction urgently needs a similar end-to-end tool that spans from data preprocessing and predictive modeling to downstream analysis. Furthermore, different molecular entities possess unique features, making it difficult for previous methods to establish a flexible modeling paradigm. In contrast, feature-aware Graph Neural Networks (GNNs) can directly adapt to graph structures with diverse features for end-to-end learning. Their inherent versatility serves as an ideal technological foundation for achieving flexible cross-network prediction. Inspired by this, we propose Flexible Biomolecular Interaction Prediction (FlexBIP), a framework designed to address this challenge through a flexible, multi-modal fusion architecture (Fig. 1). The core of FlexBIP’s generalizability lies in its modular design; the framework utilizes a multi-feature-aware GNN architecture and an adaptive graph structure processing mechanism, making it highly adaptable to diverse biomolecular interaction prediction tasks. Overview of FlexBIP. Built upon conventional GNN models, FlexBIP is designed for methodological flexibility, supporting multiple types of feature fusion, including node, edge, and auxiliary data features. By utilizing edge-feature-aware and node-feature-aware layers to process edge and node features from different perspectives, it obtains more comprehensive node representations. This enhances the model’s ability to learn topological information between nodes and strengthens its perception of edge information by incorporating additional node features. A dynamic multi-class contrastive loss function is employed to balance learning across different classes. Furthermore, for multi-hop association prediction, FlexBIP can also learn features from an auxiliary graph to enhance learning on the primary graph. To validate the generalizability of this fusion architecture, we extensively evaluated FlexBIP by comparing it with 25 state-of-the-art methods across 15 datasets spanning 8 distinct types of biological associations, conducting 10 repeated experiments. Our work demonstrates that FlexBIP consistently outperforms various specialized models in both classic prediction tasks and challenging cold-start scenarios. In addition, we also conducted a variety of downstream analysis tasks, including principal component analysis (PCA) and hierarchical clustering analysis, multi-class comparisons based on PCA, visualization of biomolecular 3D structures and their interaction relationships, interaction network visualization, interaction association prediction result visualization, and performance evaluation of DTA prediction models. Furthermore, our model can perform interaction attribution analysis, quantifying the contribution strength of specific sites (such as drug–target pairs) in biomolecular interactions and outputting an interaction score to characterize binding affinity or functional association. Materials and methods Datasets and preprocessing To comprehensively validate the versatility and robustness of a flexible prediction framework, our benchmark must represent the inherent diversity of biomolecular interactions. Inspired by this, we first systematically categorize interaction prediction tasks along two key dimensions based on their core biological and computational properties. The first dimension is entity type, which distinguishes between homogeneous interactions that occur between molecules of the same type, and heterogeneous interactions that occur between different molecular classes. The second dimension is prediction goal, which differentiates tasks based on the nature and complexity of their output. This includes binary qualitative prediction, which aims to predict the existence of a single type of interaction and is computationally a binary classification task; multi-class qualitative prediction, which aims to predict which specific type of interaction manifests between two entities from multiple possibilities and is a multi-class classification task; and quantitative prediction, which aims to predict the strength or degree of an interaction and is a regression task. Based on the classification framework above, for homogeneous interactions, we addressed both multi-class qualitative prediction, for which we selected the PPI01 and DDI02 datasets. The PPI01 dataset, derived from the STRING) [20] database’s SHS27k [21] subset, focuses on Homo sapiens protein interactions and is a multi-classification dataset encompassing various PPI types, while the DDI02 dataset leverages the TWOSIDES [22] public dataset, known for its multiple interaction types between drug pairs, making it suitable for multi-type DDI prediction. The binary qualitative prediction, for which we used the PPI02 and DDI01 datasets, the PPI02 dataset contains Saccharomyces cerevisiae [23] protein interactions from its interactome, while the DDI01 dataset uses asymmetric DDI data from DrugBank [24]. For heterogeneous interactions, we selected the DTI01 and DTI02 datasets for binary qualitative prediction in the domain of DTIs. The DTI01 dataset is the large-scale, heterogeneous Hetionet dataset, compiled by Himmelstein et al. [25] from 29 public biomedical resources. The DTI02 dataset is composed of four subsets, sourced from the Kyoto Encyclopedia of Genes and Genomes (KEGG) BRITE [26], BRENDA [27], SuperTarget [28], and DrugBank databases [29]. Finally, for quantitative prediction, we used the DTA01 dataset. The DTA01 dataset employs the KIBA dataset constructed by Tang et al. [30], which is a large-scale kinase inhibitor bioactivity dataset integrating various measurement types like Ki, Kd, and IC50. To ensure result stability, all datasets underwent 10 repeated experiments. In each experiment, 20% of the dataset was randomly sampled as an independent test set for evaluating the model’s generalization, with the remainder used as the training set for parameter learning and optimization. Table 1 presents the topological feature statistics for all seven datasets, and Supplementary Table S1 contains more pertinent information about the datasets. Table 1Dataset topological features. PPI01 PPI02 DDI01 DDI02 DTI01 DTI02 DTA01 # Source nodes15532674170060413847911184# Target nodes1553267416706045763989624# Total edges24 11 80971 50 27628 39 0003 64 81679 75 9927 82 2997 38 816# Connected edges26 64014 15010 08 93657 77899 88410 254/Conn. edge ratio0.011050.001980.355380.158380.012520.01311/Max degree3641401185364580132/Note: “Conn. edge ratio” is the abbreviation for “connected edge ratio.” For the “# connected edges” in the table, if a dataset contains bidirectional edges, the value of “# connected edges” in the table is twice the actual number of edges. The DDI01 dataset has undergone homogeneous graph heterogenization, which means the DDI01 dataset was originally a homogeneous graph (with nodes of the same type) and was converted into a heterogeneous graph (distinguishing between source nodes and target nodes) during processing. Dataset topological features. Note: “Conn. edge ratio” is the abbreviation for “connected edge ratio.” For the “# connected edges” in the table, if a dataset contains bidirectional edges, the value of “# connected edges” in the table is twice the actual number of edges. The DDI01 dataset has undergone homogeneous graph heterogenization, which means the DDI01 dataset was originally a homogeneous graph (with nodes of the same type) and was converted into a heterogeneous graph (distinguishing between source nodes and target nodes) during processing. Modular and interpretable architecture First, the FlexBIP model can flexibly handle various types of biomolecular inputs; whether it is a protein, drug, or target, it can be accepted as the initial input. The key to this design is its universality, which lays the foundation for subsequent flexible processing. The core design philosophy of the framework is to decouple the intrinsic features of a node from its graph structure information within the network. Rather than a purely architectural separation followed by naive concatenation, our decoupling is mechanistically enforced to prevent the semantic dilution of molecular features. FlexBIP strictly isolates the sequence-pair attention encoding from the graph convolutions. Furthermore, the integration of these decoupled streams is executed through a Conditional Fusion module. Instead of standard linear concatenation, the decoupled topological embeddings serve as contextual conditions that dynamically modulate the molecular interaction representations. In the processing workflow, the input node features are first encoded into information-dense node embedding vectors by a Feedforward Neural Network. Concurrently, edge information describing the connections between nodes is also extracted. Subsequently, the node feature matrix and edge information are jointly fed into a Graph Convolutional Network (GCN) [31] core. Within this module, the model integrates the graph’s topological structure into each node’s representation through an iterative aggregation of neighborhood information, thereby generating context-rich graph embeddings. To further refine key information, the FlexBIP model also utilizes a graph attention aggregation network to process node and edge features. This allows the model to dynamically assign different importance weights to different neighboring nodes, thereby extracting the most relevant edge information embeddings for a specific node. Furthermore, the framework supports the fusion of an Auxiliary Graph. When an external knowledge base or auxiliary dataset is available, its graph information can similarly be processed by an independent GCN to generate auxiliary graph embeddings, providing additional informational dimensions to the main model. As shown in Fig. 1, after the node, graph, edge, and potential auxiliary graph embeddings are obtained, these feature representations from different dimensions are concatenated to form a comprehensive and rich combined feature vector. This vector is then input into a multi-class similarity decoder, which ultimately predicts whether an interaction exists between a specific pair of molecules and outputs a prediction score. Furthermore, when the input data includes sequence text information, such as the amino acid sequences of proteins and the Simplified Molecular-Input Line-Entry System (SMILES) strings of drugs, FlexBIP activates a powerful Bidirectional Encoder Representations from Transformers (BERT)-like [32] sequence-pair encoder. This encoder can process biological sequence pairs as if they were natural language, deeply capturing complex dependencies within and between sequences through a multi-head attention mechanism. This process not only generates highly informative sequence-pair embeddings but also calculates the attention weights for various sites (e.g. amino acid residues or chemical groups) between the molecule pair. These weights intuitively reflect which key regions the model focused on when making a prediction (such as the highlighted ASP (aspartic acid)-231 residue in the figure), thereby greatly enhancing the interpretability of the model’s prediction results and helping researchers understand the underlying mechanisms of intermolecular interactions. Flexible graph data representation We define a flexible graph data structure \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{G}=\left(\mathcal{V},\mathcal{\varepsilon},X,{E}_{attr}\right)$\end{document} where: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{V}$\end{document} denotes the set of nodes, which can be drug molecules, proteins, or targets; \varepsilon denotes the set of edges, representing interaction relationships between biomolecules; \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $X\in{\mathbb{R}}^{\mid \mathcal{V}\mid \times d}$\end{document} represents the node feature matrix; \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${E}_{attr}\in{\mathbb{R}}^{\mid \varepsilon \mid \times f}$\end{document} represents the edge attribute matrix. For heterogeneous graph data, we further divide the node set into source nodes \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\mathcal{V}}_s$\end{document} and target nodes \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\mathcal{V}}_t$\end{document}, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{V}={\mathcal{V}}_s\cup{\mathcal{V}}_t$\end{document}. Details of the core algorithms of the FlexBIP framework are provided in Supplementary Section 1: Algorithms. Multi-modal fusion architecture The FlexBIP framework adopts a multi-module fusion strategy, integrating multiple graphs embedding methods: where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\overset{\sim }{A}=A+I$\end{document} is the adjacency matrix with self-loops added, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\overset{\sim }{D}$\end{document} is the degree matrix of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\overset{\sim }{A}$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${W}^{(l)}$\end{document} is a learnable weight matrix, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathrm{\sigma}$\end{document} is an activation function, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${H}^{(0)}$\end{document} is One-Hot encoding about node \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{V}$\end{document}, and ∥ denotes the concatenation operation. where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${MLP}_{node}$\end{document} is a multi-layer perceptron for node features, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${MLP}_{E- edge}$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${MLP}_{E- node}$\end{document} are multi-layer perceptron for edge features, Aggregation is an Aggregation mechanism used to integrate edge features into node representations, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\alpha, \kern0.5em \beta, \mathrm{\gamma}$\end{document} are learnable fusion weight. For scenarios with auxiliary information, we introduce an auxiliary graph structure \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\mathcal{G}}_{aux}=\left({\mathcal{V}}_{aux},{\varepsilon}_{aux},{\mathrm{X}}_{aux},{E}_{aux}\right)$\end{document}, and fuse information in the following way: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${H}_{aux}={GCN}_{aux}\Big({\mathrm{X}}_{aux},{\mathrm{\varepsilon}}_{aux}$\end{document} ) (8) where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${GCN}_{aux}$\end{document} is the GCN for the auxiliary graph, idx is the index mapping of main graph nodes in the auxiliary graph, and ∥ denotes the concatenation operation. Sequence attention encoding The input text sequence pair \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\left({s}_1,{s}_2\right)$\end{document} is preprocessed to form source node and target node sequences with special tokens: where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\left[ CLS\right]$\end{document} is the “classification token” with a fixed index of 1. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\left[ SEP\right]$\end{document} is the “separator token,” which clearly distinguishes the boundaries between the two sequences, helps the model distinguish different parts in the input, and has a fixed index of 2. The input sequence obtains initial features through the fusion of three types of embeddings: where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $E,{E}_{token},{E}_{pos},{E}_{seg}\in{\mathbb{R}}^{L\times{d}_e}$\end{document}, in \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\mathit{\operatorname{seg}}}_{id}$\end{document}, 1 corresponds to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${seq}_1$\end{document}, and 2 corresponds to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${seq}_2$\end{document}. Given multi-head self-attention calculates attention weights and outputs features based on the given single-head self-attention outputs: where Q=K=V=E. After concatenating multi-head outputs, they are integrated through a projection matrix. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${W}^o$\end{document} is a learnable parameter matrix, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${Attn}_i\ \left(i=1,2,\dots, h\right)$\end{document}denotes the output of the i-th attention head and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $MultiHead(E)\in{\mathbb{R}}^{L\times{d}_e}$\end{document}. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${H}_1\in{\mathbb{R}}^{L\times{d}_e}$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $LayerNorm\left(\bullet \right)$\end{document} denotes the normalization process applied to the result of the residual connection. Perform a nonlinear transformation on the attention output: where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${W}_1$\end{document} is the weight matrix of the first linear transformation, a learnable parameter, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${W}_1\in{\mathbb{R}}^{4{d}_e\times{d}_e}$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${b}_1$\end{document}is the bias vector of the first linear transformation, a learnable parameter. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $GELU\left(\bullet \right)$\end{document} is Gaussian Error Linear Unit activation function, a smooth nonlinear activation function defined as \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $GELU(x)=x\bullet \varPhi (x)$\end{document} (\varPhi (x) is the cumulative distribution function of the standard normal distribution). \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${W}_2$\end{document} is the weight matrix of the second linear transformation, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${W}_2\in{\mathbb{R}}^{d_e\times 4{d}_e}$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${b}_2$\end{document}is the bias vector of the second linear transformation, a learnable parameter, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${H}_2\in{\mathbb{R}}^{L\times{d}_e}$\end{document}. Take the feature at the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\left[ CLS\right]$\end{document} position (index 0) in the final feature matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${H}_2$\end{document}, and obtain the overall sequence representation through linear transformation: where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${H}_a\in{\mathbb{R}}^{d_h}$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${H}_2\left[0,:\right]$\end{document} denotes extracting the feature vector of the [CLS] token (at position 0); \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $Linear\left(\bullet \right)$\end{document}represents mapping the dimension from \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${d}_e$\end{document} to \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${d}_h$\end{document} (hidden dimension). The weight matrix of the k-th attention head: \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${Q}_k$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${K}_k$\end{document} are the query and key matrices of the k-th head, respectively. We use the attention weights before applying softmax as the importance scores of the sites. The weight matrices of h attention heads are averaged to obtain the overall attention weight matrix \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\overline{A}$\end{document}: Attention weight slicing between sequence pairs: where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${L}_1$\end{document} is the length of the first sequence. The slicing operation extracts the attention weights between \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${s}_1$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${s}_2$\end{document}. Adaptive graph structure processing mechanism Our framework can adaptively handle both homogeneous and heterogeneous graphs through the following unified formula: where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${h}_i$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${h}_j$\end{document} are the embedding representations of nodes i and j, the \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mid \bullet \mid$\end{document} denote the absolute value. The decoder is a decoding function selected according to the task type: where σ is the sigmoid function, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${W}^C\in{\mathbb{R}}^{d_h\times{d}_c}$\end{document}, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${d}_c$\end{document} is the number of categories, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${d}_h$\end{document} is the dimension of \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${h}_{i,j}$\end{document}, and b is a learnable parameters. Unified loss function Our framework accommodates multi-task learning by defining the total loss \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{L}$\end{document} as a weighted sum over a set of tasks \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathcal{T}$\end{document}: where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\mathcal{L}}_t$\end{document} is the loss for a specific task, and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\lambda}_t$\end{document} is its corresponding weight, set to 1 by default. To address the severe class imbalance inherent in biomolecular interaction data, we implemented a margin-based contrastive loss for each task \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\mathcal{L}}_t$\end{document}. This approach mitigates the dominance of negative samples by employing a dynamic negative sampling strategy during training. Specifically, for each training batch and for each interaction class c, we use all \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${N}_{pos,c}$\end{document} positive samples but randomly sample only \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${k}_{neg,c}$\end{document} negative samples, where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${k}_{neg,c}=\mathit{\min}\left({N}_{pos,c},{N}_{neg,c}\right).$\end{document} This ensures that the training objective remains balanced between positive and negative examples. The \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} $\mathit{\min}\left(\ \right)$\end{document} function acts as a self-adaptive gradient balancer. In highly sparse biomolecular networks (Table 1), it addresses the issues of traditional fixed-ratio sampling discarding critical negative topological context and the dominant negative class overwhelming the gradients, which has been validated in subsequent ablation studies. The task-specific loss \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\mathcal{L}}_t$\end{document} is then computed as the average of the per-class losses: where C is the total number of classes. For a given class c, \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${Pos}_c$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${SampledNeg}_c$\end{document}represent the sets of positive and sampled negative interactions, respectively. \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\hat{y}}_{ic}$\end{document} and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{upgreek} \usepackage{mathrsfs} \setlength{\oddsidemargin}{-69pt} \begin{document} ${\hat{y}}_{jc}$\end{document} are the predicted scores for these interactions. The margin m, a hyperparameter set to 1.0, enforces a separation between the scores of positive and negative pairs. This loss formulation enhances model robustness and predictive performance, particularly in data-scarce and imbalanced scenarios. Results and discussion Performance on multiple biomolecular network prediction tasks For a comprehensive validation of a flexible prediction framework’s versatility and robustness, we carefully selected seven representative benchmark datasets. These datasets cover the main combinations within our framework, allowing for a rigorous test of the model’s generalization capabilities. We compared FlexBIP against various baseline methods (K-Nearest Neighbors (KNN) [33], Random Forest (RF) [34], Logistic Regression (LR) [35], GCN [31], MCGLPPI [7], DeepNano [36], HIGH-PPI [5], GRACE [37], VGNAE [38], DNE [6], DeepDDI [39], MeTDDI [40], DGAT-DDI [8], CompGCN [41], SkipGNN [42], EmerGNN [9], KGE_NFM [10], MPNN_CNN [11], DTIAM [16], IHDFN-DTI [12], TransformerCPI [13], DeepDTA [14], and GraphDTA [15]) on the PPI01, PPI02, DDI01, DDI02, DTI01, DTI02, and DTA01 datasets. The results presented in Fig. 2 demonstrate that FlexBIP possesses significant advantages across multiple datasets and tasks, validating its generalization capability across diverse scenarios. Furthermore, FlexBIP not only achieves highly statistically significant performance improvements over the top-performing baselines (Wilcoxon signed-rank test, P < .01, as annotated with ** in Fig. 2), but is also less susceptible to random fluctuations, thereby exhibiting stronger robustness. An overview of methods for molecular interaction prediction is presented in Supplementary Section 2: Additional Analysis. Evaluation metrics for molecular interaction prediction models are provided in Supplementary Section 3: Evaluation Metrics. Performance of FlexBIP and other methods; (a) ROC and PR curves evaluating performance on PPI01 and PPI02 datasets; (b) bar charts comparing ROC–AUC, RMSE, and Rp metrics across various baseline models on DDI01, DDI02, DTI01, DTI02, and DTA01 datasets; (c) heatmap illustrating the accuracy comparison across different datasets and methods; abbreviations: ROC, receiver operating characteristic; PR, precision–recall; AUC, area under the curve; RMSE, root mean square error; Rp, Pearson correlation coefficient. Ablation and parameter sensitivity study To explore the role of the components of the FlexBIP model in different graph structures and task types, we designed ablation experiments for homogeneous graphs and heterogeneous graphs, and compared the performance changes of the model in multi-classification, single-classification, and affinity prediction tasks. We constructed four FlexBIP model variants: one (“w/ BCELoss”, i.e., with Binary Cross-Entropy Loss) refers to the modification where the multi-class contrastive loss function of the FlexBIP model is removed, and the BCE loss function is adopted instead; another did not use node features (“w/o NodeFeat”) to observe the impact of missing node-related information on the model; the third omitted edge feature processing (“w/o EdgeFeat”) to evaluate the importance of edge features; and the fourth (“w Dot Decoder”) indicates the removal of the similarity linear decoder from the FlexBIP model, with the dot product decoder being used in its place. The superior performance of FlexBIP stems from three core mechanisms: (i) structural feature decoupling: FlexBIP isolates intrinsic molecular features from complex graph topologies, integrating node, edge, and auxiliary features adaptively. Ablation studies (e.g. “w/o NodeFeat,” “w/o EdgeFeat”) confirm their necessity for capturing context-rich embeddings. (ii) Dynamic multi-class contrastive loss: to combat severe class imbalance in biomolecular networks, we utilize a margin-based contrastive loss with dynamic negative sampling to balance training objectives. (iii) Sequence-pair attention encoding: a BERT-like encoder captures complex intra- and inter-sequence dependencies via multi-head attention, generating informative embeddings and pinpointing interaction sites for enhanced accuracy and interpretability. To investigate how the model responds to diverse parameters and shed light on how different hyperparameters influence its performance, we carried out a comprehensive sensitivity analysis of the model’s parameters. As shown in Fig. 3b, by systematically adjusting parameters such as the number of GCN network layers, the number of hidden features, the dropout rate, the learning rate, and the weight decay coefficient, we deeply explored the relationship between different hyperparameters and the model performance. The parameter sensitivity analysis for other datasets can be found in Supplementary Fig. S1. Comprehensive performance analysis of the FlexBIP model; (a) radar charts illustrating the ablation study results across different graph structures and four task types: heterogeneous binary-class, heterogeneous affinity, homogeneous multi-class, and homogeneous binary-class; (b) line plots displaying the parameter sensitivity analysis across the PPI01, DDI02, DTI01, and DTA01 datasets. For practical deployment, we recommend the following parameter strategies: (a) architecture: use 4–8 GCN layers and 128–256 hidden features for standard datasets but switch to shallower layers for massive graphs to avoid over-smoothing and avoid dimensions over 500 to prevent overfitting. (b) Regularization: apply moderate dropout (0.1–0.2) and low weight decay (1 × 10−5) for standard tasks but enforce stricter constraints for cold-start scenarios. (c) Optimization: maintain an initial learning rate of 0.001–0.002 for stable convergence. Generalization capability and cold-start analysis To validate the generalization capability of the model, we compared the FlexBIP model in eight types of biological interaction tasks (DTAs [16], circRNA–drug interactions [17], drug–gene interactions [18], gene–disease interactions [42], miRNA–disease interactions [19], DDIs [42], DTIs [42], and PPIs [42]), and comprehensively demonstrated the performance of the model on multiple datasets, focusing on verifying the generalizability and task adaptability of the model. Figure 4 illustrates the experimental results. The detailed performance comparison on these multiple datasets is presented in Supplementary Tables S2–S4. It shows the performance of FlexBIP in different biological interaction prediction tasks from multiple evaluation metric dimensions. For practical applications, researchers often need to predict interactions involving newly discovered biological molecules or under scenarios with limited known data. Therefore, to further evaluate the performance of our model in such specific contexts, we designed experiments on cold-start scenarios with different data scarcity levels. Specifically, for cold-start scenarios with varying masking ratios (20%, 30%, 40%, and 50%), we randomly masked the corresponding proportions of entries in the association matrix (simulating scarce known data) and trained models (FlexBIP, DNE, and GRACE) to predict the association probabilities of the masked entries. We visually demonstrate the models’ degree of restoration of the true association matrix (Fig. 5). For the optimal binary classification threshold results, please refer to Supplementary Fig. S2. The prediction matrix of FlexBIP is closer to the true matrix under various masking ratios, indicating that it has stronger robustness in the scenario of data missing and can mine potential interactions even when there is very little data. The prediction results of FlexBIP, DNE, and GRACE are compared under different masking ratios. Additionally, to cover more realistic cold-start scenarios, we further conducted experiments on three typical cold-start settings: source cold-start (scarcity in the source dataset), target cold-start (scarcity in the target objects), and source-target cold-start (scarcity in both the source dataset and target objects). In homogeneous graphs, we conducted source-target cold-start experiments; in heterogeneous graphs, we carried out three types of cold-start experiments, namely source cold-start, target cold-start, and source-target cold start. As shown in Fig. 6, for additional evaluation metrics, please refer to Supplementary Figs S3–S5. The FlexBIP model achieves higher prediction accuracy and is well-suited for cold-start tasks in biomolecular interaction prediction. These experiments were repeated multiple times on relevant datasets to ensure the reliability of the results, aiming to comprehensively assess the models’ predictive capabilities under data-scarce conditions. The results presented here are based on the area under the receiver operating characteristic curve (AUROC) metric; (a) performance comparison on homogeneous graphs (PPI01, PPI02, DDI01, and DDI02) under the source-target cold start setting; (b) performance on heterogeneous graphs (DTI01, DTI02) under three distinct settings: source cold start (top), target cold start (middle), and source-target cold start (bottom); “/” indicates not applicable. Downstream analysis and interpretability The FlexBIP model has conducted a series of downstream tasks focusing on the relationships between biological molecules, verifying the model’s performance and the value of embedded features from multiple dimensions. As shown in Fig. 7, by visualizing the multi-class homogeneous graph, edges of the same class are clustered together. This indicates that the embeddings learned by the FlexBIP model can effectively capture the differences between interactions and non-interactions (Fig. 7a). Furthermore, the visualization demonstrates that the embedding features learned by the model can capture the similarity between proteins, causing proteins with similar functions/attributes to naturally cluster in the space. Proteins within the same cluster are clearly aggregated in the 2D PCA space, while different clusters have distinct boundaries in the low-dimensional space. This reflects that the model’s embeddings can effectively distinguish proteins from different groups and verifies the discriminative ability of the embedding features (Fig. 7b). Supplementary Figs S6 and S7 show that other biomolecular interaction pairs within the same cluster clearly aggregate in the 2D PCA space, indicating that the embedding features learned by the model can effectively capture the similarities among these pairs, and the cluster centers marked in the figures are representative. Visualization and clustering analysis of learned embedding; (a) PCA visualization of edges in a multi-class homogeneous graph, demonstrating the model’s ability to cluster edges of the same class and distinguish them from unknown edges; (b) PCA scatter plot of protein embeddings showing distinct cluster aggregations (left) and the corresponding hierarchical clustering dendrogram (right); (c) bar chart comparing the AMI scores of FlexBIP against other baseline methods across three biological classification standards (GOBP, IntAct, and KEGG). Adjusted mutual information (AMI) [43] is used to measure the consistency between clustering results and real class labels. By comparing the AMI of multiple models under different standards [Interaction Actor (IntAct) protein complexes [44], KEGG pathways, and Gene Ontology Biological Processes (GOBP)], FlexBIP achieves the highest AMI value, indicating that the clustering structure of its learned embedding features is closest to the real biological classification (Fig. 7c). The attention-based sequence-pair encoder in the FlexBIP model enables the model to focus on key interactions within the input. The pairs of sites marked with yellow stars have high weights, indicating that the model pays attention to real key interactions, making the predictions more reliable (Fig. 8a). By incorporating the 3D structure of DTI sites, the reliability of the model in quantifying the contribution intensity of specific sites in biomolecular interactions is verified. The left panel of Fig. 8b shows the overall structure of the protein (O00141) and drug (CHEMBL1087421), and the right side zooms in on the core interaction region, presenting the spatial interaction pattern between the drug molecule CHEMBL1087421 (the chlorine atom) and the protein residue (ASP-231, corresponding to site 231 of the O00141 protein). Supplementary Figs S8–S11 display additional examples of protein–drug interactions, intuitively reflecting the model’s capability to identify and focus on key interaction regions. Visualization of sequence-pair encoder and prediction assessment; (a) attention weight matrix highlighting key interaction sites; (b) 3D spatial visualization of the drug and target interaction; (c) scatter plots evaluating the affinity prediction performance of KNN, DTIAM, and FlexBIP. By comparing the performance of KNN, DTIAM, and FlexBIP in predicting drug–target affinity (Fig. 8c), it is found that the scatter points of FlexBIP are closely clustered near the ideal diagonal line, and the regression line almost coincides with the ideal diagonal line. With the smallest root mean square error (RMSE) and an Rp closest to 1, it indicates that FlexBIP has the highest prediction accuracy and the strongest linear correlation, achieving the optimal performance in drug–target affinity prediction. Meanwhile, the real association matrix and model-predicted association matrix of other biomolecular interaction relationships are displayed (Supplementary Figs S12–S14). Case studies We carried out detailed case analyses of the FlexBIP model to visualize its predictive performance in real-world biological networks (Fig. 9). In the Drug–circRNA interaction network, FlexBIP accurately captured numerous known associations for drugs MS-275 and BAY 61-3606 (indicated by blue solid lines), consistent with established biological databases. Notably, the model predicted several novel interactions with potential targets such as amyloid precursor protein (APP), katanin regulatory subunit B1 (KATNB1), and notch receptor 2 (NOTCH2) for MS-275, and lamin A/C (LMNA) for BAY 61-3606 (indicated by red dashed lines). Visualization of biomolecular interaction networks predicted by FlexBIP. Similarly, in the DDI03 interaction network centered on DB00252, FlexBIP not only recovered extensive known DDIs but also identified unverified potential associations with drugs such as DB00648, DB00307, and DB00188. These results indicate that the model’s predictions have high accuracy and reliability. Meanwhile, the discovery of these new interactions demonstrates FlexBIP’s potential in uncovering previously unknown biological relationships, providing candidates for further experimental validation. Case studies on other biomolecular interactions have also been conducted, and their visualized network associations can be found in Supplementary Figs S15–S20. Conclusion Predicting diverse biomolecular interactions is central to advancing systems biology and medicine, as these interactions collectively regulate cellular functions, disease mechanisms, and therapeutic outcomes. Despite recent advancements that have improved prediction accuracy, most existing tools are still limited to single interaction types [5, 9, 10]. They lack the ability to unify modeling across multiple biological networks, offer poor interpretability, and often struggle to integrate multimodal features or support comprehensive downstream analysis. FlexBIP addresses these limitations by providing a flexible framework for multi-type biomolecular interaction prediction. It performs effectively across various association prediction tasks, including DDIs, PPIs, DTIs, DTAs, circRNA–drug interactions, drug–gene interactions, miRNA–disease interactions, and gene–disease interactions. Its feature-aware design provides broad applicability, enabling the model to handle diverse biomolecular interaction and affinity prediction problems, demonstrating strong generalization capabilities to adapt to different data features and structural challenges. FlexBIP also supports a variety of downstream analyses and performs well even in cold-start scenarios involving new molecules. Like other graph-based methods, FlexBIP has a potential limitation: it relies on the availability of underlying network structures. Nevertheless, FlexBIP’s versatility allows it to extend beyond the tested interaction types, with promising applications for modeling other crucial interactions, such as microRNA–target or circRNA–protein interactions. Its interpretable downstream analyses, including interaction attribution scores, further enhance its utility in mechanistic exploration. To biologically contextualize these outcomes, FlexBIP provides a robust mechanistic basis with significant clinical implications for developing improved treatment protocols. Specifically, pinpointing exact binding affinities guides the optimization of lead compounds to reduce off-target toxicity. Furthermore, our network-level predictions provide actionable hypotheses for drug repurposing and preemptive risk assessment of adverse effects, ultimately enhancing patient safety prior to clinical trials. We anticipate that FlexBIP, as an open-source tool, will become a powerful framework for advancing biomolecular interaction research, empowering researchers to leverage multimodal network data for prediction and functional interpretation in low-data and cross-task scenarios. Key Points Flexible Biomolecular Interaction Prediction (FlexBIP) decouples molecular features from graph topologies to effectively fuse node, edge, and auxiliary features for diverse interaction prediction. Flexible Biomolecular Interaction Prediction (FlexBIP) decouples molecular features from graph topologies to effectively fuse node, edge, and auxiliary features for diverse interaction prediction. FlexBIP incorporates a sequence-pair encoder to capture positional feature importance and quantify site-specific contribution strength. FlexBIP incorporates a sequence-pair encoder to capture positional feature importance and quantify site-specific contribution strength. FlexBIP implements a dynamic multi-class contrastive loss function to enhance model performance in complex multi-label prediction tasks. FlexBIP implements a dynamic multi-class contrastive loss function to enhance model performance in complex multi-label prediction tasks. FlexBIP serves as a user-friendly tool equipped with a visualization module, facilitating downstream analysis and robust interpretability. FlexBIP serves as a user-friendly tool equipped with a visualization module, facilitating downstream analysis and robust interpretability. Supplementary Material