Create and explore imaginative 3D worlds with our new product Dreamfield (opens in a new tab)
Papers
Topics
Authors
Recent
Search
2000 character limit reached

Composable Soft-Prompt Distillation: CSPD

Updated 24 November 2026
  • Composable Soft-Prompt Distillation (CSPD) is a parameter-efficient post-training framework in which task- or domain-specific behavior is distilled from expert models into independently learned continuous prompts that can be combined without modifying the underlying backbone.
  • The framework uses concatenation as the primary composition operator for prompts to leverage their behavior during inference, making prompt removal and sequential composition possible.
  • Empirical evaluations show a capacity-stability tradeoff in prompt length and demonstrate the incremental addition and removability of expert capabilities, with high recovery rates even on held-out generalization tasks.

Composable Soft-Prompt Distillation (CSPD) is a parameter-efficient post-training framework in which task- or domain-specific behavior is distilled from expert models into independently learned continuous prompts that can be combined without modifying the underlying backbone. In its principal formulation, the backbone remains frozen, an expert is represented by a soft prompt Pj∈RL×dP_j\in\mathbb{R}^{L\times d}, and multiple prompts are composed by concatenation before inference. CSPD was introduced for continual consolidation of reinforcement-learning (RL) experts, with the objective of adding capabilities incrementally while preserving previously acquired and general capabilities (Zhang et al., 20 Nov 2026).

1. Conceptual foundations and objectives

CSPD addresses the consolidation problem created by domain-specific post-training. RL is commonly performed separately for domains such as mathematics, code generation, science, instruction following, software engineering, and agent interaction because each domain may require distinct data, verifiers, environments, and reward functions. The resulting experts must be consolidated into a single deployable system, and this consolidation becomes continual when new experts arrive after earlier ones have already been integrated.

Weight-space approaches represent an expert through modified backbone parameters. If θ0\theta_0 is the shared pre-RL model and θj\theta_j is an expert, task arithmetic can be expressed as

θTA=θ0+λ∑j=1k(θj−θ0).\theta_{\mathrm{TA}}=\theta_0+\lambda\sum_{j=1}^{k}(\theta_j-\theta_0).

When a new expert is added, the merged model must be recomputed. Sequential RL or supervised fine-tuning can overwrite earlier capabilities, while joint multi-domain training requires revisiting the existing domain set whenever the set of experts changes. TIES and related merging procedures reduce some parameter interference but still write the expert mixture into one shared parameterization.

Multi-teacher on-policy distillation (MOPD) avoids direct weight arithmetic but also requires reconsolidation: adding an expert entails retraining the student using both existing and new teachers. The student weights are repeatedly modified to represent the accumulated mixture, potentially affecting capabilities outside the target domains. CSPD instead treats each expert as an input-space conditioning module and retains the backbone unchanged (Zhang et al., 20 Nov 2026).

The framework pursues several objectives:

  1. Incremental extensibility: a new expert should require training only a new prompt rather than reconsolidating previous experts.
  2. Capability preservation: previously distilled capabilities and the original backbone behavior should remain available.
  3. Removability: an expert should be removable by deleting its prompt.
  4. Per-request composition: different prompt subsets should be usable with the same backbone.
  5. Serving efficiency: adaptation should occur at the input and KV-cache level rather than through per-layer adapter operations during every decoding step.

A central distinction is between capability acquisition and capability combination. Expert behavior is acquired through independent prompt distillation, whereas combination is performed at inference by assembling prompt sequences.

2. Soft-prompt distillation of experts

Let pθ0p_{\theta_0} denote the frozen pre-RL backbone and pθjp_{\theta_j} an RL expert. For an expert-domain question set Xj\mathcal{X}_j, CSPD learns a continuous prompt

Pj∈RL×d,P_j\in\mathbb{R}^{L\times d},

where LL is the number of virtual tokens and dd is the backbone embedding dimension. In the main experiments, L=256L=256. The prompt is inserted into the system-message portion of the chat template before the user question. It is not a sequence of ordinary words and is not intended to be interpreted as natural-language text.

If I(Pj,x)\mathcal{I}(P_j,x) denotes the chat input containing prompt PjP_j and question xx, the prompted backbone computes

pθ0(y∣I(Pj,x)).p_{\theta_0}(y\mid\mathcal{I}(P_j,x)).

