Prompt (language models)

From Systems Analysis Wiki
Jump to navigation Jump to search

A prompt, in the context of large language models (LLMs), is the input text or instruction that a user provides to a model to generate a desired response[1]. A prompt formulates the task for the model, including the necessary conditions, context, and examples. A model's effectiveness largely depends on the quality of the prompt.

The discipline that studies methods for developing and optimizing text queries is called prompt engineering. Its goal is to elicit the most relevant, accurate, and safe responses from AI models[2]. A well-crafted prompt gives the model a "roadmap" for completing the task, helping to clarify the required context and the desired outcome[1].

History of the Approach

The idea of controlling LLM behavior through text prompts evolved as the capabilities of the models themselves grew.

Early Stages (GPT-2)

As early as 2019, OpenAI researchers demonstrated that large pretrained language models, such as GPT-2, could solve new tasks without additional training if the tasks were formulated as text. The paper "Language Models are Unsupervised Multitask Learners" marked a fundamental shift: instead of fine-tuning a model for each task, it became sufficient to formulate a clear instruction as input[3].

Breakthrough with GPT-3 and In-Context Learning

The real breakthrough came with the release of the GPT-3 model in 2020. With 175 billion parameters, GPT-3 demonstrated the ability for in-context learning—learning a new task "on the fly" from a few examples provided directly in the prompt[3]. This mode of operation was named few-shot learning and showed that scaling up the model size leads to high-quality performance on NLP tasks without any weight adjustments.

Emergence of Chain-of-Thought (CoT)

Further development in 2022 focused on improving the models' ability for complex logical reasoning. Special prompts in the format of a chain-of-thought (chain-of-thought prompting) were proposed. In such prompts, the model receives not only a question but also an example of sequential, step-by-step reasoning before the answer. This significantly increased the accuracy of solutions in arithmetic and logical tasks[2]. Research by Kojima et al. showed that a model could be stimulated to reason even without examples (zero-shot) simply by adding the phrase "Let's think step by step" to the end of the prompt[2].

Multimodal Prompts

The concept of prompts expanded beyond text. In 2022, with the advent of models like DALL-E 2 and Stable Diffusion, user queries in natural language became a universal interface for generating images, and later, music and video.

Types and Techniques of Prompting

There are several main types and techniques of prompts, which are often combined.

Zero-shot Prompting (Direct Query)

The model receives only an instruction or a question without any examples. In this mode, the LLM relies on its general knowledge acquired during pretraining. It is suitable for simple tasks, such as translation or text summarization[1].

Few-shot Prompting (Learning from Examples)

In addition to the instruction, the prompt includes one or more examples with inputs and expected outputs. The model "learns on the fly" from these samples and applies the learned logic to the new query. This method, which implements in-context learning, significantly increases accuracy on tasks where a specific format or style of response is important[1].

Chain-of-Thought (CoT)

A special type of prompt for tasks requiring complex reasoning (mathematics, logic). The prompt includes a step-by-step breakdown or a solution plan before the final answer. This forces the model to explicitly structure its reasoning process, which significantly improves the quality of the result[2].

Prompt Tuning

A technique where an automatically optimized prompt is used instead of a manually written one. The prompt is represented as a set of special trainable tokens (a continuous vector) that is added to the user's query. By training only this small vector-prompt, a large "frozen" model can be adapted to a new task with minimal computational cost[2].

Prompt Engineering as a Discipline

Emergence of the Profession

The growth of LLM capabilities has led to the emergence of a new specialization: the prompt engineer. These specialists develop and debug text prompts to elicit the desired behavior from AI. Prompt engineers use knowledge in linguistics, logic, and psychology to structure input data in the most effective way[2]. In 2022–2023, the first job openings for this position appeared, reflecting the high demand for skills in effectively interacting with AI systems.

Future of the Profession and Automation

