Prompt Engineering Guide
Prompt engineering is a relatively new discipline for developing and optimizing prompts to efficiently use language models (LMs) for a wide variety of applications and research topics. Prompt engineering skills help to better understand the capabilities and limitations of large language models (LLMs). Researchers use prompt engineering to improve the capacity of LLMs on a wide range of common and complex tasks such as question answering and arithmetic reasoning. Developers use prompt engineering to design robust and effective prompting techniques that interface with LLMs and other tools.
Motivated by the high interest in developing with LLMs, we have created this new prompt engineering guide that contains all the latest papers, learning guides, lectures, references, and tools related to prompt engineering.
Happy Prompting!
Announcements / Updates
- 🎓 Partnered with Sphere to deliver a new course on Prompt Engineering for LLMs
- 💬 New ChatGPT prompt engineering guide coming soon!
- 🔥 We reached #1 on Hacker News on 21 Feb 2023
- 🎉 The Prompt Engineering Lecture went live here
- 🎓 We're creating a set of comprehensive guides here
Table of Contents
Lecture
We have published a 1 hour lecture that provides a comprehensive overview of prompting techniques, applications, and tools.
Guides
The following are a set of guides on prompt engineering developed by us. Guides are work in progress.
- Prompt Engineering - Introduction
- Prompt Engineering - Basic Prompting
- Prompt Engineering - Advanced Prompting
- Prompt Engineering - Applications
- Prompt Engineering - Adversarial Prompting
- Prompt Engineering - Reliability
- Prompt Engineering - Miscellaneous Topics
Papers
The following are the latest papers (sorted by release date) on prompt engineering. We update this on a daily basis and new papers come in. We incorporate summaries of these papers to the guides above every week.
-
Surveys / Overviews:
- Augmented Language Models: a Survey (Feb 2023)
- A Survey for In-context Learning (Dec 2022)
- Towards Reasoning in Large Language Models: A Survey (Dec 2022)
- Reasoning with Language Model Prompting: A Survey (Dec 2022)
- Emergent Abilities of Large Language Models (Jun 2022)
- A Taxonomy of Prompt Modifiers for Text-To-Image Generation (Apr 2022)
- Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processing (Jul 2021)
-
Approaches/Techniques:
- EvoPrompting: Language Models for Code-Level Neural Architecture Search (Feb 2023)
- In-Context Instruction Learning (Feb 2023)
- Chain of Hindsight Aligns Language Models with Feedback (Feb 2023)
- Language Is Not All You Need: Aligning Perception with Language Models (Feb 2023)
- Automatic Prompt Augmentation and Selection with Chain-of-Thought from Labeled Data (Feb 2023)
- Active Prompting with Chain-of-Thought for Large Language Models (Feb 2023)
- More than you've asked for: A Comprehensive Analysis of Novel Prompt Injection Threats to Application-Integrated Large Language Models (Feb 2023)
- Guiding Large Language Models via Directional Stimulus Prompting (Feb 2023)
- How Does In-Context Learning Help Prompt Tuning? (Feb 2023)
- Scalable Prompt Generation for Semi-supervised Learning with Language Models (Feb 2023)
- Bounding the Capabilities of Large Language Models in Open Text Generation with Prompt Constraints (Feb 2023)
- À-la-carte Prompt Tuning (APT): Combining Distinct Data Via Composable Prompting (Feb 2023)
- GraphPrompt: Unifying Pre-Training and Downstream Tasks for Graph Neural Networks (Feb 2023)
- The Capacity for Moral Self-Correction in Large Language Models (Feb 2023)
- SwitchPrompt: Learning Domain-Specific Gated Soft Prompts for Classification in Low-Resource Domains (Feb 2023)
- Evaluating the Robustness of Discrete Prompts (Feb 2023)
- Compositional Exemplars for In-context Learning (Feb 2023)
- Hard Prompts Made Easy: Gradient-Based Discrete Optimization for Prompt Tuning and Discovery (Feb 2023)
- Multimodal Chain-of-Thought Reasoning in Language Models (Feb 2023)
- Large Language Models Can Be Easily Distracted by Irrelevant Context (Feb 2023)
- Synthetic Prompting: Generating Chain-of-Thought Demonstrations for Large Language Models (Feb 2023)
- Progressive Prompts: Continual Learning for Language Models (Jan 2023)
- Batch Prompting: Efficient Inference with LLM APIs (Jan 2023)
- Demonstrate-Search-Predict: Composing retrieval and language models for knowledge-intensive NLP (Dec 2022)
- On Second Thought, Let's Not Think Step by Step! Bias and Toxicity in Zero-Shot Reasoning (Dec 2022)
- Constitutional AI: Harmlessness from AI Feedback (Dec 2022)
- Successive Prompting for Decomposing Complex Questions (Dec 2022)
- Discovering Language Model Behaviors with Model-Written Evaluations (Dec 2022)
- Structured Prompting: Scaling In-Context Learning to 1,000 Examples (Dec 2022)
- PAL: Program-aided Language Models (Nov 2022)
- Large Language Models Are Human-Level Prompt Engineers (Nov 2022)
- Ignore Previous Prompt: Attack Techniques For Language Models (Nov 2022)
- Machine Generated Text: A Comprehensive Survey of Threat Models and Detection Methods (Nov 2022)
- Teaching Algorithmic Reasoning via In-context Learning (Nov 2022)
- Enhancing Self-Consistency and Performance of Pre-Trained Language Models through Natural Language Inference (Nov 2022)
- Ask Me Anything: A simple strategy for prompting language models (Oct 2022)
- Recitation-Augmented Language Models (Oct 2022)
- ReAct: Synergizing Reasoning and Acting in Language Models (Oct 2022)
- Prompting GPT-3 To Be Reliable (Oct 2022)
- Decomposed Prompting: A Modular Approach for Solving Complex Tasks (Oct 2022)
- Language Models Are Greedy Reasoners: A Systematic Formal Analysis of Chain-of-Thought (Oct 2022)
- Evaluating the Susceptibility of Pre-Trained Language Models via Handcrafted Adversarial Examples (Sep 2022)
- Dynamic Prompt Learning via Policy Gradient for Semi-structured Mathematical Reasoning (Sep 2022)
- Promptagator: Few-shot Dense Retrieval From 8 Examples (Sep 2022)
- DocPrompting: Generating Code by Retrieving the Docs (July 2022)
- On the Advance of Making Language Models Better Reasoners (June 2022)
- Large Language Models are Zero-Shot Reasoners (May 2022)
- MRKL Systems: A modular, neuro-symbolic architecture that combines large language models, external knowledge sources and discrete reasoning (May 2022)
- Toxicity Detection with Generative Prompt-based Inference (May 2022)
- Learning to Transfer Prompts for Text Generation (May 2022)
- The Unreliability of Explanations in Few-shot Prompting for Textual Reasoning (May 2022)
- A Taxonomy of Prompt Modifiers for Text-To-Image Generation (Apr 2022)
- PromptChainer: Chaining Large Language Model Prompts through Visual Programming (Mar 2022)
- Self-Consistency Improves Chain of Thought Reasoning in Language Models (March 2022)
- Training language models to follow instructions with human feedback
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? (Feb 2022)
- Chain of Thought Prompting Elicits Reasoning in Large Language Models (Jan 2022)
- Show Your Work: Scratchpads for Intermediate Computation with Language Models (Nov 2021)
- Generated Knowledge Prompting for Commonsense Reasoning (Oct 2021)
- Multitask Prompted Training Enables Zero-Shot Task Generalization (Oct 2021)
- Reframing Instructional Prompts to GPTk's Language (Sep 2021)
- Design Guidelines for Prompt Engineering Text-to-Image Generative Models (Sep 2021)
- Making Pre-trained Language Models Better Few-shot Learners (Aug 2021)
- Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity (April 2021)
- BERTese: Learning to Speak to BERT (April 2021)
- The Power of Scale for Parameter-Efficient Prompt Tuning (April 2021)
- Prompt Programming for Large Language Models: Beyond the Few-Shot Paradigm (Feb 2021)
- Calibrate Before Use: Improving Few-Shot Performance of Language Models (Feb 2021)
- Prefix-Tuning: Optimizing Continuous Prompts for Generation (Jan 2021)
- AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts (Oct 2020)
- Language Models are Few-Shot Learners (May 2020)
- How Can We Know What Language Models Know? (July 2020)
-
Applications:
- TabGenie: A Toolkit for Table-to-Text Generation (Feb 2023)
- SGL-PT: A Strong Graph Learner with Graph Prompt Tuning (Feb 2023)
- Few-Shot Table-to-Text Generation with Prompt-based Adapter (Feb 2023)
- Language Models Are Few-shot Learners for Prognostic Prediction (Feb 2023)
- STA: Self-controlled Text Augmentation for Improving Text Classifications (Feb 2023)
- Check Your Facts and Try Again: Improving Large Language Models with External Knowledge and Automated Feedback (Feb 2023)
- How Generative AI models such as ChatGPT can be (Mis)Used in SPC Practice, Education, and Research? An Exploratory Study (Feb 2023)
- Grimm in Wonderland: Prompt Engineering with Midjourney to Illustrate Fairytales (Feb 2023)
- LabelPrompt: Effective Prompt-based Learning for Relation Classification (Feb 2023)
- Language Model Crossover: Variation through Few-Shot Prompting (Feb 2023)
- Prompt Tuning of Deep Neural Networks for Speaker-adaptive Visual Speech Recognition (Feb 2023)
- The Capacity for Moral Self-Correction in Large Language Models (Feb 2023)
- Prompting for Multimodal Hateful Meme Classification (Feb 2023)
- PLACES: Prompting Language Models for Social Conversation Synthesis (Feb 2023)
- Commonsense-Aware Prompting for Controllable Empathetic Dialogue Generation (Feb 2023)
- Crawling the Internal Knowledge-Base of Language Models (Jan 2023)
- Legal Prompt Engineering for Multilingual Legal Judgement Prediction (Dec 2022)
- Investigating Prompt Engineering in Diffusion Models (Nov 2022)
- Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering (Sep 2022)
- Conversing with Copilot: Exploring Prompt Engineering for Solving CS1 Problems Using Natural Language (Oct 2022)
- Piloting Copilot and Codex: Hot Temperature, Cold Prompts, or Black Magic? (Oct 2022)
- Plot Writing From Scratch Pre-Trained Language Models (July 2022)
-
Collections:
Tools & Libraries
(Sorted by Name)
- AI Test Kitchen
- betterprompt
- DreamStudio
- DUST
- Dyno
- EmergentMind
- EveryPrompt
- GPT Index
- GPTTools
- hwchase17/adversarial-prompts
- Interactive Composition Explorer
- LangChain
- Lexica
- loom
- Metaprompt
- OpenAI Playground
- OpenPrompt
- Playground
- Prodia
- Prompt Base
- Prompt Engine
- Prompt Generator for OpenAI's DALL-E 2
- Promptable
- PromptInject
- Prompts.ai
- PromptPerfect
- Promptly
- PromptSource
- Promptist
- Scale SpellBook
- sharegpt
- ThoughtSource
- Visual Prompt Builder
Datasets
(Sorted by Name)
- Anthropic's Red Team dataset, (paper)
- Awesome ChatGPT Prompts
- DiffusionDB
- Midjourney Prompts
- P3 - Public Pool of Prompts
- PartiPrompts
- Real Toxicity Prompts
- Stable Diffusion Dataset
- WritingPrompts
Blog, Guides, Tutorials and Other Readings
(Sorted by Name)
- 3 Principles for prompt engineering with GPT-3
- A beginner-friendly guide to generative language models - LaMBDA guide
- A Complete Introduction to Prompt Engineering for Large Language Models
- A Generic Framework for ChatGPT Prompt Engineering
- An SEO’s guide to ChatGPT prompts
- AI Content Generation
- AI's rise generates new job title: Prompt engineer
- Awesome ChatGPT Prompts
- Best 100+ Stable Diffusion Prompts
- Best practices for prompt engineering with OpenAI API
- Building GPT-3 applications — beyond the prompt
- ChatGPT, AI and GPT-3 Apps and use cases
- CMU Advanced NLP 2022: Prompting
- Curtis64's set of prompt gists
- DALL·E 2 Prompt Engineering Guide
- DALL·E 2 Preview - Risks and Limitations
- DALLE Prompt Book
- DALL-E, Make Me Another Picasso, Please
- Diffusion Models: A Practical Guide
- Exploiting GPT-3 Prompts
- Exploring Prompt Injection Attacks
- Extrapolating to Unnatural Language Processing with GPT-3's In-context Learning: The Good, the Bad, and the Mysterious
- Generative AI with Cohere: Part 1 - Model Prompting
- Giving GPT-3 a Turing Test
- GPT-3 & Beyond
- GPT3 and Prompts: A quick primer
- How to Draw Anything
- How to get images that don't suck
- How to make LLMs say true things
- How to perfect your prompt writing for AI generators
- How to write good prompts
- If I Was Starting Prompt Engineering in 2023: My 8 Insider Tips
- Indirect Prompt Injection on Bing Chat
- Interactive guide to GPT-3 prompt parameters
- Introduction to Reinforcement Learning with Human Feedback
- In defense of prompt engineering
- Language Models and Prompt Engineering: Systematic Survey of Prompting Methods in NLP
- Learn Prompting
- Methods of prompt programming
- Mysteries of mode collapse
- NLP for Text-to-Image Generators: Prompt Analysis
- NLP with Deep Learning CS224N/Ling284 - Lecture 11: Promting, Instruction Tuning, and RLHF
- Notes for Prompt Engineering by sw-yx
- OpenAI Cookbook
- OpenAI Prompt Examples for several applications
- Pretrain, Prompt, Predict - A New Paradigm for NLP
- Prompt Engineer: Tech's hottest job title?
- Prompt Engineering 101 - Introduction and resources
- Prompt Engineering 101: Autocomplete, Zero-shot, One-shot, and Few-shot prompting
- Prompt Engineering 101
- Prompt Engineering - A new profession ?
- Prompt Engineering by co:here
- Prompt Engineering by Microsoft
- Prompt Engineering: The Career of Future
- Prompt engineering davinci-003 on our own docs for automated support (Part I)
- Prompt Engineering Guide: How to Engineer the Perfect Prompts
- Prompt Engineering in GPT-3
- Prompt Engineering Template
- Prompt Engineering Topic by GitHub
- Prompt Engineering: The Ultimate Guide 2023 [GPT-3 & ChatGPT]
- Prompt Engineering: From Words to Art
- Prompt Engineering with OpenAI's GPT-3 and other LLMs
- Prompt injection attacks against GPT-3
- Prompt injection to read out the secret OpenAI API key
- Prompting in NLP: Prompt-based zero-shot learning
- Prompting Methods with Language Models and Their Applications to Weak Supervision
- Prompts as Programming by Gwern
- Reverse Prompt Engineering for Fun and (no) Profit
- So you want to be a prompt engineer: Critical careers of the future
- Simulators
- Start with an Instruction
- Talking to machines: prompt engineering & injection
- Tech’s hottest new job: AI whisperer. No coding required
- The Book - Fed Honeypot
- The ChatGPT Prompt Book
- The Most Important Job Skill of This Century
- The Mirror of Language
- Unleash Your Creativity with Generative AI: Learn How to Build Innovative Products!
- Using GPT-Eliezer against ChatGPT Jailbreaking
- What Is ChatGPT Doing … and Why Does It Work?
- Why is ChatGPT so good?
If you are using the guide for your work, please cite us as follows:
@article{Saravia_Prompt_Engineering_Guide_2022,
author = {Saravia, Elvis},
journal = {https://github.com/dair-ai/Prompt-Engineering-Guide},
month = {12},
title = {{Prompt Engineering Guide}},
year = {2022}
}
Feel free to open a PR if you think something is missing here. Always welcome feedback and suggestions. Just open an issue!