Only PjP_j is optimized; the backbone parameters θ0\theta_0 remain frozen.

For each RL expert, responses are sampled on questions from the corresponding domain. Responses are filtered using the domain verifier, producing a dataset

Dj={(x,y)}.\mathcal{D}_j=\{(x,y)\}.

The prompt is trained with length-normalized sequence-level negative log-likelihood:

Pj⋆=arg⁡min⁡Pj  E(x,y)∼Dj[−1∣y∣∑t=1∣y∣log⁡pθ0(yt∣I(Pj,x),y<t)].P_j^\star= \underset{P_j}{\arg\min}\; \mathbb{E}_{(x,y)\sim\mathcal{D}_j} \left[ -\frac{1}{|y|} \sum_{t=1}^{|y|} \log p_{\theta_0} \left(y_t\mid\mathcal{I}(P_j,x),y_{<t}\right) \right].

This objective transfers the expert’s behavior through responses rather than through copied weights. Each prompt is trained independently using the data and teacher associated with its domain.

The main four-expert experiment used a Qwen3-4B-Base model followed by supervised fine-tuning, referred to as M2RL-SFT, as the frozen backbone. Four RL experts represented mathematics, code, science, and instruction following. Prompt training used 200 optimization updates, a global batch size of 64, Muon optimization with momentum $0.95$, Nesterov momentum, five Newton–Schulz iterations for gradient orthogonalization, gradient RMS rescaling, gradient clipping at norm $1.0$, and a cosine learning-rate schedule from $0.03$ to $0.003$. Prompt vectors were initialized from vocabulary embeddings with seed 42 and maintained in FP32, while the frozen backbone remained in BF16.

Prefix-robust training

A prompt trained only at the beginning of a system message can become sensitive to the context preceding it when multiple prompts are concatenated. CSPD therefore uses prefix-robust training: half of the training examples place a random 128–256-token prefix before the prompt. The prefix is drawn from other questions in the same domain, uses frozen token embeddings, and is excluded from the loss.

Prefix robustness improved four-domain composition. With AdamW, composition rose from an average of $64.50$ without prefix robustness to $66.60$ with it. With Muon, the final results reached $67.72$ or $67.83$, depending on concatenation order. The mechanism is intended to expose each prompt to non-initial positions and varied preceding contexts before deployment.

3. Prompt composition and continual addition

The primary CSPD composition operator is concatenation. For kk independently trained prompts,

P1:k=[P1⋆;…;Pk⋆]∈RkL×d,P_{1:k}=[P_1^\star;\ldots;P_k^\star] \in\mathbb{R}^{kL\times d},

and the prompted model is

p(y∣x)=pθ0(y∣I(P1:k,x)).p(y\mid x)=p_{\theta_0}\bigl(y\mid\mathcal{I}(P_{1:k},x)\bigr).

There is no joint prompt training, merge coefficient, or router. Adding an expert requires training its prompt and inserting it into the prompt library. Removing an expert requires dropping its prompt. The backbone and previously trained prompts remain unchanged.

In the continual experiment, experts arrived in the order instruction following (II), science (SS), code (CC), and mathematics (MM). New prompts were prepended, producing the sequence

Student→I→SI→CSI→MCSI.\mathrm{Student}\rightarrow I\rightarrow SI\rightarrow CSI\rightarrow MCSI.

The prompt closest to the user question is therefore the most recently inserted one. Appending rather than prepending produced a similar final score, indicating moderate order robustness, although the behavior was not order-invariant.

CSPD’s composability is operational rather than algebraic. The system composes independently trained prompt modules by placing them in a common input representation. It does not currently define prompt addition, interpolation, gating, attention-based fusion, learned routing, or simultaneous execution of multiple independently selected prompt paths. It also does not establish that a combination of prompts yields a novel capability absent from the individual experts.

The continual experiment nevertheless demonstrates incremental accumulation. The overall average rose from

50.41→60.99→61.67→63.67→67.8350.41\rightarrow60.99\rightarrow61.67\rightarrow63.67\rightarrow67.83

as instruction following, science, code, and mathematics prompts were added. This supports the claim that capabilities can be added without retraining the backbone or previously learned prompts.

