Santiago
Santiago

@svpino

13 Tweets 2 reads Apr 26, 2023
You can 2x your productivity overnight using AI.
But you won't get far unless you understand Prompt Engineering and how to use it effectively.
Here are 8 techniques that will put you ahead of everyone else:
Every example on this thread uses the @CohereAI's API.
If you are a developer and want to integrate AI into your application, you can sign up for free right here: bit.ly
It takes 5 seconds, and you'll be up and running immediately!
Let's get started!
The way you ask matters.
A good prompt is crucial in getting good results from a model.
That's why we talk about "engineering" your prompts. The better you get at it, the more these models help you.
Here are the principles and techniques you need to master:
1. Use simple language
Rule of thumb: Write your prompts for a 5-year-old.
Direct and declarative language works best.
For example, use simple commands like "Write," "Summarize," "Translate," or "Rephrase."
2. Experiment with multiple variations
Different prompts which might sound similar can lead to different results.
This example prompts the model in two different ways:
1. "In summary:"
2. "The main point to take from this description is that:"
3. Provide example outputs
There are two ways of using these models:
• Zero-shot: Ask directly what you want.
• Few-shot: Provide examples, then ask.
When showing examples, you give better guidance to the model about the outputs you want.
4. Provide the model with context
Help the model understand the task and provide better results by giving it enough context.
For example, the attached example tells the model this is a conversation between a customer and a helpful service agent.
5. Avoid negative statements
Describe what you want instead of what you don't want.
Instead of: "Don't create things that aren't"
Ask: "Create things that are"
The attached example instructs the model on what it should do instead of what it shouldn't do.
6. Garbage in, garbage out
Large language models preserve the style of your prompts in their answers.
If your inputs are grammatically incorrect, your answers won't be better. Your stylistic choices will come across in the model's answers.
Here is a short story about a bear:
7. Use explicit language
Avoid generic statements when trying to solve a particular task. The more explicit you are, the better results you'll get.
• Instead of: "Answer the following question"
• Ask: "Calculate the result of the following math expression"
8. Use step-by-step reasoning
If you encourage the model to break down problems into sub-problems, you will get better results.
When the model mistakes, step-by-step reasoning will help you identify ways to improve your prompt.
I have 3 bonus techniques for you:
1. Break down top-level tasks into separate, less complex sub-tasks.
2. Instead of generating a list of 10 things, ask the model to generate one thing 10 different times.
3. Cut out as much fluff as possible from your instructions.
Here is a Colab with every example:
colab.research.google.com
This post wouldn't be possible without the support of @CohereAI and their API!
If you want to integrate AI into your application, you should strongly consider signing up here: bit.ly

Loading suggestions...