Skip to content

Menu

WorksComputer Science

SoftGene: Protein Language Model-Enhanced Soft Prompting for Interpretable Gene Set Annotation

Download PDFView on arXiv

Ask your agent about this work

Your agent reads this work through Valency, with its citations and similar works. Paste this at the start of a chat.

Use the Valency MCP. Work: W_sx5hvnx2. Fetch it with get_paper_by_id, then find its nearest works with find_similar_papers and tell me what it adds.

Works with any MCP client. Not connected yet? Connect your agent

Abstract

Gene set analysis is a cornerstone of functional genomics, yet it remains labor-intensive and heavily dependent on manual curation and expert biological interpretation. While Large Language Models (LLMs) have emerged as powerful tools for genomic reasoning and annotation, most existing approaches rely on symbolic gene names and fail to capture domain-specific biological structure, particularly protein sequence information that governs molecular activity, interactions, and downstream gene function. In this work, we propose SoftGene, a novel framework for LLM-based gene set annotation that leverages the hierarchical structure of gene sets. First, we use a hierarchical attention-based encoder built on ESM, a protein language model, to represent each gene set using protein-level amino acid sequence information. Second, we construct a hybrid prompting scheme that combines soft prompts derived from gene set embeddings with hard prompts containing auxiliary context generated by an LLM, and feed the resulting prompt into a local LLM for annotation. We evaluate our framework on two benchmark datasets: Gene Ontology (GO) and the Molecular Signatures Database (MSigDB). Our results show that integrating protein-sequence representations with textual context improves gene set annotation overall, while per-domain analyses reveal that the contribution of protein embeddings varies across biological domains.

Introduction

Gene sets represent cohorts of functionally related genes that collectively drive specific biological pathways and cellular processes ([2]). Generating gene set annotations, which are concise descriptions that delineate shared functional behaviors and metabolic roles, is a fundamental task in modern genomics ((Ji et al., 2026)). As sequencing continues to reveal novel gene associations, the ability to rapidly and accurately annotate these sets is essential for translating raw data into biological insights ((Salzberg, 2019)).

Traditionally, gene set annotation has relied on expert curation or statistical enrichment methods, such as Over-Representation Analysis (ORA) ([5]) and Gene Set Enrichment Analysis (GSEA) ((Subramanian et al., 2005)). However, manual annotation is a time-consuming process that cannot scale with the current pace of data generation ([4]). Furthermore, existing automated methods are inherently limited by their dependence on curated databases, which are often incomplete or biased toward well-studied genes and biological processes ([23] (Stoeger et al. 2018)).

The recent emergence of Large Language Models (LLMs) has introduced a promising paradigm for a wide range of biological and biomedical tasks ([14] (Luo et al. 2022; Jin et al. 2024)) including automated gene annotation ((Wang et al., 2024; Joachimiak et al., 2024)). However, current LLM-based approaches often overlook the domain-specific biological structure of constituent proteins. Protein-sequence representations can provide evolutionary and structural signals such as subcellular localization ((Thumuluri et al., 2022)), interaction-relevant interfaces ((Sun et al., 2025)), and structural properties ((Simon and Zou, 2025)) that may complement symbolic gene information ([1]). The utility of these sequence-derived signals, however, can vary across biological domains. Moreover, hard-prompting strategies typically treat genes as semantic tokens, and LLMs remain prone to hallucination ((Kalai et al., 2025)), which reduces their reliability for this task. Lastly, although many LLM approaches provide narrative explanations through generative reasoning ((Hu et al., 2025)), they still lack a concrete decision path showing how specific genes or protein domains contribute to the predicted annotation.

In this paper, we address these limitations by presenting a soft-prompting framework for interpretable gene set annotation. An overview of the framework is shown in Figure 1. Our main contributions are as follows:

Figure 1. High-level overview of the model architecture. The proposed approach combines a sequence-level pathway that encodes amino acid information into soft prompt tokens with a textual pathway that provides high-level functional context from a large language model, enabling the generation of descriptive gene set annotations optimized via supervision against ground-truth labels.

  • We incorporate the embeddings from a pretrained protein language model (PLM) and introduce a hierarchical attention encoder that learns to weigh the relative importance of biological features and aggregate them into a comprehensive representation of gene sets.

  • We propose a conditioning scheme that bridges biological sequence data and natural language, enabling an LLM to generate annotations informed by both text-based context and protein-sequence-derived representations.

  • We provide concrete interpretability by leveraging the hierarchical attention mechanism to quantify the relative importance of biological features contributing to each annotation. This yields explicit, feature-level explanations grounded in the input data, rather than relying solely on implicit reasoning within the language model.

  • We evaluate our framework on two widely used benchmark datasets: Gene Ontology (GO) and MSigDB. Results demonstrate superior performance over existing baselines across metrics.

Methodology

In this section, we formalize the gene set annotation task and introduce the associated notation. We then provide an overview of the proposed model architecture, followed by a detailed description of each component of the method.

Problem Formulation

A gene set is a collection of genes that are grouped together based on shared biological function, participation in a common pathway, or co-regulation. Gene sets are widely used in genomics to represent higher-level biological processes and functional modules.

Let {G1,…,GN}\{\mathcal{G}_1,\ldots,\mathcal{G}_N\} denote a collection of gene sets. Each gene set G\mathcal{G} consists of a variable number of member genes G={g1,…,gM}\mathcal{G}=\{g_1,\ldots,g_M\} where MM is the length of the set. The ordering of genes within a set is assumed to be irrelevant. Each gene gig_i encodes one or more proteins {pi,1,…,pi,Ki}\{p_{i,1},\ldots,p_{i,K_i}\} where KiK_i represents the number of protein isoforms associated with gig_i; KiK_i may vary across genes, reflecting multiple isoforms or splice products. Each protein pi,jp_{i,j} is represented as a sequence of amino acids

pi,j=(a1,a2,…,aLi,j),(1)p_{i,j}=(a_1,a_2,\ldots,a_{L_{i,j}}), \tag*{(1)}

where Li,jL_{i,j} denotes the length of the protein and each aℓ∈Aa_\ell\in\mathcal{A} is an amino acid from the standard set of 20 residues, A={A,C,…,Y}\mathcal{A}=\{\mathrm{A},\mathrm{C},\ldots,\mathrm{Y}\}.

For each gene set G\mathcal{G}, we are given a free-text annotation y=(y1,…,yT)y=(y_1,\ldots,y_T) describing the biological function, pathway membership, or functional role. These annotations are concise, domain-specific phrases or sentences designed to capture the essential functional properties of the gene set without extensive narrative context.

Task: Given a gene set G={g1,…,gM}\mathcal{G} = \{g_1, \ldots, g_M\}, with each gene gig_i associated with proteins pi,1,…,pi,Kip_{i,1}, \ldots, p_{i,K_i} represented as amino acid sequences, the goal of the gene set annotation task is to predict the corresponding annotation sequence

y=(y1,y2,…,yT),y = (y_1, y_2, \ldots, y_T),

where yt∈Vy_t \in\mathcal{V} are tokens drawn from the vocabulary V\mathcal{V} of the pretrained language model. Formally, the task can be framed as conditional sequence generation; we seek a model fθf_\theta such that

fθ(G)=y^≈y,f_\theta(\mathcal{G}) = \hat{y} \approx y,

where y^=(y^1,y^2,…,y^T)\hat{y} = (\hat{y}_1, \hat{y}_2, \ldots, \hat{y}_T) is the predicted annotation sequence. In other words, the model must learn a mapping from the hierarchical representation of the gene set, incorporating amino acid sequences for all constituent proteins, to a concise, technical description of the gene set’s biological function.

Model Overview

The model consists of two main components:

  • A Hierarchical Attention-Based Gene Set Encoder, which learns context-aware gene set representations by encoding proteins with a frozen pretrained protein language model (PLM) and hierarchically aggregating them into gene- and gene set–level embeddings using attention pooling.

  • The Hybrid Gene Set Soft Prompting module, wherein the resulting gene set embedding is projected by a trainable multilayer perceptron (MLP) into soft prompt tokens that condition a frozen language model for free-text annotation generation. These soft prompts are combined with task instructions and auxiliary contextual information from a large pretrained language model and fed to a local LLM to produce the final predicted annotation.

Hierarchical Attention-Based Gene Set Encoder

The hierarchical attention-based gene set encoder is responsible for generating gene set-level representations using trainable attention pooling mechanisms. As shown in Figure 2, we begin by taking as input a gene set G\mathcal{G} comprising genes g1,g2,…,gMg_1, g_2, \ldots, g_M where M=∣G∣M = |\mathcal{G}|. Each gene gig_i encodes proteins p1(i),p2(i),…,pKi(i)p_1^{(i)}, p_2^{(i)}, \ldots, p_{K_i}^{(i)}, where Ki=∣gi∣K_i = |g_i|, and each protein pj(i)p_j^{(i)} is expressed as a sequence of amino acids

Figure 2. Overview of the hierarchical gene set encoder. Frozen pretrained protein representations are hierarchically aggregated using trainable attention-based pooling to produce a gene set embedding.