Prompt interactions are not uniformly positive. Adding code temporarily reduced instruction-following performance from $66.71$ to $64.58$, while adding mathematics subsequently increased it to $68.42$. Removing instruction following reduced instruction-following performance by $12.88$ points. Removing mathematics caused the largest average decline, $4.16$ points, including a $6.54$-point reduction on GPQA-Diamond, although it improved LiveCodeBench by $1.87$ points. These results show that concatenation enables transfer but does not eliminate interference.

Independent prompt training outperformed progressive prompt training, in which each new prompt was trained in the context of earlier frozen prompts. After science, code, and mathematics were added, independent training produced averages of $61.67$, $63.67$, and $67.83$, compared with $56.44$, $58.28$, and $65.17$ for progressive training. This suggests that exposure to varied preceding contexts is more useful than optimizing each prompt for one fixed prior composition.

4. Empirical performance

Single-expert recovery

CSPD evaluates recovery relative to the RL expert’s improvement over the pre-RL student. If ASA_S, ATA_T, and AS+PA_{S+P} are respectively the student, teacher, and prompted-student scores, recovery is

R=AS+P−ASAT−AS×100%.R= \frac{A_{S+P}-A_S}{A_T-A_S}\times100\%.

A value of 100%100\% indicates recovery of the teacher’s entire gain over the pre-RL model.

Across 23 public pre-RL/post-RL pairs covering mathematical reasoning, LiveCodeBench code generation, SWE-bench Verified, Terminal-Bench 2.1, dense and mixture-of-experts models, model sizes from 7B to 35B parameters, multiple model families, and multiple RL recipes, a single prompt recovered at least 90%90\% of the teacher’s gain in 22 of 23 settings. The prompted student matched or exceeded the teacher in 15 of 23 settings. The lowest recovery was 88.08%88.08\% for MiMo-7B on code.

Examples include DeepSWE on SWE-bench Verified, where the student scored 24.90%24.90\%, the teacher 44.05%44.05\%, and the prompted student 45.65%45.65\%, corresponding to 108.36%108.36\% recovery. GPT-OSS-Swallow mathematics achieved 96.06%96.06\% recovery, and Nemotron mathematics achieved 99.18%99.18\%. Some agent settings also produced prompted students exceeding their teachers.

Prompt length exhibits a capacity–stability tradeoff. In one GPT-OSS mathematics sweep, recovery was 51.23%51.23\% with two vectors, 74.11%74.11\% with eight, 90.01%90.01\% with 32, 93.10%93.10\% with 256, and 87.83%87.83\% with 512. Thus, 256 vectors functioned as a practical default rather than a demonstrated minimum.

Verifier filtering improved performance but was not essential. Correct-only responses yielded 96.06%96.06\% recovery in one GPT-OSS experiment, while a mixed set containing only 69%69\% correct responses still yielded $90.54\%.

Four-expert composition

The four-domain evaluation used AIME24 for mathematics, LiveCodeBench v5 for code, GPQA-Diamond for science, and IFBench for instruction following. The unprompted student scored $55.94$, $58.61$, $44.38$, and $42.71$, with an average of $50.41$. The oracle individual experts averaged $66.61$.

The main CSPD composition, MCSI, scored:

  • AIME24: $80.47$;
  • LiveCodeBench: $64.67$;
  • GPQA-Diamond: $57.77$;
  • IFBench: $68.42$;
  • average: $67.83$.

The reverse order, ISCM, scored $67.72$. CSPD therefore essentially matched MOPD, which scored $67.79, while avoiding joint retraining of the accumulated capability set.

Method Average
Student 50.41
Individual experts, oracle routing 66.61
LoRA distillation + task arithmetic 65.50
LoRA distillation + TIES 66.19
Full-model task arithmetic 67.27
Full-model TIES 67.47
MOPD 67.79
CSPD, ISCM 67.72
CSPD, MCSI 67.83

The domain-level results are asymmetric. CSPD exceeded MOPD on GPQA-Diamond and IFBench, whereas MOPD was stronger on AIME24 and LiveCodeBench. Consequently, aggregate parity does not imply uniform per-domain superiority.

Held-out generalization

The full MCSI composition was evaluated on XSTest, TruthfulQA, BFCL, TriviaQA, BBEH, and FinQA. The held-out mean scores were:

