In artificial intelligence, a prompt is the input, usually text but sometimes an image, audio clip or other data, that a user or program gives a generative model to tell it what to produce. The model takes the prompt and generates a continuation or response. A prompt can be as short as a single question or as long as a book-length document together with detailed instructions. The prompt is the main interface to large language models, image generators and many other systems, and the practice of improving it is called prompt engineering.
Origin of the term
The word prompt comes from theater and computing, where it refers to a cue that starts an action. In language modeling, early systems generated text that continued a given beginning, and that beginning was called the prompt. As models became capable of following instructions, the prompt turned from a text to be continued into a request to be answered, and it now often includes instructions, background and examples.
Parts of a prompt
A prompt may contain one or more of the following elements.
- Task instruction: what the model should do, such as summarize, translate or classify.
- Context: supporting information, documents or conversation history.
- Examples: sample inputs and outputs that show the desired pattern.
- Input data: the item to process, such as an email or a spreadsheet.
- Format and style cues: length, tone, structure and audience.
In deployed products, the complete input the model sees is built from several layers. A developer’s system prompt sets the rules, retrieved documents add facts, the conversation history keeps continuity and the person’s user prompt states the current request.
How a model processes a prompt
The text is split into tokens, which are small pieces of words, and each token is converted into a numeric representation. A transformer uses its attention mechanism to relate every token to the others and then predicts the next token, one at a time, until the response is complete. The prompt therefore conditions every part of the output. Models are limited by a context window, the maximum number of tokens that can be handled at once, and long prompts cost more to process.
Kinds of prompts
- Direct instruction: a plain request, as in zero-shot prompting.
- Example-based: a request with sample pairs, as in few-shot prompting.
- Reasoning prompts: requests for steps, see chain-of-thought prompting.
- Role prompts: the model is asked to take a role, see role-based prompting.
- Multimodal prompts: a combination of text, images, audio or video.
- Negative prompts: descriptions of what to avoid, mostly in image generation.
- Soft prompts: learned numeric vectors rather than words, used in some tuning methods.
Prompts in other fields
In image generation, a prompt describes the scene, style and mood. In music and video generation, it may define genre, tempo, length or camera movement. In coding assistants, the prompt includes the code being edited and the developer’s request. In AI agents, prompts instruct the model how to use tools and when to stop.
Quality of a prompt
A good prompt is clear, specific, complete and testable. It states the goal, gives needed context and limits ambiguity. Quality is judged by whether outputs meet the need consistently across many inputs, not by one lucky result.
Risks
- Injection: hidden instructions in a document or web page may redirect the model, see prompt injection.
- Leakage: prompts may reveal confidential instructions or data if the model is tricked into repeating them.
- Privacy: personal or sensitive information placed in prompts may be stored or logged.
- Bias: wording can nudge outputs toward stereotypes.
A worked example
A nurse administrator wants a notice for patients about a clinic closure. The prompt reads: write a polite, plain-language notice of about 100 words telling patients that the clinic will be closed on Friday for maintenance, that appointments will be moved to Monday and that they can call the front desk with questions. Here the prompt contains a task, a tone, a length, the key facts and a content requirement. The output can be checked easily against each element, and the administrator edits only a few words before sending it.
Context windows and prompt length
Every model has a limit on the number of tokens it can read and write in one exchange. Early systems handled a few thousand tokens, while recent ones accept hundreds of thousands or more. A longer window lets a prompt include whole documents, long conversation histories and many examples, but cost and delay rise with length, and models can pay less attention to material buried in the middle of a very long input. Designers therefore place the most important instructions clearly, trim irrelevant text and sometimes summarize earlier turns.
Prompts and model training
Models learn to follow prompts through instruction tuning and reinforcement learning from human feedback, in which people rank responses and the model is adjusted to prefer the better ones. This explains why a modern assistant responds to a plain request, while an earlier base model would simply continue the text. Developers also train models to respect the order of authority among prompts, so that a system instruction normally outweighs a conflicting request in a user message.
Prompts as interfaces
Because a prompt is written in natural language, it lowers the barrier to using advanced software: people can describe what they want instead of learning a programming language. At the same time, the looseness of natural language means that results are less predictable than traditional code, and teams add structure through templates, schemas and tests to make behavior dependable.
Prompt history and culture
Public collections of prompts, shared on forums and marketplaces, have become a part of online culture, and users trade tips on phrasing for chat assistants and image tools. Competitions test who can elicit the best result under constraints, and researchers study how small changes in wording affect output. This shared experimentation helped establish the practices now described under prompt engineering.
FAQs
Is a prompt always text? No. Prompts can include images, audio, video or files, depending on the model.
What is the difference between a prompt and a query? A query asks a database or search engine for stored items, while a prompt conditions a model that generates new content.
How long can a prompt be? It is limited by the model’s context window, which ranges from a few thousand tokens to over a million in some systems.
More in Prompt Engineering
Key facts
- The 2020 GPT-3 paper by Brown and colleagues showed that a language model can adapt to new tasks from a prompt that contains instructions and a few examples.1
- The amount of text a model can consider at once, including the prompt and its reply, is limited by its context window, measured in tokens.2
- Conversational assistants combine a hidden system prompt written by the developer with visible user prompts written by the person.3
Related concepts
Quick checkWhat is a prompt in AI?Show answer
It is the input given to a generative AI model, such as a question, instruction, example or document, that the model uses to decide what to generate.
Sources
- Brown et al., Language Models are Few-Shot Learners, https://arxiv.org/abs/2005.14165
- Vaswani et al., Attention Is All You Need, https://arxiv.org/abs/1706.03762
- Ouyang et al., Training language models to follow instructions with human feedback, https://arxiv.org/abs/2203.02155
Editorially reviewed by Specialty Digest Editorial TeamLast reviewed November 17, 2026Researched and drafted with AI assistanceReport an issue