a1(i,j),a2(i,j),…,aLi,j(i,j)a_1^{(i,j)}, a_2^{(i,j)}, \ldots, a_{L_{i,j}}^{(i,j)}, where Li,j=∣pj(i)∣L_{i,j} = |p_j^{(i)}|. Each protein pj(i)p_j^{(i)} is first encoded using a pretrained protein language model (ESM-2), which produces a contextual embedding for each amino acid in the sequence:

{a^k(i,j)}k=1Li,j=ESM⁡({ak(i,j)}k=1Li,j)(2)\{\hat{a}_k^{(i,j)}\}_{k=1}^{L_{i,j}} = \operatorname{ESM}(\{a_k^{(i,j)}\}_{k=1}^{L_{i,j}}) \tag*{(2)}

where a^k(i,j)∈Rd\hat{a}_k^{(i,j)} \in\mathbb{R}^d, and dd is the hidden dimension of the protein language model. To obtain a fixed-size embedding for each protein, we apply mean pooling over its amino acid embeddings. Specifically, for protein pj(i)p_j^{(i)}, we compute:

p^j(i)=1Li,j∑k=1Li,ja^k(i,j).(3)\hat{p}_j^{(i)} = \frac{1}{L_{i,j}} \sum_{k=1}^{L_{i,j}} \hat{a}_k^{(i,j)}. \tag*{(3)}

For higher-level aggregation, we use attention pooling. Given a set of input embeddings {x1,…,xL}\{x_1, \ldots, x_L\}, attention pooling is defined as follows. Each embedding is first scored using a trainable multilayer perceptron (see Appendix § 11.§ 1 for details):

hk=MLP⁡(xk),(4)h_k = \operatorname{MLP}(x_k), \tag*{(4)}

The weights αk\alpha_k are obtained via a softmax:

αk=exp⁡(hk)∑ℓ=1Lexp⁡(hℓ).(5)\alpha_k = \frac{\exp(h_k)}{\sum_{\ell=1}^{L} \exp(h_\ell)}. \tag*{(5)}

and the pooled representation x^\hat{x} is computed as a weighted sum:

x^=∑k=1Lαkxk.(6)\hat{x} = \sum_{k=1}^{L} \alpha_k x_k. \tag*{(6)}

We denote this operator as AttentionPooling(⋅\cdot), which is reused for multiple aggregation steps across different levels of the hierarchy.

Given the set of protein embeddings associated with a gene gig_i, corresponding to its annotated splice isoforms, we aggregate them into a single gene-level representation using the AttentionPooling(⋅\cdot) operator defined above. Specifically, we apply attention pooling to {p^j(i)}j=1Ki\{\hat{p}^{(i)}_j\}_{j=1}^{K_i} with a gene-level pooling MLP to obtain the gene embedding g^i\hat{g}_i:

g^i=AttentionPooling⁡gene({p^j(i)}j=1Ki).(7)\hat{g}_i = \operatorname{AttentionPooling}_{\mathrm{gene}}\left(\{\hat{p}^{(i)}_j\}_{j=1}^{K_i}\right). \tag*{(7)}

This allows the model to differentially weight splice isoforms according to their relevance, downweighting noisy or irrelevant isoforms and producing a gene representation that reflects isoform-specific contributions to be used as input to the subsequent gene set–level aggregation.

Given a gene set G\mathcal{G} with gene embeddings {g^i}i=1M\{\hat{g}_i\}_{i=1}^{M}, we apply the AttentionPooling(⋅\cdot) operator with independently learned parameters to produce a fixed-size gene set representation G^\hat{\mathcal{G}}:

G^=AttentionPooling⁡set({g^i}i=1M).(8)\hat{\mathcal{G}} = \operatorname{AttentionPooling}_{\mathrm{set}}\left(\{\hat{g}_i\}_{i=1}^{M}\right). \tag*{(8)}

This final representation captures the relative contributions of genes within the set and serves as input to downstream components.

Hybrid Gene Set Soft Prompting

As shown in Figure 4, this module generates free-text annotations from the gene set embedding produced by the hierarchical encoder.

Overview of the hybrid gene set soft prompting module

Figure 4. Overview of the hybrid gene set soft prompting module. A gene set embedding is converted into soft prompt tokens that, together with instruction and context prompts, condition a frozen language model to generate free-text gene set annotations.

To condition the local LLM (e.g., Llama) on the gene set embedding, we map it to the LLM input space using a multi-layer perceptron (MLP):

S=MLP⁡soft(G^),(9)S = \operatorname{MLP}_{\mathrm{soft}}(\hat{\mathcal{G}}), \tag*{(9)}

where S∈Rn×dLLMS \in\mathbb{R}^{n \times d_{\mathrm{LLM}}} is a sequence of nn tunable soft tokens in the embedding space of the LLM. These tokens serve as a learnable continuous prompt that encodes the structured biological information from the gene set.

In addition to the soft prompt, we append two hard prompts to guide the LLM during generation. The first prompt, HinstH_{\mathrm{inst}}, contains the instruction for the model, specifying that it should generate a candidate annotation for the input gene set. The second prompt, HcontH_{\mathrm{cont}}, is generated by a commercial large pretrained language model2 (in our case, GPT 4.1 Nano) and provides context and analysis of the genes in the set through semantic-level reasoning as follows:

Hcont=LLM⁡commercial([g1,g2,…,gM]).(10)H_{\mathrm{cont}} = \operatorname{LLM}_{\mathrm{commercial}}([g_1, g_2, \ldots, g_M]). \tag*{(10)}

The prompts passed to LLM⁡commercial\operatorname{LLM}_{\mathrm{commercial}} are shown in Figure 3. This context supplies knowledge that the smaller local LLM may not encode in its pre-trained weights.

System and user prompts for gene set context

Figure 3. To obtain the gene set context, we utilize a system prompt to define a persona and stylistic guidelines alongside a user prompt for task instructions, which are fed to a commercial model.

