Prompt engineering

Prompt engineering is the process of structuring an instruction that can be interpreted and understood by a generative artificial intelligence (AI) model.[1][2] A prompt is natural language text describing the task that an AI should perform.[3] A prompt for a text-to-text language model can be a query such as "what is Fermat's little theorem?",[4] a command such as "write a poem in the style of Edgar Allan Poe about leaves falling",[5] or a longer statement including context, instructions,[6] and conversation history.

Prompt engineering may involve phrasing a query, specifying a style,[5] choice of words and grammar[7], providing relevant context[8] or assigning a role to the AI such as "act as a native French speaker".[9]

When communicating with a text-to-image or a text-to-audio model, a typical prompt is a description of a desired output such as "a high-quality photo of an astronaut riding a horse"[10] or "Lo-fi slow BPM electro chill with organic samples".[11] Prompting a text-to-image model may involve adding, removing, emphasizing, and re-ordering words to achieve a desired subject, style,[1] layout, lighting,[12] and aesthetic.

  1. ^ a b Diab, Mohamad; Herrera, Julian; Chernow, Bob (2022-10-28). "Stable Diffusion Prompt Book" (PDF). Retrieved 2023-08-07. Prompt engineering is the process of structuring words that can be interpreted and understood by a text-to-image model. Think of it as the language you need to speak in order to tell an AI model what to draw.
  2. ^ Ziegler, Albert; Berryman, John (17 July 2023). "A developer's guide to prompt engineering and LLMs". The GitHub Blog. Prompt engineering is the art of communicating with a generative AI model.
  3. ^ Radford, Alec; Wu, Jeffrey; Child, Rewon; Luan, David; Amodei, Dario; Sutskever, Ilya (2019). "Language Models are Unsupervised Multitask Learners" (PDF). OpenAI. We demonstrate language models can perform down-stream tasks in a zero-shot setting – without any parameter or architecture modification
  4. ^ "Introducing ChatGPT". OpenAI Blog. 2022-11-30. Retrieved 2023-08-16. what is the fermat's little theorem
  5. ^ a b Robinson, Reid (August 3, 2023). "How to write an effective GPT-3 or GPT-4 prompt". Zapier. Retrieved 2023-08-14. "Basic prompt: 'Write a poem about leaves falling.' Better prompt: 'Write a poem in the style of Edgar Allan Poe about leaves falling.'
  6. ^ Gouws-Stewart, Natasha (June 16, 2023). "The ultimate guide to prompt engineering your GPT-3.5-Turbo model". masterofcode.com.
  7. ^ Wahle, Jan Philip; Ruas, Terry; Xu, Yang; Gipp, Bela (2024). Al-Onaizan, Yaser; Bansal, Mohit; Chen, Yun-Nung (eds.). "Paraphrase Types Elicit Prompt Engineering Capabilities". Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing. Miami, Florida, USA: Association for Computational Linguistics: 11004–11033. arXiv:2406.19898.
  8. ^ Greenberg, J., Laura (31 May 2023). "How to Prime and Prompt ChatGPT for More Reliable Contract Drafting Support". contractnerds.com. Retrieved 24 July 2023.
  9. ^ "GPT Best Practices". OpenAI. Retrieved 2023-08-16.
  10. ^ Heaven, Will Douglas (April 6, 2022). "This horse-riding astronaut is a milestone on AI's long road towards understanding". MIT Technology Review. Retrieved 2023-08-14.
  11. ^ Wiggers, Kyle (2023-06-12). "Meta open sources an AI-powered music generator". TechCrunch. Retrieved 2023-08-15. Next, I gave a more complicated prompt to attempt to throw MusicGen for a loop: "Lo-fi slow BPM electro chill with organic samples."
  12. ^ "How to Write AI Photoshoot Prompts: A Guide for Better Product Photos". claid.ai. June 12, 2023. Retrieved June 12, 2023.