ElemedexA pocket encyclopedia of AI architectures

Glossary (TM) › Use: prompts, sampling, systems

TM156

Prompt

Also: input, query

In Spanish: Prompt (instrucción)

The text given to a language model as a starting point; the model responds by generating the most likely continuation of that text.

A language model is a prediction machine: it receives a text, the prompt, and tries to predict the words that follow it (Alammar & Grootendorst, 2024, p. 173). The most basic prompt is a half-finished sentence; the most elaborate can combine several components: a persona ("you are an expert in astrophysics"), the instruction, the context, the output format, the audience, the tone and the data (Alammar & Grootendorst, 2024, pp. 177–178). The practice of adjusting these components by trial and error is called prompt engineering.

The crucial point is that a prompt is not an order in the sense in which a program instruction is. When someone types "All humans are mortal and Socrates is human, therefore…", they are not asking the model to carry out a deduction but, strictly speaking, to report which words tend to follow that sequence in the corpus; that the answer is "Socrates is mortal" is good news, not a proof (Shanahan, 2024, p. 76). This is why details that are trivial to a human, such as a punctuation mark or the order of the parts, can change the result considerably, and why Buckner (2024) describes prompt engineering as ad hoc tweaking without much systematic guidance (2024, pp. 278–279). Position matters too: models tend to attend more to the beginning and end of a long prompt than to its middle (Alammar & Grootendorst, 2024, p. 177).

The prompts the user sees are not all the model sees: there is usually an invisible system prompt and a chat template. And the prompt takes up room in the context window, measured in tokens. For a linguist, the prompt is context in the pragmatic sense: it does not convey an intention that the model recognizes, but shifts the distribution of possible continuations. Shanahan (2024) puts it this way: prompt engineering will remain necessary until we better understand the relationship between what we say and what we want (2024, p. 72).

Sources

  • Alammar, J., & Grootendorst, M. (2024). Hands-on large language models: Language understanding and generation. O’Reilly Media. §
  • Buckner, C. J. (2024). From deep learning to rational machines: What the history of philosophy can teach us about the future of artificial intelligence. Oxford University Press. https://doi.org/10.1093/oso/9780197653302.001.0001 §
  • Shanahan, M. (2024). Talking about large language models. Communications of the ACM, 67(2), 68–79. https://doi.org/10.1145/3624724 §