Completion: Definition and Examples
Response generated by a language model (LLM) from a given prompt. Completion is the text produced by the AI to complete, answer, or extend the user's input.
Full definition
In artificial intelligence, a completion refers to the text generated by a language model in response to an input (prompt). The term comes from the fundamental operation of LLMs: they are trained to predict the next token in a sequence, thereby "completing" the text provided to them. Each word or fragment produced results from a probabilistic estimate of what should logically follow.
Historically, early models like GPT-2 and GPT-3 operated exclusively in completion mode: they were given a text beginning and extended it. OpenAI's API even had a dedicated endpoint called "Completions." With the advent of conversational models (ChatGPT, Claude), the paradigm shifted to chat mode, where exchanges are structured as messages (system, user, assistant), but the underlying mechanism remains a form of completion.
The quality of a completion directly depends on the quality of the prompt. A vague prompt will produce a generic completion, while a precise, structured, and contextualized prompt will generate a relevant and targeted response. This direct relationship underpins the entire discipline of prompt engineering.
Several parameters influence completion: temperature controls the randomness or determinism of the response, max_tokens limits its length, and frequency or presence penalties modulate the diversity of the vocabulary used. Understanding these levers allows obtaining completions suited to each use case, whether for creative writing, data analysis, or code generation.
Etymology
The term "completion" comes from the English verb "to complete." It reflects the fundamental mechanism of language models, which "complete" a sequence of text by predicting the following tokens. The term became established in AI vocabulary with OpenAI's GPT-3 API, which explicitly named its main endpoint "Completions."
Concrete examples
Simple text generation
The three main advantages of remote work are:
Usage via API with completion parameters
API call with temperature=0.2 and max_tokens=500 to obtain a factual and concise answer to a technical question
Chat mode vs text mode completion
In chat mode, each assistant message is a completion conditioned by the conversation history and the system message
Practical usage
To get better completions, structure your prompts with clear context, explicit instructions, and the expected output format. Adjust temperature according to your need: low (0-0.3) for factual and reproducible responses, high (0.7-1) for creativity. Use the max_tokens parameter to control response length and avoid truncated completions.
Related concepts
FAQ
What is the difference between completion and chat completion?
Why is my completion sometimes truncated?
How to make a completion more deterministic?
See also
How to use this prompt
- Copy the prompt with the button above.
- Paste it into ChatGPT, Claude or your favorite AI assistant.
- Replace the bracketed variables with your details, then refine the result.
About Prompt Guide
Prompt Guide is a free library of 2500+ ready-to-use prompts for ChatGPT, Claude and other AIs, with guides to learn prompting and tools to build and optimize your own prompts.
More definitions
Computer Use: Definition and Examples
Ability of an AI model to directly interact with a computer by controlling the mouse, keyboard, and screen, just as a human user would.
Confusion Matrix: Definition and Examples
Learn to read a confusion matrix: true positives, false negatives, accuracy, precision and recall explained with concrete examples in machine learning.
Constitutional AI: Definition and Examples
AI alignment method developed by Anthropic, where a model is trained to self-correct by following a set of written principles (a 'constitution')
Context Management: Definition and Examples
Context management refers to the set of techniques for controlling, structuring, and optimizing the contextual information provided to an AI model.
Context Window: Definition and Examples
The context window refers to the maximum amount of text a language model can process at one time, encompassing both the user input and the generated response.
Contextual Prompting: Definition and Examples
A prompt engineering technique that involves providing the AI model with rich and relevant context to guide its response accurately and appropriately for the situation.
Get new prompts every week
Join our newsletter.