Method Held-out mean
Student 50.3
TIES 54.1
LoRA + task arithmetic 53.8
MOPD 53.5
CSPD 56.6

CSPD led on four of six benchmarks and improved over the student on five. It scored $55.6$ on BFCL, compared with $49.4$ for MOPD. On TruthfulQA it scored $64.2$, close to the original student’s $64.6$, whereas MOPD scored $61.0$.

These results are consistent with the interpretation that input-space adaptation can preserve more of the frozen backbone’s general behavior than weight-space reconsolidation. They do not establish that freezing guarantees general-capability or safety preservation; the safety evaluation was limited.

5. Mechanisms, serving, and comparison with alternative methods

Behavioral mechanism

A soft prompt is not necessarily a compressed natural-language instruction. For a GPT-OSS mathematics prompt, the prompted student reduced the teacher–student next-token KL divergence from $0.225$ to $0.030$, closing 86.8%86.8\% of the gap. The prompted model became more likely to generate tokens such as “But,” “Check,” and “?” and less likely to immediately use “Thus” or paragraph breaks. The analysis associates these changes with intermediate-result checking.

Written instructions with the same semantic intent closed at most 2.1%2.1\% of the gap, whereas the learned soft prompt closed 86.8%86.8\%. Attention masking indicated that 80%80\% of the improvement remained when only response tokens could attend to the prompt, compared with 33%33\% when only input tokens could attend to it. These findings suggest that the prompt directly modifies response-generation behavior, although the analysis was based mainly on one prompt.

Serving characteristics

CSPD prompts are processed at the input and prefill stages. During decoding, generated tokens attend to the prompt’s cached keys and values, but the prompt does not introduce a LoRA-style matrix multiplication in every layer for every generated token.

The additional KV-cache memory is approximately

MKV≃2LKhKVdhb,M_{\mathrm{KV}} \simeq 2LK h_{\mathrm{KV}}d_h b,

where LL is the number of layers, KK the number of prompt vectors, hKVh_{\mathrm{KV}} the number of KV heads, dhd_h the head dimension, and bb the bytes per value.

In a GPT-OSS-20B serving experiment on one NVIDIA B200 using BF16 and SGLang, a 256-vector prompt increased a 20,480-token input by only 1.25%1.25\%. At concurrency 32, output throughput was:

  • unadapted backbone: $721.3$ tokens/s;
  • soft prompt: $715.4$ tokens/s;
  • rank-4 LoRA: $298.5$ tokens/s.

The soft prompt therefore reached approximately

715.4298.5≈2.40\frac{715.4}{298.5}\approx2.40

times the throughput of rank-4 LoRA. P95 time to first token was $17.26$ seconds for the soft prompt, $39.21$ seconds for LoRA, and $16.89$ seconds for the unadapted backbone. The soft prompt remained within 1.5%1.5\% of the unadapted backbone across the tested concurrency levels.

The cost is not zero: each additional prompt consumes context positions and KV-cache memory. The advantage is greatest when decoding dominates and prompts remain reasonably short. Speculative decoding remained compatible, although average acceptance length decreased by 2.6%2.6\% for EAGLE-3 and 4.7%4.7\% for DFlash.

Comparison with weight merging

CSPD avoids recomputing merge coefficients, rewriting the backbone, and retraining previously integrated experts when a new expert arrives. It also permits exact removal of an expert and per-request selection of prompt combinations. Weight merging may remain preferable when a single fixed checkpoint is mandatory, context length is severely constrained, or input-space conditioning is insufficient.

Comparison with LoRA

LoRA can modify internal representations throughout the network and has a mature deployment ecosystem. CSPD is more suitable when capabilities can be expressed through input conditioning, many distinct adapters must be served concurrently, the backbone must remain unchanged, or per-request composition is required. In the controlled four-domain experiment, CSPD scored $67.83$, compared with $65.50$ for LoRA distillation with task arithmetic and $66.19$ for LoRA distillation with TIES.

Comparison with MOPD

MOPD can consolidate experts into a single model and may be stronger on individual domains. In the four-domain experiment, MOPD scored $67.79$, essentially matching CSPD’s $67.83$. CSPD differs operationally by training each expert prompt independently, adding new prompts without revisiting earlier prompts, preserving removability, and retaining the backbone unchanged. Its held-out mean was $56.6$, compared with $53.5$ for MOPD.

