A hard prompt is a prompt composed of discrete tokens from the model vocabulary, usually readable natural language, that conditions a frozen language model to perform a task. In Prompting research the term is used in contrast to the soft prompt, a sequence of learned continuous vectors that has no direct textual form. The synonym discrete prompt expresses the same idea: every position in the prompt is one of a finite set of tokens.
Almost every prompt typed into a chat interface is a hard prompt. The distinction becomes important in Artificial intelligence practice when teams decide whether to write and search for better wording or to train prompt parameters with gradient descent, because the two paths differ in cost, portability and interpretability.
How a hard prompt conditions a model
A hard prompt works by shifting the conditional distribution of the model output through ordinary input tokens. The tokenizer converts the text into token IDs, the embedding layer looks up their fixed vectors, and the model processes them exactly as it would process any other input. No parameter changes, so the same prompt can be reused across sessions, users and deployments.
Because tokens are discrete, the space of possible hard prompts is combinatorial and non-differentiable. A vocabulary of 50,000 tokens and a prompt of 20 positions yields more candidate prompts than could ever be enumerated, and gradients cannot flow directly through the choice of a token. This property explains both the appeal and the difficulty of hard prompts.
Common forms of hard prompts are listed below, each with its typical role in a task.
| Form | Example pattern | Typical use |
|---|---|---|
| Instruction | Summarize the text in three sentences. | Instruction-tuned chat models |
| Cloze template | The movie was [MASK]. | Masked language models with a verbalizer |
| Few-shot demonstrations | Input and output pairs before the query | In-context learning |
| Prompt template | Fixed text with variable slots | Production pipelines |
| Optimized token string | Unreadable token sequence found by search | Benchmark tuning or adversarial testing |
Hard prompts compared with soft prompts
The essential difference is where the prompt lives: a hard prompt lives in the token space, while a soft prompt lives in the embedding space as trainable vectors. Methods such as prompt tuning and prefix tuning prepend tens of learned vectors to the input and optimize them on labeled data, which often matches fine-tuning accuracy on large models with a tiny fraction of trainable parameters.
| Property | Hard prompt | Soft prompt |
|---|---|---|
| Representation | Vocabulary tokens | Continuous vectors |
| Human readability | Usually readable | Not readable |
| Optimization | Manual editing or discrete search | Gradient descent |
| Model access needed | Text input only | Embedding layer and gradients |
| Transfer between models | Often works with adjustments | Tied to one model |
| Training data needed | None to a few examples | Hundreds to thousands of examples |
In short, hard prompts win on portability and transparency, and soft prompts win on task-specific accuracy when gradients and labeled data are available. Closed API models usually leave hard prompts as the only option.
Searching for better hard prompts
Discrete prompt optimization treats the wording itself as the object to improve. Because gradients do not apply directly, methods rely on search, sampling or approximation. Results can be surprising: an optimized prompt may contain odd word combinations that outperform carefully written instructions.
| Technique | Mechanism | Output readability |
|---|---|---|
| Manual iteration | Human edits wording after reviewing outputs | High |
| Gradient-guided token search | Gradients rank candidate token swaps, as in AutoPrompt | Low |
| Projected soft prompts | Soft vectors mapped to nearest tokens | Low to medium |
| Edit-based search | Phrase deletions, swaps and paraphrases scored on a dev set | Medium |
| LLM-proposed prompts | A model generates and ranks candidates, as in APE and OPRO | High |
| Reinforcement learning | A policy network emits tokens rewarded by task score | Low |
Every method needs a reliable evaluation set. Without one, an optimizer simply overfits the prompt to a handful of examples, and the gain disappears on real traffic.
When to rely on hard prompts
Hard prompts are the default choice whenever a model is accessed through an API, when outputs must be audited, or when the same instruction must serve several models. Soft prompts or fine-tuning become worth the effort only when a stable, high-volume task justifies the training cost and model access is available.
| Situation | Recommended approach | Reason |
|---|---|---|
| Closed API model | Hard prompt | No gradient or embedding access |
| Regulated domain with audits | Hard prompt | Wording can be reviewed and versioned |
| Open model, narrow task, labeled data | Soft prompt or adapter | Higher accuracy per parameter |
| Frequent model upgrades | Hard prompt with evaluation suite | Text transfers to new versions |
Limitations and common misconceptions
The biggest practical weakness of hard prompts is prompt sensitivity. Small changes in wording, punctuation, example order or formatting can change accuracy by several points, and the best wording for one model is not guaranteed to be the best for another.
- Readable does not mean understood: a fluent prompt can still be interpreted differently than its author intended.
- Optimized strings may be fragile: token sequences found by search often break after a model update.
- Hard prompts consume context: long instructions and many demonstrations raise latency and cost on every call.
- Name confusion: some leaderboards use “hard prompts” for difficult evaluation questions, which is an unrelated meaning.
Stripped to the essentials
A hard prompt is simply a prompt written with real words. You type an instruction, and the model reads it like any other text. Nothing inside the model changes.
The other option is a soft prompt. That is a set of hidden numbers that a computer learns, and people cannot read it. A useful comparison is a note versus a dial. A hard prompt is a note you can read and edit. A soft prompt is a dial tuned by machine. Notes are easier to share and check. Dials can be more precise for one job.
Where it is applied
A health insurance company uses a hosted language model to sort about 15,000 incoming claim emails per day into twelve categories. The model is available only through an API, so soft prompts are not an option. The team writes a hard prompt template with a short role statement, category definitions, five labeled demonstrations and a strict output format.
Using a test set of 1,200 hand-labeled emails, the team compares eight wording variants, including several proposed by another model. The best variant raises accuracy by about six percentage points over the first draft, mainly by clarifying two overlapping categories. Because the prompt is plain text, compliance staff review and approve it like a policy document, and it is stored in version control. When the vendor releases a new model version, the team reruns the same test set before switching, which catches a small regression and leads to one wording fix.