The field is developing rapidly, and its future is a subject of debate. Research in 2024, for example from VMware, has shown that AI itself is capable of finding effective prompt formulations through trial and error and optimization, often surpassing human-written ones[4]. This has led to the view that manual prompt engineering may be a temporary phenomenon, and that tools for automatic prompt selection will eventually become standard. Nevertheless, as of 2025, expertise in prompt engineering remains in demand.

Applications

  • Natural language processing: Classic NLP tasks such as automatic document summarization, machine translation, question answering, and information extraction.
  • Chatbots and virtual assistants: Prompts help define the role, communication style, and response format, making conversational systems more consistent and useful.
  • Code generation: Models like OpenAI Codex can write program code from natural language descriptions, which speeds up development.
  • Data analysis: Prompts can be used to configure a model to extract insights from unstructured text reports or to generate hypotheses.
  • Education: Creating intelligent tutors that generate assignments, explain complex concepts, and check answers, taking into account the student's level of knowledge.
  • Creative industries: Generating texts, artistic images, music, and scripts based on detailed descriptions.

Malicious Use and Vulnerabilities (Prompt Injection)

The open nature of the LLM interface has led to the emergence of a new class of attacks: prompt injection. An attacker formulates a special malicious query that causes the model to violate its original instructions or reveal hidden information[2]. Experts consider this a type of "code injection" attack, where instead of code, insidious text instructions are "injected" into the system.

Types of Attacks

  • Jailbreak: An attack that allows a model to "escape" the confines of its imposed restrictions (e.g., moderation policies) and generate forbidden content. A well-known example is the DAN prompt (Do Anything Now), which forced ChatGPT to respond without censorship.
  • Prompt Leaking: A special query forces the model to reveal parts of its hidden system prompt.
  • Token Smuggling: A malicious instruction is disguised as a harmless part of the query (e.g., a code snippet) to bypass filters and provoke undesirable behavior.

These attacks pose a serious problem, as traditional cybersecurity methods are ill-suited for threats related to the interpretation of natural language.

Further Reading

  • Radford, A. et al. (2019). Language Models are Unsupervised Multitask Learners. PDF.
  • Brown, T. B. et al. (2020). Language Models are Few-Shot Learners. arXiv:2005.14165.
  • Wei, J. et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv:2201.11903.
  • Wang, X. et al. (2022). Self-Consistency Improves Chain of Thought Reasoning in Language Models. arXiv:2203.11171.
  • Kojima, T. et al. (2022). Large Language Models are Zero-Shot Reasoners. arXiv:2205.11916.
  • Li, X. L.; Liang, P. (2021). Prefix-Tuning: Optimizing Continuous Prompts for Generation. arXiv:2101.00190.
  • Liu, Y. et al. (2021). Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity. arXiv:2104.08786.
  • Chang, K. et al. (2024). Efficient Prompting Methods for Large Language Models: A Survey. arXiv:2404.01077.
  • Li, Z. et al. (2024). Prompt Compression for Large Language Models: A Survey. arXiv:2410.12388.
  • Genkina, D. (2024). AI Prompt Engineering Is Dead. IEEE Spectrum. [5].
  • Li, W. et al. (2025). A Survey of Automatic Prompt Engineering: An Optimization Perspective. arXiv:2502.11560.
  • Wu, Z. et al. (2025). The Dark Side of Function Calling: Pathways to Jailbreaking Large Language Models. EMNLP 2025. PDF.

References

  1. 1.0 1.1 1.2 1.3 "Prompt Engineering for AI Guide". Google Cloud. [1]
  2. 2.0 2.1 2.2 2.3 2.4 2.5 2.6 "Prompt engineering". Wikipedia. [2]
  3. 3.0 3.1 Brown, Tom B., et al. "Language Models are Few-Shot Learners". arXiv:2005.14165 [cs.CL], May 28, 2020. [3]
  4. "AI Prompt Engineering Is Dead". IEEE Spectrum. [4]