ModelRefs / Prompt Template — AI Glossary
Prompt Template — AI Glossary
A reusable string template with variables that generates complete prompts for specific tasks by substituting runtime values. A prompt template is not a prompt.
Overview
Prompt templates separate prompt logic from data, enabling systematic testing and version control. LangChain, LlamaIndex, and DSPy all provide template abstractions. Templates typically define system instructions, few-shot examples, and placeholders for user input, retrieved context, and tool output. Stored in code or config files for reproducibility.
Reference details
| Topic | prompting |
|---|---|
| Also known as | prompt scaffold, prompt recipe |
| Last reviewed | 2026-06-24 |
Related terms
Example: A template is a version, whether or not you version it
Change one word of a system prompt and two things happen that are easy to miss. Every evaluation result you have recorded now refers to a prompt that no longer exists, so a regression cannot be attributed to the model or the prompt. And every cached prefix is invalidated — prompt caching matches on an exact prefix, so a single character forces full recomputation of the whole shared block. Both are arguments for the same discipline: templates live in version control with an identifier, and the identifier is recorded alongside every eval run and every trace.
Commonly confused with
A prompt template is not a prompt. The template is the versioned artifact with slots; the prompt is what a specific set of values renders to. Debugging almost always needs the rendered prompt — the exact string the model received — which is why traces should store the render, not just the template name.
When to use it
Reach for it when:
- Any prompt used more than once, so the wording is a reviewable artifact rather than a literal
- Where retrieved context or tool output is interpolated and injection risk needs a defined boundary
- A/B testing prompt variants, which requires both to be addressable
Reach for something else when:
- One-off exploration, where the abstraction slows the loop down
- Hiding the rendered prompt from traces — the template alone is not enough to reproduce a failure
- As a substitute for escaping: interpolated user text is still untrusted input
Continue your research
Use these connected ModelRefs sections to compare alternatives, inspect implementation paths, and review the evidence and governance boundaries relevant to Prompt Template — AI Glossary.
Frequently asked questions
What is Prompt Template?
A reusable string template with variables that generates complete prompts for specific tasks by substituting runtime values.
Is Prompt Template the same as prompt scaffold?
Yes — prompt scaffold, prompt recipe are common aliases for Prompt Template.
What concepts are related to Prompt Template?
Closely related concepts include few shot, system message, dspy.