Earlier prompt-distillation methods establish components that are relevant to CSPD but do not implement its full prompt-composition setting. KD-SPD maps multilingual documents into an English teacher’s embedding space through language-conditioned factorized prompts and embedding-level MSE distillation (Huang et al., 2023). PromptMM uses a task-adaptive multimodal teacher and distills collaborative and modality-specific knowledge into a lightweight graph student, but does not demonstrate reusable prompt modules (Wei et al., 2024). PromptKD transfers a large CLIP teacher’s soft predictions to a lightweight student through learnable visual prompts and shared class vectors (Li et al., 2024). KDP transfers teacher-derived prompt representations into a smaller frozen ViT during continual learning (Zhang et al., 2024). MAPD uses attention-mapped visual prompt slots and meta-learning for few-shot adaptation in visual question answering (Gupta et al., 7 Jun 2025). POST transfers private prompts from a distilled local model to a hosted larger model using public calibration data and optional differential privacy (Wang et al., 19 Jun 2025). MPT learns a shared clinical meta-prompt with low-rank task modulation across five task types (Peng et al., 8 Apr 2026). PromptSD routes multiple independently prompted teachers into one student during on-policy distillation but does not compose prompts at deployment (Ma et al., 30 Jun 2026).

These works collectively motivate soft prompts as representation, adaptation, privacy, or distillation interfaces. CSPD differs by making independent prompt concatenation and continual expert addition its central operation.

6. Limitations, open problems, and scope

CSPD’s empirical evidence is substantial but bounded.

  1. Limited composition scale: the principal composition study uses one backbone, four domains, and one training seed. It is unknown whether concatenation continues to improve as the prompt library becomes large.
  2. Residual interference: prompts can help one another but can also harm particular domains. The mathematics prompt improved science while code sometimes interfered with instruction following.
  3. Order sensitivity: concatenation is not mathematically commutative in the transformer’s computation. MCSI and ISCM were close, but order-dependent behavior remained.
  4. Growing context cost: each additional prompt consumes input positions and KV-cache memory.
  5. Backbone dependence: prompts are tied to the backbone and require redistillation when the model changes.
  6. Teacher dependence: CSPD requires teacher responses or equivalent supervision. Some single-expert experiments used proxy data because the original RL data were unavailable.
  7. No explicit prompt algebra: the method does not define addition, interpolation, gating, attention-based fusion, learned routing, or composition guarantees.
  8. No demonstrated novel-task composition: the experiments combine experts corresponding to existing domains. They do not establish that combining prompts produces a capability absent from all constituent experts.
  9. Limited model and task coverage: evaluation focuses on Qwen3-1.7B-Base and Phi-4-mini-instruct, with four main domains. Multilingual, multimodal, broad open-ended generation, and larger-scale agentic settings remain untested.
  10. Safety limitations: freezing the backbone does not guarantee that prompts or prompt combinations preserve safety. XSTest provides only a limited safety evaluation.
  11. Evaluation and reproducibility caveats: some checkpoints and task-arithmetic coefficients were selected using evaluation benchmarks, single-expert experiments used one seed, and the main text and appendix differ on some hardware and evaluation-size descriptions.
  12. Recovery-ratio instability: recovery percentages can be unstable when the teacher–student performance gap is small, so absolute scores are also necessary.

Future CSPD systems could introduce learned prompt selection, compatibility prediction, interference regularization, order-invariant composition, prompt sparsity, and hierarchical libraries of domain-, task-, and capability-specific modules. They could also evaluate novel combinations, prompt deletion, continual addition at larger scale, and the total training cost relative to MOPD, LoRA, weight merging, and renewed RL.

CSPD’s defining contribution is the separation of expert distillation from expert combination. Independently trained continuous prompts encode expert behavior while leaving the backbone fixed; concatenation then makes capability integration an inference-time operation. The reported recovery rates, continual improvements, parity with MOPD, held-out generalization, and serving efficiency support CSPD as a method for modular and continual post-training, while its remaining challenges concern scale, interference, order dependence, and genuinely compositional generalization (Zhang et al., 20 Nov 2026).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Composable Soft-Prompt Distillation (CSPD).