← Back to LLMs Mind Map
⚡ LLMsID: soft-prompts

Soft Prompts / Adapters

软提示 P-Tuning/Adapter
🎯Core Definition
Soft prompts and adapters are PEFT routes that freeze the backbone and train only a few extra parameters: 1) Prefix-Tuning prepends learnable key/value vectors before attention in every layer (~0.1%–2% of params); 2) P-Tuning (v2) prepends continuous prompt vectors to input embeddings (or each layer's input), reparameterized by MLP/LSTM for stability; 3) Adapter inserts a bottleneck after Transformer sub-layers: down-project d→rd \to r, up-project r→dr \to d, with nonlinearity and a residual connection. Together with LoRA (frozen WW, low-rank delta ΔW=BA\Delta W = BA; rank r=8 cuts parameters by ~100×) they form the four mainstream PEFT methods.
💡Use Cases
multi-task / multi-tenant serving (hot-swapping prompt/adapter sets on one base), memory-constrained fine-tuning, rapid experimentation.
⚡Key Problems Solved
full fine-tuning has prohibitive parameter and storage cost. The three routes trade efficiency against quality: Prefix/P-Tuning modify attention inputs, closer to prompt semantics but slightly less stable; Adapters use residuals to stay near-identity at init and approach full-FT quality; soft prompts use even fewer parameters than LoRA with a somewhat lower ceiling. Multiple extra-parameter sets coexist on one base — the server stores only ~0.1% more parameters per task/tenant, giving each its own adaptation.
🎯Core Interview Exam Points
Fundamentals · Production Scenarios · Deep Dive
Core Def
Explain the core definition, underlying mechanism/math, and key principles of Soft Prompts / Adapters.
Use Cases
In production engineering, what are the primary use cases for Soft Prompts / Adapters and what core pain points does it solve?
🔥 High-Frequency Deep-Dive Questions
1
Prefix-Tuning vs P-Tuning: what differs?
2
Why is the Adapter bottleneck effective (residual + nonlinearity)?
3
Soft prompts vs LoRA: comparison and how to choose?
4
Why freeze the backbone and train only extra params? Benefits & risks?
5
Multi-task serving: how do multiple prompts/adapters coexist?
Updated 2026-08-12
🎯
Verify Mastery: Practice Exam Questions for "Soft Prompts / Adapters"
Take pitfall multiple-choice questions with derivation options; mistakes are automatically logged.
🚀 Start Card Practice ➔
← Previous CardLoRA / QLoRA Low-Rank AdaptationNext Card →RLHF 3-Stage Pipeline

🔗 More LLMs Knowledge Cards

引用出处: TalentMe 450+ 工业级 AI 架构考点知识库 (Tech Vault) · 遵循 CC-BY-4.0 知识共享协议
URL: https://talentme.airsota.com/resources/tech/roadmap/mindmap/LLM/card/soft-prompts
中文速览与面试要点

软提示 P-Tuning/Adapter (Soft Prompts / Adapters)

定义: 软提示与适配器是冻结主干、只训练少量附加参数的 PEFT 路线: 1) Prefix-Tuning——在每层注意力前拼接可学习的 prefix 键值向量, 参数量约 0.1%-2%; 2) P-Tuning(v2)——在输入嵌入(或每层输入)前加可学习连续向量 prompt, 用 MLP/LSTM 重参数化提升训练稳定性; 3) Adapter——在 Transformer 子层(Attention/FFN 后)插入瓶颈结构: 先降维 d r 再升维 r d, 内部含非线性激活与残差连接。三者与 LoRA(冻结 W、训练低秩增量 W = BA, 秩 r=8 时参数降约两个数量级)并列为四大主流 PEFT 方法。 使用场景: 多任务多租户部署(一个底座热插拔多组 soft prompt/adapter)、显存受限的微调、快速迭代实验。 解决的问题: 全量微调参数与存储开销过大。三者在'参数效率'与'效果'间权衡: Prefix/P-Tuning 修改注意力输入, 更接近提示语义但训练稳定性略差;Adapter 以残差保证初始化近似恒等、效果最接近全量微调; soft prompt 参数量通常低于 LoRA(约 0.1% vs LoRA r=8 时约 0.1%)但性能上限略低,且多组附加参数可在同一底座共存——服务端只需额外存储千分之一量级的参数量, 即可为每个任务/租户提供独立适配。

核心要点

  • Prefix-Tuning 与 P-Tuning 的区别?
  • Adapter 的瓶颈结构为什么有效(残差 + 非线性)?
  • Soft Prompt 与 LoRA 的对比与选型?
  • 为什么冻结主干只训附加参数? 收益与风险?
  • 多任务部署: 多组 soft prompt/adapter 如何共存?