PromptEngineering 20230208
PromptEngineering 20230208
Courtesy : Deus.ai
Coming next - GPT4 :)
Courtesy : Twitter
What is Prompt Engineering?
What is Prompt Engineering?
Prompt engineering is a NLP concept that involves discovering inputs that yield
desirable or useful results
Credits: Cohere
What is Prompt Engineering?
Prompt engineering is a NLP concept that involves discovering inputs that yield
desirable or useful results
(or)
Credits: humanloop
What is Prompt Engineering?
Credits: humanloop
What is Prompt Engineering?
Credits: cohere
Prompting by Instruction
Prompting by Example
Credits: cohere
Prompting by Example
Use Cases
Use Case - Text Generation
Use Case - Text Classification
Use Case - Language Translation
Use Case - Question Answering
Use Case - Text Summarization
Use Case - Image Generation
Models / Tools
● Dall-E
● Midjourney
● Stable Diffusion
Use Case - Image Generation
Prompting Techniques
Prompting Technique - Length Control
● Blacklisting words:
○ Ex - Write a summary about banks but avoid using the word loans
● Topic Constraints:
○ Ex - Write a review on iphone without covering the price aspect
● Stopping criteria
○ Number of tokens - maximum number of tokens to generate
○ Stop sequences - character or the sequence used to separate the
training examples
● Repetition Reduction
○ Frequency penalty - penalizes based on the frequency of the word in the
preceding text
○ Presence penalty - penalizes based on the presence of the word
LLM Model Parameters to Control
● Next Token Prediction
○ Temperature - High temperature is very creative and vice versa
○ Top-k - Top K tokens to choose the next word from
○ Top-p - Top probability of tokens to choose the next word from
Credits: cohere
Prompt Injections &
Limitations
Prompt Injections
● Similar to SQL Injections
● Prompting to trick the LLMs to do something undesirable
Prompt Injections
● Similar to SQL Injections
● Prompting to trick the LLM to do something undesirable
Prompt Engineering - Limitations
● Size of the language models
○ GPT index - https://github.com/jerryjliu/gpt_index
○ A set of data structures designed to make it easier to use large external
knowledge bases with LLMs
● Dair.ai - https://github.com/dair-ai/Prompt-Engineering-Guide
● Cohere - https://txt.cohere.ai/generative-ai-part-1/
● ChatGPT - https://chat.openai.com/
● GPT3 - https://platform.openai.com/login/
● Humanloop - https://humanloop.com/blog/prompt-engineering-101
● Twitter - https://twitter.com/goodside
● Promptify - https://github.com/promptslab/Promptify
Thank you!
Questions?!