title
scPrompt: Unleashing the Power of In-Context Learning for Single-Cell Biology via Adaptive Prompt Selection
abstract
Predicting cellular responses to genetic or chemical perturbations is a central challenge in AI-driven virtual cell modeling, with important implications for drug discovery and mechanistic biology. Recent approaches leverage in-context learning (ICL), where perturbed reference cells are used as prompts to condition predictions for unseen query cells.
However, existing methods typically construct prompts through random sampling or coarse cell-type grouping. Such strategies often introduce substantial noise due to donor variation, batch effects, and transcriptional heterogeneity, leading to unstable and suboptimal predictions.
In this work, we investigate the impact of prompt quality on single-cell perturbation prediction and show that naive prompt construction can lead to large performance variance. To address this, we propose scPrompt, a simple yet effective adaptive prompt selection framework based on heuristic matching in embedding space.
Specifically, we design a query-aware prompt selection strategy that prioritizes transcriptionally similar and contextually relevant cells using embedding similarity and filtering criteria. This approach aims to reduce noisy or mismatched prompts while preserving biologically meaningful signals.
Preliminary results demonstrate that our heuristic selection strategy consistently outperforms random prompt sampling and improves prediction robustness across perturbation conditions. These findings highlight the importance of prompt quality and provide a practical direction for improving context construction in single-cell foundation models.
method
We propose a three-stage prompt selection strategy based on embedding similarity, designed to dynamically select the most informative prompt cells for each query batch. The primary challenge of this approach lies in the fundamental state discrepancy: query cells are in a control state, whereas candidate prompt cells are in a perturbed state. Because these cells span across both different cell types and treatment conditions, direct comparison within the embedding space is intractable.
To address this limitation, we introduce a bridge prediction step. Utilizing the aligned model of the Stack, we perform a complete in-context generation using actual perturbed prompts as the prompt and control prompts as the query. This process generates a "predicted perturbed" gene expression profile for each control prompt cell, from which the corresponding embedding is extracted. This step effectively establishes an implicit mapping from the control state to the perturbed state within the embedding space.
Building upon this foundation, the subsequent two-stage selection process proceeds as follows:
- Stage 1: Matching in the Control Domain. We compute the average embedding of the current query batch and calculate its cosine similarity against the embeddings of all control prompt cells. The top $K_1 = 512$ control prompts exhibiting the highest similarity are subsequently selected.
- Stage 2: Mapping to the Perturbed Domain. We calculate the mean of the predicted perturbed embeddings corresponding to the $K_1$ control prompts selected in the first stage. This mean vector serves as a proxy representation for the "expected perturbation direction." We then compute the cosine similarity between this proxy representation and the embeddings of all actual perturbed prompt cells, selecting the top $N$ most similar actual perturbed cells (T cells) as the final prompts for the current batch.
The underlying intuition of this method is straightforward: we first identify reference cells that are most similar to the state of the query cells under the shared control condition. By leveraging the bridge mapping, we then infer the anticipated position of these reference cells in the embedding space following perturbation. Ultimately, we select the actual perturbed cells that most closely align with this inferred spatial position.