---
title: 'S-Prompts: Selective Prompting in LLMs'
url: https://www.emergentmind.com/topics/s-prompts
type: topic
---

# S-Prompts: Selective Prompting in LLMs

Selective prompts, or “S-Prompts,” represent a methodological advance in prompt-based adaptation of large pretrained models, unifying several distinct lines of research that emphasize selectivity, modularity, and structural control in prompting. S-Prompts have been explored for their roles in domain incremental learning, continual text classification, personalized LLM dialogue, semi-parametric multitask adaptation, enhancement of segmentation via prompt learning, and resource-aware structured prompt engineering. This survey provides a comprehensive technical account spanning core S-Prompt architectures, mathematical formulations, representative learning algorithms, practical applications, interpretability, and known limitations.

## 1. Formal Definitions and Architectures

S-Prompts in the literature refer to “Selective Prompts” in continual or modular prompt tuning [2406.18187, 2505.20933], “Shared Prompts” playing a role in task-invariant knowledge retention [2505.20933], domain-specific “Soft Prompts” for domain-incremental learning [2207.12819], and “Structured Prompts” as the declarative constructs in Structured Prompt Language (SPL) [2602.21257]. Despite terminological variation, these designs share three defining characteristics:
- **Selectivity**: S-Prompts are not monolithic; they are dynamically allocated, retrieved, or fused per input, task, or domain.
- **Parameter Efficiency**: Only the prompt (or a small prompt bank) is tuned, with all model parameters frozen.
- **Compositional Modularity**: Multiple prompts coexist and are orchestrated—typically via a selection, retrieval, or fusion mechanism.

A canonical S-Prompt system comprises the following components:
- A frozen base model (e.g., BERT, T5, ViT, Llama2).
- A set of prompt embeddings ($\{\mathbf{sp}_i\}$).
- A selection or retrieval module to choose or blend $\mathbf{sp}_i$ per input $X$ (e.g., via similarity, KNN, or an MLP/dense retriever).
- Optional: context-aware or domain-aware constraints.

In domain-incremental learning (DIL), S-Prompts are implemented as domain-specific prompt matrices $\mathbf{P}_s \in \mathbb{R}^{L \times d}$, with $L$ prompt tokens prepended to the input, and domain identification handled via KNN over frozen features [2207.12819]. For continual text classification, a shared prompt $\mathbf{S}$ is maintained alongside private prompts, structured for mutual information maximization [2505.20933]. In multitask prompted learning, SPT formalizes “semi-parametric” S-Prompts as the fusion of a trainable discrete prompt encoder with a frozen memory bank, enabling input-conditioned retrieval [2212.10929]. For LLM-driven dialogues, SPT (Selective Prompting Tuning) maintains a prompt bank and learns selection/fusion through a dense retriever plus discriminative contrastive objectives [2406.18187].

## 2. Mathematical Formulation and Training Objectives

The generalized S-Promptic workflow entails constructing a parameter-efficient composite prompt $\tilde{P}$ for each input $X$, followed by prediction and optimization subject to modular loss terms.

**Prompt Construction:**
- For SPT in personalized dialogue [2406.18187]:
  $$
  \tilde{P}(C) = \operatorname{Fuse}(\{\mathbf{sp}_j: j \in \operatorname{TopK}(s(C, \mathbf{sp}_j))\}),
  $$
  where $s(C, \mathbf{sp}_j)$ is a context-specific selection score from a dual-encoder retriever.

**Joint Loss (Dialogue SPT) [2406.18187]:**
- Language modeling loss for each prompt,
- Selection alignment: KL between softmax of negative NLL and selection probabilities,
- Context-prompt contrastive loss to enforce diversity among selections,
- Fusion loss for learning prompt blending weights,
- Overall:
  $$
  \mathcal{L}_{\text{Total}} =
  \sum_{i=1}^K \mathcal{L}_i^{\text{LLM}} +
  \lambda_1 \sum_{i \neq j} \mathcal{L}_{\text{con}}(\mathbf{s}_{c_i}, \mathbf{s}_{c_j}) +
  \lambda_2 \mathcal{L}_{\text{selection}} +
  \lambda_3 \mathcal{L}_{\text{fusion}}
  $$