The final input to the LLM (a local Llama 3 model (Grattafiori et al., [18]) is the concatenation of the instruction, context, and soft prompts, which is then used to generate the candidate gene set annotation:

y^=LLMlocal([S;Hinst;Hcont]).(11)\hat{y} = \mathrm{LLM}_{\mathrm{local}}\left([S; H_{\mathrm{inst}}; H_{\mathrm{cont}}]\right). \tag*{(11)}

Training Procedure

Given the ground-truth annotation sequence y=(y1,…,yT)y = (y_1, \ldots, y_T), the language model defines a conditional distribution over output tokens:

P(y∣G^)=∏t=1TP(yt∣y<t,S,Hinst,Hcont).(12)P(y \mid\hat{G}) = \prod_{t=1}^{T} P(y_t \mid y_{<t}, S, H_{\mathrm{inst}}, H_{\mathrm{cont}}). \tag*{(12)}

Training is performed using teacher forcing, where at each time step the model conditions on the ground-truth prefix y<ty_{<t}. The training objective is the standard token-level cross-entropy loss:

LLM=−∑t=1Tlog⁡P(yt∣y<t,S,Hinst,Hcont).(13)\mathcal{L}_{\mathrm{LM}} = -\sum_{t=1}^{T} \log P(y_t \mid y_{<t}, S, H_{\mathrm{inst}}, H_{\mathrm{cont}}). \tag*{(13)}

During optimization, the parameters of the PLM and language model are kept frozen. Gradients are propagated only through the soft prompt projector MLPsoft\mathrm{MLP}_{\mathrm{soft}} and the hierarchical attention encoder, allowing the model to learn an effective conditioning of the language model on gene set representations while fully leveraging pretrained knowledge.

Experiments

Datasets

We evaluate our framework on two widely used gene set databases. Statistics for each dataset after filtering are presented in Table 1. The datasets are elaborated as follows:

MeasureGOMSigDB
Number of Gene Sets18,8892,461
Avg. Genes Per Set21.1850.07
Min. Number of Genes15
Max. Number of Genes13,6161,491
Unique Genes Covered42,59712,021
Avg. Annotation Length38.5136.25
Min. Annotation Length46
Max. Annotation Length187155

Table 1. Dataset statistics (annotation length measured in characters).

  • Gene Ontology (GO): The Gene Ontology (GO) dataset (Ashburner et al., [2]) provides a structured, controlled vocabulary for describing gene functions across three domains: Biological Process (BP), Molecular Function (MF), and Cellular Component (CC).

  • MSigDB: The Molecular Signatures Database (MSigDB) (Liberzon et al., 2015) is a comprehensive collection of annotated gene sets. We use gene sets from the C2 collection, specifically from KEGG (Kanehisa and Goto, 2000), Reactome (Fabregat et al., [12]), PID (Schaefer et al., 2009), and BioCarta (Nishimura, 2001).

Experimental Settings

We publicly release our source code for reproducibility.3 We randomly split the data into 70% training and 30% testing sets and report the mean and 95% confidence interval over three runs. Hyperparameter settings for both modules are presented in Appendix § 11.§ 1.

Evaluation Metrics

Following previous works (Wang et al., 2024, 2025), we employ lexical and semantic similarity measures to evaluate our method. We use the following metrics for our evaluation:

  • METEOR (Lavie and Agarwal, 2007) measures the alignment between the candidate annotation and the reference by considering unigram matches while accounting for synonyms, stemming, and word order. We report METEOR to capture lexical alignment while accounting for synonyms, stemming, and word order.

  • ROUGE (Lin, 2004) identifies the longest common subsequence between the generated and reference texts. This ensures that essential biological keywords and descriptions from the ground truth are captured in the model’s output.

  • BERTScore (Zhang et al., 2019) addresses the limitations of exact-match metrics by using contextual embeddings to calculate similarity. By comparing tokens based on their vector representations, BERTScore rewards candidate annotations that are synonymous with the ground truth, even when exact phrasing differs.

Results

Baseline Comparison

We compare our approach against the following categories of baselines, as summarized in Table 2.

ConfigurationGene Ontology (GO)MSigDB
METEORROUGE-LBERTScore-F1METEORROUGE-LBERTScore-F1
Prompt Engineering Methods
Zero-shot0.024 ± 0.0010.133 ± 0.0010.773 ± 0.000.087 ± 0.0140.127 ± 0.0090.762 ± 0.002
Few-shot0.018 ± 0.0010.164 ± 0.0030.740 ± 0.0010.100 ± 0.0250.136 ± 0.0170.771 ± 0.008
One-shot CoT0.065 ± 0.0010.096 ± 0.0020.761 ± 0.0010.086 ± 0.0100.112 ± 0.0030.762 ± 0.001
Prompt-tuning Methods
Gene Symbol Soft Prompting0.113 ± 0.0020.158 ± 0.0040.778 ± 0.0010.105 ± 0.0220.138 ± 0.0210.771 ± 0.008
P-Tuning0.148 ± 0.1300.196 ± 0.1300.783 ± 0.0420.113 ± 0.0580.161 ± 0.0610.716 ± 0.026
Prefix Tuning0.142 ± 0.0820.173 ± 0.0940.766 ± 0.0480.080 ± 0.0060.113 ± 0.0210.756 ± 0.007
Agentic Systems
Discovera0.107 ± 0.0030.144 ± 0.0050.769 ± 0.0010.092 ± 0.0030.108 ± 0.0030.768 ± 0.007
TALISMAN0.108 ± 0.0060.146 ± 0.0020.766 ± 0.0010.086 ± 0.0050.107 ± 0.0010.760 ± 0.001
GeneAgent0.071 ± 0.0030.116 ± 0.0020.768 ± 0.0010.030 ± 0.0060.117 ± 0.0030.764 ± 0.002
SoftGene
SoftGene (Mistral 3 8B)0.203 ± 0.0150.257 ± 0.0150.802 ± 0.0010.148 ± 0.0170.206 ± 0.0180.795 ± 0.005
SoftGene (Qwen 3 8B)0.210 ± 0.0070.260 ± 0.0030.803 ± 0.0010.135 ± 0.0230.194 ± 0.0210.790 ± 0.007
SoftGene (Llama 3.2 3B)0.197 ± 0.0130.247 ± 0.0030.800 ± 0.0010.145 ± 0.0040.206 ± 0.0110.793 ± 0.004
SoftGene (Llama 2 13B)0.191 ± 0.0080.239 ± 0.0110.797 ± 0.0040.121 ± 0.0240.184 ± 0.0240.787 ± 0.009
SoftGene (Llama 3.1 8B)0.220 ± 0.0330.267 ± 0.0290.806 ± 0.0060.157 ± 0.0050.215 ± 0.0010.795 ± 0.003

Table 2. Performance of SoftGene and baselines on the Gene Ontology (GO) and MSigDB datasets. First, second, and third-best results are indicated by boldface, double underline, and single underline, respectively.

  • Prompt Engineering Methods: We evaluate standard zero-shot and few-shot prompting

[7], as well as a one-shot chain-of-thought (CoT) prompting strategy following prior work (Hu et al., 2025). These baselines rely entirely on the language model’s knowledge acquired during pretraining. Our method consistently outperforms them across all metrics, indicating the limitations of prompting alone for this task.

  • Prompt-tuning Methods: We compare against two standard prompt-tuning techniques, P-Tuning (Liu et al., 2022) and Prefix Tuning (Li and Liang, 2021), as well as a baseline that uses token embeddings averaged across all gene symbols in the set as a soft prompt. These methods allow the model to adapt to the task with limited additional parameters. These prompt-tuning baselines underperform SoftGene under our evaluation setting, resulting in lower performance than our approach.

  • Agentic Systems: We evaluate agentic baselines that incorporate external knowledge sources. Discovera (Pinto Veizaga et al., 2025) and TALISMAN (Joachimiak et al., 2024) augment generation with database queries, while GeneAgent (Wang et al., 2024) combines retrieval-augmented generation (RAG) with self-reflection mechanisms to produce grounded outputs. Despite access to external biological databases, these methods underperform our model, showing that these agentic baselines do not match SoftGene under our evaluation setting.

Ablation Study

We conduct an ablation study in Table 3 to evaluate the contribution of each component in SoftGene. Removing the soft prompt and relying solely on hard prompts (“w/o Soft Prompt (SS)”) leads to a substantial performance drop across all metrics and both datasets, highlighting the importance of directly conditioning the LLM on structured gene set representations. Excluding LLM-generated contextual information (“w/o Context (HcontH_{\mathrm{cont}})”) results in a consistent degradation in performance while still outperforming baselines, indicating that high-level semantic context improves generation quality. When replacing pretrained PLM embeddings with randomly initialized embeddings (“w/o Protein Embeddings”), overall performance decreases, indicating that sequence-derived representations provide complementary information beyond the downstream architecture. As shown by the per-domain analysis, however, the magnitude of this contribution varies substantially across biological domains. Notably, without pretrained protein embeddings, SoftGene still outperforms all baselines, demonstrating that gains are not simply attributable to PLM embeddings. These results confirm that SoftGene’s gains arise from the combined effect of structured gene set embeddings, attention-based pooling, and soft prompt conditioning, with each contributing meaningfully to final performance.

ConfigurationGene Ontology (GO)MSigDB
METEORROUGE-LBERTScoreMETEORROUGE-LBERTScore
w/o Soft Prompt (SS)0.020±0.0000.020 \pm0.0000.065±0.0010.065 \pm0.0010.707±0.0010.707 \pm0.0010.006±0.0040.006 \pm0.0040.045±0.0020.045 \pm0.0020.704±0.0010.704 \pm0.001
w/o Context (HcontH_{\mathrm{cont}})0.182±0.0240.182 \pm0.0240.232±0.0280.232 \pm0.0280.795±0.0050.795 \pm0.0050.145±0.0070.145 \pm0.0070.202±0.0200.202 \pm0.0200.790±0.0030.790 \pm0.003
w/o Protein Embeddings0.199±0.0150.199 \pm0.0150.252±0.0170.252 \pm0.0170.803±0.0020.803 \pm0.0020.097±0.0170.097 \pm0.0170.135±0.0250.135 \pm0.0250.774±0.0120.774 \pm0.012
SoftGene0.220±0.0330.220 \pm0.0330.267±0.0290.267 \pm0.0290.806±0.0060.806 \pm0.0060.157±0.0050.157 \pm0.0050.215±0.0010.215 \pm0.0010.795±0.0030.795 \pm0.003

Table 3. Ablation study.

Soft Prompt Length

We analyze the effect of soft prompt length on model performance by varying the number of learned soft prompt tokens and evaluating outputs. Results for the GO and MSigDB datasets are shown in Figure 5 and Figure 6. Across both datasets, performance varies only modestly across the evaluated prompt lengths. Since increasing prompt length yields no significant performance gains, we select 10 tokens as an empirical choice to reduce computational cost while preserving information.

Figure 5. Performance comparison of the SoftGene model across different soft prompt lengths using the GO dataset.

Figure 6. Performance comparison of the SoftGene model across different soft prompt lengths using the MSigDB dataset.

Gene-Disjoint Generalization

To further evaluate whether SoftGene learns biologically meaningful sequence representations rather than memorizing gene co-occurrence patterns, we conduct additional experiments using a gene-disjoint train-test split. In this setting, train and test partitions are constructed such that genes appearing in the test set are excluded from the training set as much as possible while maintaining an approximate 70/30 split ratio. This provides a substantially more challenging evaluation setting by requiring the model to generalize to previously unseen genes rather than relying on overlap between training and evaluation gene sets. Results are reported in Table 4. We observe that SoftGene trained under the gene-disjoint split performs comparably to the standard random split across all evaluation metrics on both the GO and MSigDB datasets. While modest decreases in performance are expected due to the stricter evaluation protocol, the overall degradation remains limited. These findings suggest that SoftGene is not solely memorizing recurring gene compositions, but instead learns transferable biological sequence patterns and functional relationships that generalize to unseen genes.

SplitGene Ontology (GO)MSigDB
METEORROUGE-LBERTScoreMETEORROUGE-LBERTScore
Gene-Disjoint0.205 ± 0.0140.251 ± 0.0150.801 ± 0.0090.136 ± 0.0820.193 ± 0.0620.791 ± 0.034
Random0.220 ± 0.0330.267 ± 0.0290.806 ± 0.0060.157 ± 0.0050.215 ± 0.0010.795 ± 0.003

Table 4. Performance comparison between random and gene-disjoint train-test splits.

Per-Domain PLM Embedding Ablation

To better understand the contribution of protein language model embeddings within the SoftGene framework, we present a fine-grained ablation broken down by GO domain (MF, BP, CC) in Table 5. For each domain, we compare SoftGene with real

DomainPLMRandomizedΔ
METEORROUGE-LBERTScoreMETEORROUGE-LBERTScoreMETEORROUGE-LBERTScore
BP0.2230.2640.8020.2220.2560.798-0.001-0.008-0.004
CC0.1640.2120.7840.1020.1510.769-0.062-0.061-0.015
MF0.2360.3140.8250.2130.2850.820-0.023-0.029-0.005

Table 5. Per-domain ablation of PLM embeddings on the GO dataset. Comparison between real PLM embeddings and randomized embeddings, with differences.

PLM embeddings against a randomized embedding baseline, where protein embeddings are replaced with random noise of the same dimensionality. This isolates the domains in which protein sequence information provides the greatest benefit. Notably, the effect of PLM embeddings varies across domains, with larger improvements observed in CC compared to BP and MF, suggesting that different GO domains may differentially benefit from sequence-derived representations.

Case Verification: Zinc Ion Transmembrane Transport

We first examine the gene set GO:0071577 (zinc ion transmembrane transport), for which the model produces a near-perfect prediction. The highest attention weights are assigned to genes from known zinc transporter families, including SLC39 (ZIP) and SLC30 (ZnT), which mediate zinc influx and efflux across cellular membranes [9] (Jeong and Eide 2013). The top-ranked genes, SLC39A5 and SLC39A4, are well-characterized zinc importers (Wang et al., 2004); SLC39A4 is mutated in acrodermatitis enteropathica (Wang et al., 2002), a classic inherited zinc deficiency disorder. Genes less directly related to zinc transport, such as the glutamate transporter SLC1A1 (Kanai and Hediger, 2003), receive lower attention weights. This indicates that the gene-level attention layer ranks genes by functional relevance rather than treating all set members equally.

Interpretability: Smooth Muscle Signaling

We next analyze attention scores for GO:0045986 (negative regulation of smooth muscle contraction), shown in Figure 7. SoftGene predicts the related term “negative regulation of cGMP biosynthetic process,” consistent with the nitric oxide–cGMP pathway that regulates vascular smooth muscle relaxation (Hofmann et al., 2006). At the gene level, the highest attention weights are assigned to CALCA, encoding the vasodilator calcitonin gene-related peptide [6], and the beta-adrenergic receptors ADRB2 and ADRB3, which promote smooth muscle relaxation via cAMP signaling (Johnson, 2006). At the isoform level, the highest-weighted PRKG1 protein is ENSP00000363092.5 (PRKG1α). Unlike PRKG1β, PRKG1α localizes to smooth muscle stress fibers and mediates vascular relaxation in response to cGMP [15] (Hofmann et al. 2006). This preference emerges without isoform-level supervision, suggesting that protein language model embeddings encode sequence signals distinguishing functional splice variants.

Figure 7. Attention visualization for GO:0045986. The tree depicts the three-level hierarchy of the gene set encoder, with the top five protein isoforms (by attention weight) shown beneath each gene. Node size reflects learned attention weights, indicating the relative contribution of each gene and protein isoform.

Related Works

Automatic Gene Set Annotation: Recent evaluations show that large language models outperform traditional methods for gene set annotation by synthesizing knowledge from biomedical text, while remaining susceptible to hallucinated biological associations (Hu et al., 2025). TALISMAN evaluates instruction-tuned LLMs for gene set function summarization and finds that their outputs remain dependent on curated biological knowledge bases to ensure reliability (Joachimiak et al., 2024). GeneAgent introduces a self-verifying language agent for gene set knowledge discovery, using iterative verification to improve factual consistency (Wang et al., 2024). Discovera integrates LLMs with retrieval-based biological tools to ground gene set annotations in external knowledge sources and mitigate hallucinations (Pinto Veizaga et al., 2025).

LLM Soft Prompting: Advances in parameter-efficient fine-tuning have led to a family of methods that steer frozen models through learned prompts rather than updating model weights. Prefix-Tuning introduces continuous, learnable vectors prepended to Transformer layers, enabling parameter-efficient steering of frozen models (Li and Liang, 2021). Prompt Tuning shows that, for sufficiently large models, optimizing soft tokens at the input embedding layer can achieve performance comparable to full fine-tuning (Lester et al., 2021). P-Tuning models dependencies among soft prompts using a continuous prompt encoder, improving stability and allowing prompts to be conditioned on specific inputs (Liu et al., 2024b). P-Tuning v2 extends soft prompting to deeper Transformer layers to maintain effectiveness on smaller-scale models (Liu et al., 2022). Soft prompting has also been explored in biological domains, including multimodal protein modeling in ProCyon (Queen et al., 2025), gene-focused dialogue systems in GeneChat [8], and genomic reasoning such as BioReason [13].

Conclusion

In this work, we presented SoftGene, a hybrid prompting framework that integrates a hierarchical attention-based encoder over protein sequences with soft prompt conditioning for language model–driven gene set annotation. Experimental results on the Gene Ontology and MSigDB benchmarks show that SoftGene outperforms prompt-based, agent-based, and prompt-tuning baselines across the reported metrics. Additional analyses show that protein-sequence representations provide complementary information, while their contribution varies substantially across biological domains. These findings support sequence-aware soft prompting as a promising approach for interpretable gene set annotation while highlighting the importance of domain-specific evaluation and biological validation.

Ethical Considerations

SoftGene should not be used as a substitute for expert biological judgment or experimental validation, particularly in high-stakes biomedical or clinical settings. We encourage users to treat generated annotations as hypothesis-generating tools rather than definitive functional claims, and future work should explore mechanisms for uncertainty estimation, expert-in-the-loop evaluation, and bias-aware benchmarking in gene set interpretation.

Limitations

Dataset Coverage: SoftGene is trained and evaluated on curated resources biased toward well-studied genes and biological processes, which may limit generalization to poorly annotated or emerging functions. Moreover, the contribution of protein-sequence embeddings varies across GO domains. Future work should evaluate on less curated gene sets and further characterize when sequence information provides the greatest benefit. Evaluation Scope: Although we supplement lexical metrics with biomedical semantic and ontology-aware measures, these evaluations remain reference-based and do not fully capture biological correctness or experimental validity. Future work should incorporate expert evaluation and downstream biological validation to more rigorously assess generated annotations.

Acknowledgments

This work is dedicated to the memory of Drew Ross and to his family. Drew’s brilliance, warmth, and dedication drove this project from its inception, and he is deeply missed by all of us.

This work was supported by the National Science Foundation under Grant No. OIA-2531881.

Additional Experiments

LLM Backbone for Context Generation

We evaluate the impact of different commercial large language models for generating textual context describing each gene set in Figure 8 and Figure 9. Specifically, we compare contexts produced by GPT, DeepSeek (Liu et al., 2024a), Claude, and Gemma (Team et al., 2025) while keeping all other components fixed. Contexts generated by GPT and DeepSeek result in the strongest overall performance across all performance metrics, with DeepSeek achieving the highest average scores. Claude yields slightly lower but comparable performance, while Gemma consistently underperforms the other models.

Figure 8. Performance comparison of SoftGene across different commercial models using the GO dataset.

Performance comparison of SoftGene across different commercial models using the MSigDB dataset

Figure 9. Performance comparison of SoftGene across different commercial models using the MSigDB dataset.

Encoder Protein Language Model

We evaluate the robustness of our approach to the choice of protein language model by training with embeddings generated from multiple protein encoders, including three ESM-2 checkpoints of varying capacity and ProtBERT [10], a BERT model trained on amino acid sequence data. As shown in Figure 10 and Figure 11, performance is highly consistent across models, with minimal variation in performance metrics across random seeds. These results indicate that our method is not sensitive to the specific protein embedding backbone used, suggesting that improvements stem from how gene set representations are integrated into the language model rather than from any particular protein encoder.

Figure 10. Performance comparison of SoftGene across different protein language models using the GO dataset.

Performance comparison of SoftGene across different protein language models using the MSigDB dataset

Figure 11. Performance comparison of SoftGene across different protein language models using the MSigDB dataset.

Performance by Description Length

We analyze model performance as a function of annotation length, stratified by the number of words in the reference description, for both the GO and MSigDB datasets in (A) of Figure 12 and Figure 13. On GO, performance is relatively stable across short and mid-length descriptions (1–6 words), with a modest improvement for longer annotations (7+ words), suggesting that more descriptive ground-truth labels are easier for the model to approximate. On MSigDB, the trend is reversed: shorter descriptions (1–2 words) yield the highest BERTScore F1, with performance declining as description length increases. This may reflect the fact that short MSigDB annotations tend to describe well-defined, canonical pathways that are more straightforwardly predicted, whereas longer descriptions capture more complex or nuanced biological processes. Together, these results suggest that annotation complexity is a meaningful factor in model performance, and that the relationship between description length and difficulty varies across databases.

Figure 12. BERTScore F1 performance across gene set characteristics in the GO dataset. Box plots display the distribution of BERTScore F1 scores stratified by four gene set properties: (A) description length in words, (B) GO domain (biological process, cellular component, molecular function), (C) mean gene frequency across all gene sets (binned into quintiles Q1–Q5, where Q1 represents the most unique genes and Q5 the least unique), and (D) number of genes per gene set. Sample sizes (n) are indicated at the bottom of each panel.

Figure 13. BERTScore F1 performance across gene set characteristics in the MSigDB dataset. Box plots display the distribution of BERTScore F1 scores stratified by four gene set properties: (A) description length in words, (B) MSigDB collection (BIOCARTA, KEGG LEGACY, PID, REACTOME), (C) mean gene frequency across all gene sets (binned into quintiles Q1–Q5, where Q1 represents the most unique genes and Q5 the least unique), and (D) number of genes per gene set. Sample sizes (n) are indicated at the bottom of each panel.

Performance by Gene Set Cardinality

We analyze model performance as a function of gene set cardinality across both datasets in (D) of Figure 12 and 13. On GO, performance increases monotonically with set size, with the exception of the largest gene sets (100+ genes) achieving noticeably lower BERTScore than smaller sets. Larger gene sets may provide more aggregate sequence information, although differences in annotation composition and difficulty across size bins may also contribute to this trend.

On MSigDB, the trend is reversed, with performance decreasing monotonically across cardinality bins. This may reflect the fact that larger MSigDB gene sets tend to describe broader, more complex pathway-level concepts that are inherently harder to summarize concisely, whereas smaller sets often correspond to well-defined, canonical pathways with more predictable annotations. Together, these results suggest that the relationship between set size and annotation difficulty is database-dependent, reflecting the structural differences between GO and MSigDB annotation schemas.

Performance by Domain and Collection

We examine performance across biological domains in GO and collection sources in MSigDB. The results are presented in (B) of Figure 12 and 13. Across GO domains, molecular function annotations achieve the highest BERTScore, followed by biological process, with cellular component yielding the lowest scores. However, absolute performance does not directly reflect the contribution of protein-sequence representations. As shown by the per-domain PLM ablation in Table 5, the benefit of protein embeddings varies across domains, with negligible gains for biological process, modest gains for molecular function, and the largest improvements for cellular component. These results suggest that sequence-derived representations provide complementary information whose contribution depends on the biological domain.

Across MSigDB collections, the PID collection achieves the strongest performance despite its small number of examples (n=64n=64). BIOCARTA, KEGG LEGACY, and REACTOME show comparable and slightly lower performance, with higher variance, potentially reflecting greater heterogeneity in annotation style and the smaller number of examples available for each collection. The performance differences observed across GO domains and MSigDB collections are consistent with the differing compositional structure of each database. GO terms group genes that share a specific annotated function by definition, meaning gene membership alone is already highly predictive of the annotation and leaves limited room for protein sequence embeddings to provide additional signal beyond what co-occurrence patterns already encode. MSigDB gene sets are instead drawn from heterogeneous experimental signatures across diverse sources, with their authors explicitly noting heterogeneity within gene sets; in this setting, symbolic gene identity is a less reliable cue and aggregating protein sequence information across diverse gene members provides a substantially stronger discriminative signal. This also explains the asymmetry observed in the PLM embedding ablation (Table 3), where protein embeddings provide a larger performance gain on MSigDB than GO, which is a pattern that is biologically interpretable rather than anomalous. The gene-disjoint generalization results (Table 4) further support this interpretation that SoftGene exploits transferable sequence-level features rather than memorizing gene identity or co-occurrence patterns.

Performance by Gene Uniqueness

To determine if model performance is influenced by the specificity of the underlying genes, we analyzed BERTScore F1 as a function of Mean Gene Frequency, stratified into quintiles from Q1 (most unique) to Q5 (least unique).

For a gene set GiG_i with genes g∈Gig \in G_i, we define mean gene frequency as

MGF⁡(Gi)=1∣Gi∣∑g∈Gif(g),(14)\operatorname{MGF}(G_i) = \frac{1}{|G_i|}\sum_{g \in G_i} f(g), \tag*{(14)}

where f(g)f(g) denotes the number of gene sets in the dataset that contain gene gg.

The results are presented in (C) of Figure 12 and 13. In GO, median performance exhibits a gradual decline from Q1 to Q5, with modestly higher variance in lower quintiles, indicating that gene sets composed of highly unique genes are somewhat more variable in difficulty. In MSigDB, median performance remains largely stable across Q1–Q4, followed by a slight increase in Q5. This pattern suggests that sets containing frequently reused (i.e., less unique) genes may be marginally easier to annotate, potentially because such genes are enriched in well-characterized canonical pathways.

Overall, the effect of gene uniqueness is limited relative to the broader performance range, indicating that SoftGene remains robust across varying levels of gene reuse.

Performance by Ontology Depth

We further evaluate model performance on the GO dataset stratified by ontology depth, which serves as a proxy for functional specificity. As shown in Figure 14, BERTScore tends to increase with ontology depth. This upward trend suggests that the model is more effective at approximating the descriptions of highly specific biological terms than those of broader, more generic categories located near the root of the ontology. This may be due to more specific terms having distinct, well-defined lexical profiles in the training data compared to the abstract and often overlapping definitions of high-level terms.

Figure 14. BERTScore F1 performance stratified by GO ontology depth. Box plots display the distribution of BERTScore F1 scores across gene sets binned by their depth within the Gene Ontology hierarchy (0–3, 4–5, 6–7, 8–9, and 10+).

Additional Performance Metrics

To further assess biological validity beyond surface-level text similarity, we evaluate SoftGene and all other baseline methods using two biologically-grounded metrics: semantic similarity computed using PubMedBERT (Gu et al., 2021), which is a biomedical domain-specific encoder, and Hierarchical Semantic Similarity (HSS) (following Wang et al. (2024)), which measures whether predicted Gene Ontology (GO) terms are consistent with the hierarchical structure of the GO directed acyclic graph (DAG).

For HSS, we first construct a hierarchical neighborhood for each ground-truth GO term by traversing the GO DAG upward to collect ancestor terms. The traversal includes standard GO relationships such as “is a”, “part of”, and regulatory edges (e.g., “regulates”, “positively regulates”, and “negatively regulates”), and is restricted to a maximum hop distance of K=3K = 3. This yields a set of biologically related ancestor terms that represent general functional abstractions of the original annotation.

Each annotation is represented using a biomedical sentence encoder (PubMedBERT), which maps both predicted annotations y^\hat{y} and ancestor terms a∈AK(y)a \in A_K(y) into a shared semantic embedding space. HSS is then defined as the maximum cosine similarity between the embedding of the predicted annotation and the embeddings of all ancestor terms:

HSS⁡(y^,y)=max⁡a∈AK(y)cos⁡(ey^,ea),(15)\operatorname{HSS}(\hat{y}, y) = \max_{a \in A_K(y)} \cos(e_{\hat{y}}, e_a), \tag*{(15)}

where ey^e_{\hat{y}} and eae_a denote the embeddings of the predicted annotation and ancestor term respectively. HSS is computed exclusively for the Gene Ontology dataset, as MSigDB does not define an explicit term hierarchy. Results are reported in Table 6. SoftGene achieves the strongest performance across the biologically grounded metrics, indicating improved semantic alignment and ontology-aware consistency. However, the margins over competing methods are smaller than those observed for lexical metrics such as METEOR and ROUGE-L. This suggests that part of the larger lexical improvement may reflect better alignment with the phrasing and style of the reference annotations, while the gains in biological content are more modest. Thus, we interpret the biologically grounded metrics as complementary evidence of improved annotation quality rather than as showing improvements of the same magnitude as the lexical metrics.

Table 6: Performance of SoftGene and baselines on the Gene Ontology (GO) and MSigDB datasets using additional performance metrics. Best results are indicated by boldface.

ConfigurationGene Ontology (GO)MSigDB
Semantic SimilarityHierarchical Semantic SimilaritySemantic Similarity
Prompt Engineering Methods
Zero-shot0.861 ± 0.0020.871 ± 0.0020.876 ± 0.001
Few-shot0.860 ± 0.0010.869 ± 0.0010.872 ± 0.002
One-shot CoT0.863 ± 0.0100.885 ± 0.0000.876 ± 0.003
Prompt-tuning Methods
Gene Symbol Soft Prompting0.874 ± 0.0010.897 ± 0.0010.879 ± 0.003
P-Tuning0.882 ± 0.0020.896 ± 0.0020.868 ± 0.003
Prefix Tuning0.877 ± 0.0040.890 ± 0.0030.886 ± 0.001
Agentic Systems
Discovera0.865 ± 0.0010.893 ± 0.0010.874 ± 0.000
TALISMAN0.867 ± 0.0000.892 ± 0.0010.870 ± 0.004
GeneAgent0.865 ± 0.0010.888 ± 0.0010.873 ± 0.003
SoftGene
SoftGene (Llama 3.1 8B)0.888 ± 0.0030.900 ± 0.0010.899 ± 0.002

Table 6. Performance of SoftGene and baselines on the Gene Ontology (GO) and MSigDB datasets using additional performance metrics. Best results are indicated by boldface.

Additional Case Studies

Regulation of Megakaryocyte Differentiation

We examine the biological process gene set GO:0045652 (regulation of megakaryocyte differentiation), for which the model produces a near-perfect prediction. The highest gene-level attention weight is assigned to MEF2C, a transcription factor known to be essential for megakaryocyte differentiation and platelet production ([17]). RBM15, which directly regulates alternative splicing of key megakaryopoiesis transcription factors including GATA1 and RUNX1, receives an intermediate attention weight, consistent with its established role in this process ((Zhang et al., 2015)). In contrast, LOX and EIF6, which are a matrix-remodeling enzyme and a general translation factor, respectively, receive among the lowest attention weights, reflecting their more peripheral relevance to megakaryocyte differentiation specifically. These results suggest that the hierarchical attention encoder successfully distinguishes between genes that are central to megakaryocyte differentiation and those with more general cellular functions within the same gene set.

Hypoxia-Inducible Factor in the Cardiovascular System

We examine the BIOCARTA_HIF_PATHWAY gene set, which represents hypoxia-inducible factor (HIF) signaling. The model assigns its highest attention to HIF1A, VHL, and VEGFA. HIF1A and VHL form the central oxygen-sensing regulatory mechanism, where VHL controls degradation of HIF1A under normal oxygen conditions ((Jaakkola et al., 2001)). VEGFA is a key downstream target that drives vascular growth in response to hypoxia ((Semenza, 2012)). In contrast, genes with more general cellular functions, such as HSP90AA1 and P4HB, receive lower attention weights, consistent with roles in protein folding and cellular maintenance rather than hypoxia-specific signaling. Overall, the model concentrates attention on core pathway regulators and outputs, while assigning lower importance to broadly expressed housekeeping genes.

Glyoxylate and Dicarboxylate Metabolism

We examine the KEGG GLYOXYLATE_AND_DICARBOXYLATE_METABOLISM pathway, for which the model assigns elevated attention to several canonical metabolic enzymes. The highest attention weight is assigned to CS (citrate synthase), a core enzyme of central carbon metabolism that catalyzes entry into the tricarboxylic acid cycle ((Zhang et al., 2025)). Related enzymes including ACO1/ACO2 and MDH1/MDH2 also receive high attention weights, consistent with their established roles in interconnected dicarboxylate and mitochondrial metabolic processes ((Omini et al., 2024)). The model additionally assigns elevated attention to HAO1, HAO2, and GRHPR, which are more directly associated with glyoxylate metabolism and detoxification pathways [16] (Wanders et al. 2025). Together, these patterns suggest that the model upweights metabolically related enzymes within the pathway rather than assigning attention uniformly across all genes.

Qualitative Analysis

High- and Low-Scoring Completions

Table 7 and Table 8 present the top and bottom performing gene set predictions for GO and MSigDB, respectively, as measured by BERTScore F1. High-scoring examples demonstrate the model’s ability to precisely capture enzymatic activities and metabolic pathways, whereas lower-scoring cases often involve more complex regulatory processes or nuanced phenotypic descriptions.

GroupGene SetScoreReferencePredicted
Top 5GO:00041430.9500ATP-dependent diacylglycerol kinase activitydiacylglycerol kinase activity
Top 5GO:00455880.9500positive regulation of gamma-delta T cell differentiationpositive regulation of T cell differentiation
Top 5GO:00421290.9499regulation of T cell proliferationpositive regulation of T cell activation
Top 5GO:01409500.9496histone H2A deubiquitinase activityhistone H2A deubiquitination
Top 5GO:00065630.9493L-serine metabolic processserine metabolic process
Bottom 5GO:00304310.5774sleeppositive regulation of interleukin-18 production
Bottom 5GO:00432760.5747anoikispositive regulation of cell cycle G1/S phase transition
Bottom 5GO:00147050.5672C zonemyosin binding
Bottom 5GO:00306280.5530pre-mRNA 3’-splice site bindingU2 snRNP
Bottom 5GO:19906030.5337dark adaptationregulation of G protein-coupled receptor signaling pathway

Table 7. Top 5 and bottom 5 scoring gene set predictions from GO by BERTScore F1 (excluding perfect scores).

GroupGene SetScoreReferencePredicted
Top 5REACTOME_SARS_COV_INFECTIONS0.9477SARS-CoV InfectionsSARS-CoV-2 infection
Top 5REACTOME_DOWNSTREAM_SIGNALING_OF_ACTIVATED_FGFR40.9458Downstream signaling of activated FGFR4Signaling by FGFR4
Top 5REACTOME_DOWNSTREAM_SIGNALING_OF_ACTIVATED_FGFR20.9454Downstream signaling of activated FGFR2Signaling by FGFR2
Top 5BIOCARTA_MTOR_PATHWAY0.9453mTOR Signaling PathwaymTOR signaling
Top 5REACTOME_METHIONINE_SALVAGE_PATHWAY0.9450Methionine salvage pathwayMethionine salvage
Bottom 5REACTOME_S_PHASE0.6173S PhaseRegulation of APC/C activators in early mitosis
Bottom 5PID_ALPHA_SYNUCLEIN_PATHWAY0.6088Alpha-synuclein signalingParkinson’s disease
Bottom 5KEGG_HUNTINGTONS_DISEASE0.5938Huntington’s diseaseMitochondrial ATP synthase complex
Bottom 5REACTOME_MISCELLANEOUS_SUBSTRATES0.5279Miscellaneous substratesCYP4A11, CYP4A22, CYP4B1, ...
Bottom 5REACTOME_FATTY_ACIDS0.5047Fatty acidsCYP4A11, CYP4A22, . . .

Table 8. Top 5 and bottom 5 scoring gene set predictions from MSigDB by BERTScore F1 (excluding perfect scores).

Failure Mode Analysis

While SoftGene achieves strong performance across both benchmarks, a qualitative analysis of low-scoring predictions reveals systematic and interpretable failure patterns. Rather than reflecting random errors, these cases illuminate specific limitations of the model’s learned representations and, in some instances, expose shortcomings of the evaluation metrics themselves. We identify three recurring failure modes below.

Substrate Specificity Failure

Example Gene Set: GO:0015756

Predicted: "sodium:sugar symporter"

Reference: "fucose transmembrane transport"

Analysis: This failure mode involves the accurate identification of a molecular mechanism while failing to specify the precise chemical substrate. This example suggests that while the PLM embeddings may encode structural signals associated with the transporter class, the gene set encoder may aggregate residue-level signals to an extent that subtle active-site configurations are smoothed over. Consequently, the model prioritizes robust functional class recognition over minute chemical variations.

Pathway Pleiotropy Failure

Example Gene Set: GO:0045743

Predicted: "cell-substrate adhesion"

Reference: "fibroblast growth factor receptor signaling"

Analysis: The model occasionally identifies biological processes that are functionally coupled with, or downstream of, the primary reference term. In the case of the example, biologically, fibroblast growth factor receptors are primary regulators of focal adhesions and cytoskeletal remodeling [11] (Mori and Takada 2013). These results indicate that the soft prompt tokens are capturing a broader, pleiotropic signature of the gene set. This suggests the model is identifying a valid biological "neighborhood" or a high-level structural consequence of the signaling pathway, suggesting that the learned representation may capture broader functional relationships among cellular processes.

Semantic Granularity Failure

Example Gene Set: GO:0045187

Predicted: "regulation of circadian rhythm"

Reference: "regulation of circadian sleep/wake cycle"

Analysis: This failure mode highlights instances where the model generates semantically valid synonyms or parent terms that are penalized by rigid string-matching metrics. While the predicted and reference terms are functionally nearly identical, the resulting ROUGE-L score is low despite a high BERTScore. This discrepancy underscores a limitation of standard NLP evaluation in the biological domain and confirms that SoftGene is capturing the core biological concept with high fidelity, even when the generated output diverges from the specific granularity of the curated ground truth.

Implementation Details

We use the Hugging Face Transformers library (Wolf et al., 2019) for all local LLM inference and training, the Accelerate library [20] for distributed training, and the Evaluate library (Von Werra et al., 2022) for evaluation metrics. For the BERTScore metric, we use DistilBERT (Sanh et al., 2019). We utilize a server equipped with three NVIDIA A6000 GPUs, 512 GB of RAM, and a 48-core CPU.

Hyperparameters

The hyperparameters used for training SoftGene on the GO and MSigDB datasets are presented in Table 14. To obtain HcontH_{\mathrm{cont}}, LLM inference was conducted using the default generation hyperparameters, with the sole modification that the number of max new tokens was set to 100.

ParameterGOMSigDB
Hierarchical Attention Encoder
Learning Rate α\alpha1×10−31 \times10^{-3}1×10−31 \times10^{-3}
Protein Pooling Hidden Size512512
Gene Pooling Hidden Size512512
Weight Decay1×10−41 \times10^{-4}1×10−41 \times10^{-4}
Gradient Clipping Norm11
Hybrid Soft Prompting Module
Training Epochs15
Batch Size44
Gradient Accumulation Steps44
Learning Rate β\beta5×10−45 \times10^{-4}5×10−45 \times10^{-4}
Hidden Dimension40964096
Weight Decay1×10−21 \times10^{-2}1×10−21 \times10^{-2}
Dropout Rate1×10−11 \times10^{-1}1×10−11 \times10^{-1}
Soft Prompt Length1010

Table 14. Hyperparameter settings.

Baselines

Prompt Engineering Methods

For all prompt engineering baselines, we use the Llama-3.1-8B-Instruct model. We conducted inference via the Replicate API using the default inference configuration.

Prompt-Tuning Methods

For all prompt-tuning baselines, we use the base Llama-3.1-8B model. We employ soft prompt tuning with 10 virtual tokens. We omit commercial LLM context (HcontH_{cont}) for this setting, but note that SoftGene outperforms prompt tuning baselines even without this context (see “w/o Context (HcontH_{cont})” in Table 3). Models were trained for one epoch on the GO dataset and two epochs on the MSigDB dataset. Due to the short length of both the prompts and target gene set annotations, prompt tuning converged rapidly.

Agentic Systems

For all agentic system baselines, we use the GPT-4o-mini model accessed via the OpenAI API. To ensure comparable inference costs with SoftGene, we limit the number of self-verification iterations in the GeneAgent baseline to three. Similarly, for Disevora, we restrict the number of genes passed to the INDRA API to 10, as the API returns pairwise interactions between genes, which otherwise leads to substantially longer inference times.

Runtime Analysis

In this section, we report the runtime for each phase of the SoftGene framework. Protein embedding inference is performed once over the entire human proteome prior to training and cached for all subsequent use; runtime details for this step are reported in Table 9. Because protein embeddings are pre-computed and cached, no repeated PLM forward pass is required during SoftGene training or evaluation; the runtime cost of the hierarchical attention encoder is limited to a linear-time sparse scatter aggregation and a small MLP projection, both of which are negligible relative to the LLM forward pass. Training time and memory details are reported in Table 10. Evaluation time and memory details are reported in Table 11. We note that for novel gene sets not present in GO or MSigDB, an additional commercial LLM inference pass is required to generate the auxiliary context HcontH_{\mathrm{cont}}; we omit this from our runtime reporting due to its highly variable network latency.

MetricValue
Total Time6,575.92s (1.83 hr)
Average Time per Protein26.80 ms
Throughput37.3 proteins/s
Peak GPU Memory2.250 GB

Table 9. Protein embedding inference runtime using ESM-2 on a single NVIDIA A6000 GPU.

MetricValue
Total Training Time1,709.11s (0.47 hr)
Peak GPU Memory46.39 GB

Table 10. SoftGene training runtime on the GO dataset using two NVIDIA A6000 GPUs.

MetricSoftGeneZero-Shot
Total Inference Time584.72s478.91s
Average Time per Sample103.18 ms84.51 ms
Throughput9.69 samples/s11.83 samples/s
Peak GPU Memory19.84 GB18.87 GB

Table 11. Inference runtime comparison between SoftGene and the zero-shot baseline on the GO dataset using a single NVIDIA A6000 GPU.

Scalability to Large Gene Sets

A potential concern is the scalability of SoftGene to large gene sets, as the GO dataset contains gene sets with up to 13,616 member genes (Table 1). Our attention pooling operates in O(n)O(n) time with respect to gene set size, as we employ query-only attention rather than pairwise attention, avoiding the quadratic memory bottleneck common to standard self-attention. We additionally leverage sparse scatter operations to perform efficient aggregation across variable-length gene sets in a single batched operation. To empirically validate this, we report inference runtime on the five largest gene sets in our evaluation set in Table 12, observing that even at this scale SoftGene remains computationally tractable in this setting.

MetricValue
Total Time2.43 s
Average Time per Sample467.45 ms
Throughput2.14 samples/s

Table 12. Inference runtime of SoftGene on the five largest gene sets in the GO evaluation set.

Dataset Preparation

In this section, we outline the steps taken to prepare the benchmark datasets.

Protein Sequences and Isoforms

We obtain protein sequences from the Ensembl proteome (Homo_sapiens.GRCh38.pep.all.fa)4 ((Martin et al., 2023)). This resource also provides a mapping from gene symbols to their corresponding splice isoforms, giving us the hierarchical gene-to-protein information required for the gene set annotation task. The Ensembl proteome thus provides all necessary information to construct input representations for both the GO and MSigDB datasets, enabling the model to leverage gene- and protein-level features consistently across benchmarks.

GO Dataset

To construct the GO gene sets, we use two primary input files: the GO ontology file (go.obo)5 and the human gene annotation file (goa_human.gaf)6 obtained from the GO Consortium. The ontology file defines all GO terms and their hierarchical relationships, while the GAF file provides gene-to-term annotations.

We load the ontology using GODag from the goatools library and read the GAF following the GAF v2.2 format. For each GO term, we collect all associated human gene symbols, storing the term’s name and namespace (biological process, molecular function, or cellular component). Finally, gene sets are exported as a JSON object mapping each GO ID to its genes, description, and domain.

MSigDB Dataset

To construct the MSigDB gene sets from the C2:CP collection, we use two input sources: the GMT file (c2.all.v2025.1.Hs.symbols.gmt)7 and the accompanying SQLite database (msigdb_v2025.1.Hs.db)8. The GMT file provides the gene sets as lists of gene symbols, while the database contains metadata including gene set descriptions and collection information.

We first read the GMT file, extracting gene set names and their associated gene symbols. Next, we query the database to retrieve brief descriptions and collection names for all C2:CP gene sets, excluding certain sub-collections (e.g., WIKIPATH-WAYS and KEGG_MEDICUS) to focus on canonical pathway sets. Gene sets are filtered to retain only those present in both the GMT file and the database. The gene sets, including cleaned descriptions, gene symbols, and collection names, are exported as a structured JSON object mapping gene set names to their content.

Dataset Contamination Analysis

Data contamination is a common concern in NLP and LLM research, particularly when evaluation datasets are drawn from publicly available resources that may overlap with model pretraining corpora. We address two potential sources of contamination relevant to our evaluation.

Memorization of GO and MSigDB annotations. We construct the datasets from late-2025 releases of GO and MSigDB. For GPT-4.1 nano, the documented knowledge cutoff predates these releases, reducing the possibility that release-specific updates were included in its pretraining data. However, many underlying genes, pathways, and annotations predate the selected releases and may have appeared in model pretraining corpora. Therefore, the use of recent database releases reduces but does not eliminate the possibility of contamination.

Data leakage through auxiliary context. A separate concern is whether HcontH_{cont} encodes ground-truth label information, as commercial LLMs may have memorized annotations and pathway descriptions from biomedical literature. We address this in two ways. First, as shown in Table 3, SoftGene without auxiliary context (“w/o Context HcontH_{cont}”) still outperforms all competitive baselines across both datasets. If HcontH_{cont} were truly encoding ground-truth label information, removing it would cause a catastrophic performance drop; instead, we observe only a moderate decrease, confirming that it provides supplementary biological context rather than label information. Second, we directly measured lexical overlap between GPT-generated context and ground-truth annotations across both datasets, reported in Table 13. The negligible overlap confirms that observed performance cannot be attributed to verbatim copying from the generated context.

DatasetGround Truth Overlap
GO1.37%
MSigDB3.41%

Table 13. Lexical overlap between GPT-generated auxiliary context and ground-truth annotations.

LLM Prompts

In this section, we share the LLM prompts used in our method as well as the prompts used for each of the prompting baselines.

SoftGene Prompt

Figure 15 shows the prompt used for SoftGene. We deliberately keep the prompt concise, providing minimal details, so that the model can freely learn task-relevant information during training. This approach allows the soft prompt to adapt effectively to the gene prediction task.

Instruction prompt used for SoftGene

Figure 15. Instruction prompt used for SoftGene.

Zero-Shot Prompt

Figure 16 shows the zero-shot prompt. In this setup, we provide only task instructions, forcing the model to rely entirely on its pretraining knowledge to perform the task. No examples or task-specific demonstrations are given, making this a baseline for evaluating the model’s generalization abilities.

System and user prompt used for zero-shot prompting baseline

Figure 16. System and user prompt used for zero-shot prompting baseline.

Few-Shot Prompt

Figure 17 shows the few-shot prompt. In this setup, we provide the model with a small number of task examples along with the instructions, allowing it to infer the desired output format and style. This few-shot context helps the model leverage both its pretraining knowledge and the provided demonstrations to perform the task more accurately.

System and user prompt used for few-shot prompting baseline

Figure 17. System and user prompt used for few-shot prompting baseline.

One-Shot Chain-of-Thought Prompt

Figure 18 shows the one-shot chain-of-thought prompt. This prompt includes a single example that demonstrates step-by-step reasoning, guiding the model to analyze the system before producing a final output. By providing both the instructions and a worked example, the prompt encourages the model to follow a reasoning process.

System and user prompt used for one-shot chain-of-thought prompting baseline

Figure 18. System and user prompt used for one-shot chain-of-thought prompting baseline.

Additional Related Works

Protein Language Models

Protein language models (PLMs) apply the self-supervised pretraining paradigm from NLP to amino acid sequences, learning representations of protein structure and function directly from evolutionary data. Rives et al. (2021) established the foundation for this line of work by training ESM-1b on 250 million protein sequences, demonstrating that structural and functional properties emerge from sequence-level pretraining alone without explicit structural supervision. Lin et al. (2023) scaled this approach to 15 billion parameters with ESM-2 and ESMFold, enabling direct inference of atomic-level protein structure from primary sequence. Elnaggar et al. [10] introduced ProtTrans, a family of transformer models pretrained on protein sequences, demonstrating that NLP pretraining strategies transfer effectively to amino acid data; ProtBERT serves as one of the encoder backbones in our ablation study. Meier et al. (2021) showed that PLMs support zero-shot prediction of mutational effects without any task-specific supervision, demonstrating that PLM representations encode functional information beyond structural topology and motivating our use of these embeddings to distinguish functionally distinct isoforms. Rao et al. (2021) introduced the MSA Transformer, which interleaves row and column attention across multiple sequence alignments to incorporate co-evolutionary context, achieving substantially improved contact prediction over single-sequence models. Hayes et al. [22] presented ESM3, a multimodal generative PLM that jointly reasons over protein sequence, structure, and function, representing the frontier of PLM capability and pointing toward richer biological representations for gene annotation tasks.

Traditional Gene Set Annotation Methods

The analysis of gene sets has a long history in functional genomics, with early methods framing the problem as statistical over-representation testing. Beissbarth and Speed [5] introduced one of the first automated approaches, identifying statistically overrepresented GO terms within a gene list by comparing observed annotation frequencies against a background distribution. While conceptually straightforward, such over-representation methods treat gene sets as unordered collections and discard magnitude and directionality information present in expression data. Subramanian et al. (2005) addressed this by operating on ranked gene lists derived from differential expression, using a weighted Kolmogorov-Smirnov statistic to detect coordinated shifts in gene set activity. However, GSEA produces enrichment scores at the cohort level, limiting applicability to single-sample settings. Barbie et al. [3] extended this to individual samples by computing per-sample enrichment scores, while Hänzelmann et al. [21] further generalized the approach as a non-parametric kernel estimation problem applicable across microarray and RNA-Seq platforms. A separate line of work recognized that gene membership alone is insufficient to capture signaling complexity. Tarca et al. (2009) incorporated pathway topology by weighting genes according to their connectivity within curated signaling graphs, though such methods remain dependent on the completeness of curated databases (Liberzon et al., 2015). Collectively, these methods share a fundamental limitation: they map gene sets to predefined categorical labels rather than generating descriptive natural language annotations, and the methods discussed above do not directly incorporate protein-sequence representations. SoftGene is designed to address both of these gaps.

References

  1. [1]Christian B Anfinsen. 1973. Principles that govern the folding of protein chains. Science, 181(4096):223–230.pubmed.ncbi.nlm.nih.gov/4124164
  2. [2]Michael Ashburner, Catherine A Ball, Judith A Blake, David Botstein, Heather Butler, J Michael Cherry, Allan P Davis, Kara Dolinski, Seth S Dwight, Janan T Eppig, et al. 2000. Gene ontology: tool for the unification of biology. Nature genetics, 25(1):25–29.pubmed.ncbi.nlm.nih.gov/10802651
  3. [3]David A Barbie, Pablo Tamayo, Jesse S Boehm, So Young Kim, Susan E Moody, Ian F Dunn, Anna C Schinzel, Peter Sandy, Etienne Meylan, Claudia Scholl, et al. 2009. Systematic rna interference reveals that oncogenic kras-driven cancers require tbk1. Nature, 462(7269):108–112.
  4. [4]William A Baumgartner Jr, K Bretonnel Cohen, Lynne M Fox, George Acquah-Mensah, and Lawrence Hunter. 2007. Manual curation is not sufficient for annotation of genomic databases. Bioinformatics, 23(13):i41–i48.
  5. [5]Tim Beissbarth and Terence P Speed. 2004. Gostat: find statistically overrepresented gene ontologies within a group of genes. Bioinformatics, 20(9):1464–1465.pubmed.ncbi.nlm.nih.gov/14962934
  6. [6]Susan D Brain and Andrew D Grant. 2004. Vascular actions of calcitonin gene-related peptide and adrenomedullin. Physiological reviews, 84(3):903–934.pubmed.ncbi.nlm.nih.gov/15269340
  7. [7]Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901.arxiv.org/abs/2005.14165
  8. [8]Shashi Dhanasekar, Akash Saranathan, and Pengtao Xie. 2025. Genechat: A multi-modal large language model for gene function prediction. bioRxiv.DOI
  9. [9]David J Eide. 2006. Zinc transporters and the cellular trafficking of zinc. Biochimica et Biophysica Acta (BBA)-Molecular Cell Research, 1763(7):711–722.pubmed.ncbi.nlm.nih.gov/16675045
  10. [10]Ahmed Elnaggar, Michael Heinzinger, Christian Dallago, Ghalia Rehawi, Yu Wang, Llion Jones, Tom Gibbs, Tamas Feher, Christoph Angerer, Martin Steinegger, et al. 2022. Prottrans: toward understanding the language of life through self-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 44(10):7112–7127.DOI
  11. [11]VP Eswarakumar, I Lax, and J Schlessinger. 2005. Cellular signaling by fibroblast growth factor receptors. Cytokine & growth factor reviews, 16(2):139–149.pubmed.ncbi.nlm.nih.gov/15863030
  12. [12]Antonio Fabregat, Steven Jupe, Lisa Matthews, Konstantinos Sidiropoulos, Marc Gillespie, Phani Garapati, Robin Haw, Bijay Jassal, Florian Korninger, Bruce May, et al. 2018. The reactome pathway knowledgebase. Nucleic acids research, 46(D1):D649–D655.
  13. [13]Adibvafa Fallahpour, Andrew Magnuson, Purav Gupta, Shihao Ma, Jack Naimmer, Arnav Shah, Hoanan Duan, Omar Ibrahim, Hani Goodarzi, Chris J Maddison, et al. 2025. Bioreason: Incentivizing multimodal biological reasoning within a dna-llm model. arXiv preprint arXiv:2505.25379.arxiv.org/abs/2505.23579
  14. [14]Noelia Ferruz, Steffen Schmidt, and Birte Höcker. 2022. Protgpt2 is a deep unsupervised language model for protein design. Nature communications, 13(1):4348.
  15. [15]Sharron H Francis, Jennifer L Busch, and Jackie D Corbin. 2010. cgmp-dependent protein kinases and cgmp phosphodiesterases in nitric oxide and cgmp action. Pharmacological reviews, 62(3):525–563.DOI
  16. [16]Sander F Garrelfs, Serhii Chornyi, Heleen Te Brinke, Jos Ruiter, Jaap Groothoff, and Ronald JA Wanders. 2024. Glyoxylate reductase: definitive identification in human liver mitochondria, its importance for the compartment-specific detoxification of glyoxylate. Journal of Inherited Metabolic Disease, 47(2):280–288.DOI
  17. [17]Christos Gekas, Katrin E Rhodes, Laurraine M Gereige, Hildur Helgadottir, Roberto Ferrari, Siavash K Kurdistani, Encarnación Montecino-Rodriguez, Rhonda Bassel-Duby, Eric Olson, Andrei V Krivtsov, et al. 2009. Mef2c is a lineage-restricted target of scl/tal1 and regulates megakaryopoiesis and b-cell homeostasis. Blood, The Journal of the American Society of Hematology, 113(15):3461–3471.
  18. [18]Aaron Grattafori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, et al. 2024. The llama 3 herd of models. arXiv preprint arXiv:2407.21783.
  19. [20]Sylvain Gugger, Lysandre Debut, Thomas Wolf, Philipp Schmid, Zachary Mueller, Sourab Mangrulkar, Marc Sun, and Benjamin Bossan. 2022. Accelerate: Training and inference at scale made simple, efficient and adaptable. https://github.com/huggingface/accelerate.
  20. [21]Sonja Hänzelmann, Robert Castelo, and Justin Guinney. 2013. Gsva: gene set variation analysis for microarray and rna-seq data. BMC bioinformatics, 14(1):7.DOI
  21. [22]Thomas Hayes, Roshan Rao, Halil Akin, Nicholas J Sofroniew, Deniz Oktay, Zeming Lin, Robert Verkuil, Vincent Q Tran, Jonathan Deaton, Marius Wiggert, et al. 2025. Simulating 500 million years of evolution with a language model. Science, 387(6736):850–858.DOI
  22. [23]Winston A Haynes, Aurelie Tomczak, and Purvesh Khatri. 2018. Gene annotation bias impedes biomedical research. Scientific reports, 8(1):1362.DOI

AI tools statement

No AI-use declaration is available for this version in Valency.

The available record does not establish whether AI systems or models contributed to this work.

How AI tools are recorded

Paper details

Cite this paper

Publication

Published
Version
Latest

Data & code

Code, data, proofs and workflows the authors linked for testing, review and reproduction. These links are part of this work’s metadata and are released under the same license as the rest of that metadata. Valency doesn’t host the files; each keeps the license set where it’s hosted.

Pick where to look, or just type