AI Model Wiki

    Skip to main content
    Back to Glossary

    Soft Prompting

    Soft prompting is a parameter-efficient adaptation technique in which a small set of trainable continuous vectors—often called "soft tokens" or a "prompt prefix"—is prepended to the input Embedding layer of a frozen language model. Unlike hard prompts, which are human-readable text strings, soft tokens have no direct linguistic meaning; they are learned end-to-end by gradient descent on a downstream task while all of the original model weights remain fixed. The result is a lightweight, task-specific adapter that costs a tiny fraction of a full Fine-tuning run.

    Think of it like hiring a specialist who hands a doctor a single laminated card before each consultation. The card silently primes the doctor to ask the right questions for a particular specialty—cardiology one morning, oncology the afternoon—without retraining the doctor themselves.

    A minimal implementation adds perhaps 20–100 soft tokens (each matching the model's hidden dimension) as learnable parameters. In PyTorch you define soft_embedding = nn.Parameter(torch.randn(n_tokens, hidden_size)), concatenate it with the real token embeddings at each forward pass, and only call optimizer.step() on that parameter group, leaving the rest of the LLM frozen.

    Soft prompting complements LoRA and other Hyperparameter-light adaptation strategies; it sits conceptually between rigid Prompt Engineering and full fine-tuning, sharing the Latent Space representation of the base Foundation Model. You will encounter it most often in academic papers benchmarking efficient adaptation methods and in enterprise deployments where the same large base model must serve dozens of distinct tasks without duplicating weights.

    AI Terminology
    Glossary