**Continual Classification (InfoComp S-Prompt) [2505.20933]:**
- Task sequence: at each task $k$, maintain task-specific ($P_k$) and shared ($S$) prompts.
- Information-theoretic objective: maximize mutual information between current and previous $S$-Prompt induced representations, using a SimSiam-style positive-only contrastive auxiliary loss:
  $$
  \mathcal{L}_{k}^{\text{s-info}} = - (W_q V_i^k)^T V_i^{k'}
  $$
  $$
  \mathcal{L}_k^{\text{overall}} = \mathcal{L}_k^{\text{CE}} + \lambda_1 \mathcal{L}_k^{\text{p-info}} + \lambda_2 \mathcal{L}_k^{\text{s-info}}
  $$
- This term regularizes the S-Prompt to retain knowledge across tasks, directly improving forward transfer and attenuating forgetting.

**Domain-Incremental Learning (S-Prompting) [2207.12819]:**
- Train prompt $P_s$ for each domain $s$ using standard domain-labeled cross-entropy loss. At inference, choose $P_{s^*}$ for query $x$ as the nearest domain centroid in frozen feature space.


## 3. Representative Algorithms and Inference Procedures

**Personalized Dialogue SPT [2406.18187]:**
- Maintain a prompt bank $\{\mathbf{sp}_i\}_{i=1}^{K}$.
- At each round: for incoming context $C$, compute retriever scores $s(C, \mathbf{sp}_j)$.
- Select top-$k$ prompts and fuse (convex or weighted sum of prompt embeddings).
- Prepend the (fused) embeddings to $C$, forward through the frozen LLM.
- Training alternates selection alignment, contrastive learning, and response likelihood optimization.

**Continual and Domain-Incremental Learning [2505.20933, 2207.12819]:**
- For each new task or domain:
  - Randomly initialize a new prompt $P_\text{task}$ or $P_\text{domain}$.
  - Optimize using within-task cross-entropy.
  - Update shared prompt $S$ with SimSiam-style auxiliary loss (if applicable).
  - For S-liPrompts (language-image modality): learn both image-side and text-side prompts.
  - At inference, identify task/domain via KNN over frozen representations, select corresponding prompt(s) and classifier head.

**Semi-Parametric Prompt Tuning (SPT) [2212.10929]:**
- Input is tokenized with a human-authored template; embeddings are pooled and projected to a query.
- Use the query to soft-retrieve from a frozen memory bank; aggregate to a memory prompt.
- Concatenate memory prompt, optional soft-prompt, and input embeddings, then feed to the frozen LLM.
- Only the discrete prompt encoder (and optional soft prompt) parameters are learnable.


## 4. Applications and Experimental Results

**Personalized LLM Dialogue [2406.18187]:**
- SPT on ConvAI2 yields +16–33% mean improvement over baseline PT on average metrics (F1, BLEU, Distinct-n, etc.).
- Dialogue diversity (Distinct-1/2) increases up to +90% relative gain.
- Ablations show the necessity of the multi-term objective for maintaining diversity and alignment.

**Continual Text Classification [2505.20933]:**
- In 5-task and 15-task settings, InfoComp S-Prompts yield up to +6.2% mean accuracy improvement over variants without shared prompts.
- S-Prompt and its MI surrogate loss directly improve forward transfer and forgetting resistance (full InfoComp: 69.2%; w/o S-Prompt: 63.0%).

**Domain Incremental Learning [2207.12819]:**
- S-liPrompts achieve state-of-the-art in exemplar-free DIL—30% relative gain over best prior methods, negligible forgetting (<1% on CDDB-Hard).
- Parameter overhead extremely low (0.03% per domain, enabling scalability).

**Multitask Prompted Learning [2212.10929]:**
- SPT shows +1.7% to +3.9% increase in average classification accuracy across multitask splits; outperforms discrete-only or soft-only approaches in most settings.

**Resource-aware pipeline control (SPL S-Prompts) [2602.21257]:**
- Declarative prompt constructs manage context budgets, allowing complex RAG/memory flows and plan explanations.
- Reduces prompt engineering boilerplate by 65%, offers robust cost-portability and hybrid model routing.

## 5. Interpretability and Limitations

Soft S-Prompts are inherently non-interpretable; nearest-token unembedding typically yields incoherent, non-linguistic representations, and attempts to regularize for interpretability (e.g., perplexity penalties in RLPrompt/PEZ) reveal a fundamental trade-off between scrutability and downstream accuracy [2504.02144]. For instance, promoting low perplexity in prompt tokens causes accuracy to degrade (SST-2 sentiment: 85%→70% as perplexity drops from ~100 to ~40).

Limitations common to S-Prompt variants include:
- Possible mis-selection or mis-identification of prompts in domain-incremental/class-incremental setups, especially if the domain identifier is imperfect [2207.12819].
- Dependence on accurate retrievers for selection/fusion in SPT-style architectures [2406.18187].
- Inheriting annotator bias or stasis from static templates/memory banks in semi-parametric S-Prompts [2212.10929].
- Lack of interpretability for domain-specific or task-specific soft-prompts, and reduced adaptation flexibility in the absence of prompt dynamism.

## 6. Extensions and Future Directions

- **Hierarchical Prompting**: Layering S-Prompts to capture sub-domain or attribute-level information [2210.04726].
- **Hybrid Retrieval + Prompting**: Integration of light retrievers or contrastive search over the prompt pool, reducing reliance on explicit domain identification.
- **Dynamic Prompt Expansion/Update**: Online augmentation and pruning of the prompt set as new domains or tasks arrive [2207.12819].
- **Structured Prompting for Resource Management**: Explicitly declaring and optimizing token budgets or context across multiple source pipelines in SPL [2602.21257].
- **Interpretability-Augmented Tuning**: Systematic exploration of alternative proxies (BLEU, MAUVE, human-in-the-loop) for guiding S-Prompts toward more transparent representations [2504.02144].

A plausible implication is that as S-Prompt architectures mature and model providers increasingly expose prompt slots or memory caches in their APIs, modular prompt tuning and selection will become the principal mechanism for scalable, privacy-preserving, and adaptive learning across domains, tasks, and user personalization regimes.

## 7. Summary Table of S-Prompt Paradigms

| Paper / Group           | S-Prompt Paradigm             | Domain                  | Main Mechanism                                    |
|------------------------|-------------------------------|-------------------------|---------------------------------------------------|
| [2406.18187]           | Selective Prompting Tuning    | Dialogue personalization| Dense retriever + fusion/selection of soft prompts|
| [2505.20933]           | Shared-Prompt (InfoComp)      | Continual classification| Info-theoretic MI objective; prompt regularization|
| [2207.12819]           | S-Prompting                   | Domain-incremental LE   | Independent, domain-specific soft prompts + KNN   |
| [2212.10929]           | Semi-parametric S-Prompts (SPT)| Multitask NLP           | Discrete prompt encoder + memory bank             |
| [2602.21257]           | Structured Prompt (SPL)       | Resource-aware pipelines| Declarative token & context budgeting             |

In conclusion, S-Prompts enforce modular, scalable, and dynamic control in prompt-driven adaptation. Their success across knowledge-intensive, continual, and personalized model scenarios demonstrates that the future of efficient and robust model adaptation is prompt-selective rather than monolithic or globally fine-tuned.

Source: https://www.emergentmind.com/topics/s-prompts