Prompt Engineering Full Guide
Key actionable principles and a complete roadmap of techniques and resources to master practical Prompt Engineering
Hi, friends 👋
Today we will dive into the world of Prompt Engineering.
My goal with this guide is to:
Distill the essential prompt engineering actionable principles I believe are crucial for designing robust and effective prompts. These principles have emerged from and long period of studying courses, guides, and white papers on the topic. They also come from my daily practice of Prompt Engineering while using ChatGPT and Claude (both via chat and through API) to program software.
Provide you a roadmap of the most important technique, concepts and resources to go from beginner to advanced in prompt engineering.
Why Prompt Engineering matters: Prompt engineering matters a lot and it is a serious emerging tech skills that can make a difference if mastered properly. Statistically, research indicates that simple chat interactions yield the desired results only about 85% of the time. However, this success rate increases to 98% when adept prompt engineering techniques are employed. Additionally, when one heavily utilizes LLMs for coding or writing, certain limitations quickly become evident:
Simple prompts can lead to misunderstandings and wrong answers.
There's often a need to refactor and adapt code or writing output to match a specific style.
Responses can be verbose and may not get to the point.
Hallucinations might appear in coding outputs.
LLMs can have out-of-date knowledge.
They lack access to proprietary information.
Continuous prompt iterations may be required to achieve the desired output.
Being ineffective at prompting can lead to wasted time and effort on tasks that could have been completed more efficiently by studying and applying a few techniques.
Brief Notes:
This guide is primarily focused on prompt engineering for text-based LLMs.While many concepts and pieces of advice can be applied to prompt engineering for image generation, that isn't the main focus of this guide at the current moment.
Let’s start.
Core actionable principles for effective prompt engineering
Write clear, specific and descriptive instructions
Use delimiters and write well structured prompts
Provide examples
Assign roles
Add context information to the prompt
Break complex tasks into smaller steps
Ask for multiple solutions
Use the right tool for your tasks
Combine techniques and always iterate and improve
1. Write clear, specific and descriptive instructions
This foundational principle in prompt engineering extends beyond the field itself; it pertains to effective communication with both humans and machines.
In both cases, in fact, you want to provide clear and specific instructions to ensure
Maximum understanding and alignment.
Higher probability to reach the desired output or goal on a specific task.
The most common and tedious issues that arise when an LLMs face a vague and unclear prompt are mainly the following.
The answer/output may be wrong, and you will need to iterate more to get to the desired result, actually increasing the time and effort.
The answer will be long and verbose, boring you to death and making it hard to skim for relevant information (and you will pay for all that if you are prompting via API).
As you'll see later in this guide, there are multiple components that make up a full prompt. You want to apply clarity and specificity to all of them when possible, but the most overlooked and important sections are the following:
Define the exact format of the output: LLM capabilities are really impressive; leverage them and ask for a specific output based on your needs. For example, ask specifically for a list, table, code, JSON, an email, a headline, a Twitter hook, a formula, etc.
Bad prompt: "Tell me about the history of the internet."
Good prompt: "Provide a timeline table of the major milestones in the development of the internet from 1980 to 2000."
Bad prompt: "Give me something catchy about our new shoes."
Good prompt: "Draft a headline and a Twitter hook for our new line of eco-friendly running shoes launching next week."
Bad prompt: "Can you write a Python function to sort a list?"
Good prompt: "Provide me with a Python function that sorts a list of integers in ascending order and returns the result in JSON format."
Define the style/tone the LLMs should follow: You have 3 options here:
Use adjectives like conversational, formal, sarcastic, etc.
Provide a practical example for the LLMs to use as reference, such as a text with the style you want or a code block with your style and practices.
Using general references to explain the style you want, like 'explain like I'm 5', can also be very effective, and sometimes it works with other famous reference examples too, like "Write this documentation just like Stripe does".
Bad prompt: "Can you give me a Python code to connect to a database?"
Good prompt: "Provide a Python code snippet for connecting to a PostgreSQL database, and write documentation for it in a clear, concise and simple way as if explaining to a junior programmer."
Bad prompt: "Write a product description for our Peanut Butter"
Good prompt: "Draft a product description for our new Peanut Butter, but make it sound sarcastic and cheeky, emphasizing how late we are to the organic food trend. Use the following product description as style reference."
Bad prompt: "Tell me about Einstein's Theory of Relativity."
Good prompt: "Explain Einstein's Theory of Relativity like I'm 5 and using bullet points that are clear, concise, and with examples."
Define the length and level of details you want: Specify if you want a long and detailed answer or a short and concise one. Detail further if needed, for example, three bullets or only one sentence.
Bad example: "Tell me about prompt engineering"
Good example: "I want you to tell me everything you know about prompt engineering in bullet point. I want you to tell me as much as possible starting from basic information and advice and then moving towards advanced concepts. Be clear, comprehensive and very detailed."
Bad example: "What's the history of the printing press?"
Good example: "Summarize the evolution of the printing press in 5 bullet points, focusing only on the major milestones. Keep the bullets concise and to the point."
Manage edge cases: This is mainly when using APIs to build chatbots and agents. Some of the most common edge cases to cover are:
The LLM doesn't know the answer.
The LLM is asked about some blacklisted topics.
You need to deal with adversarial prompts.
Be specific and provide detailed instructions. For instance, tell the LLMs to answer "I don’t know", “I can’t talk about that” etc. or instruct them to send users to a contact form or support@ email, or provide search terms and reference websites to aid the user in finding the answer themselves on the web.
2. Use delimiters and write well structured prompts
Prompts can be complex, long and contain multiple components. It's not enough to write specific and descriptive prompts; the prompt must also be well-structured and organized. Plus, giving structure to the prompt will also help you give structure to your ideas. It's a win-win situation.
To build a well-structured prompt, both when using LLMs directly and via API, you need to follow two simple steps:
Identify the needed prompt components: These usually include:
System prompt / roles
Context information
Conversation history
Detailed instructions
Desired output format
Few shot examples
Use clean delimiters, such as ### or """ to separate components. This may sound obvious, but it truly helps the LLM in parsing information and understanding clearly the role of each section, ensuring proper usage. This will reduce confusion and errors.
Here are a couple of examples of well-structured prompts following a proven prompt template that I personally use everyday.
1. Prompt structure example to use directly on ChatGPT or other LLM Chats
Your Role and Background Information: ### Act as a LinkedIn content creator for our software company, OrygoAI. Below, you can find some contextual information and research material regarding the latest developments in prompt engineering, as well as a writing task to complete. ###
Context: ### [paste here relevant information] ###
Detailed Instructions: ### write a 10-bullet-point Linkedin post summarizing the most significant development in prompt engineering. ###
Desired output format: ### The linkedin post must be structured in the following way:
1. There should be a catchy and concise headline for the post.
2. Begin with a brief intro explaining that you have reviewed and studied the most critical news and research concerning prompt engineering. This post is a summary of the most vital findings from the past three months, aimed at providing a quick update.
2. Each bullet point must have a concise title resembling a news headline. Following the title, include a single sentence that clearly and simply conveys the core message of the discovery. ###
Style referece examples: ### Here are a few LinkedIn posts that I particularly admire. Please use them as references for writing style and tone.
[past here relevant examples] ###
2. Prompt template structure example to use with APIs
This Prompt template can be built using the Python Langchain library
Context is automatically retrieved using Vector Store similarity search
Chat history is retrieved directly from our SQL database, or you can use Langchain memory solutions
# Prompt template structure
------------------
prompt_template = f"""
Your role and background information: ### {agent_prompt} ###
Context: ### {context} ###
Chat history: ### {chat_history} ###
User question: ### {question} ###
Answer:"""
If you're finding value in this prompt engineering guide, please consider sharing it with your friends and colleagues. Your support would be greatly appreciated!
3. Provide examples
Like most people, I primarily use text based LLMs to code, write and explore new topics. Providing examples is the single most time-efficient thing I do when prompting to generate code or written output.
The reason is simple: It can be challenging to write detailed and specific prompts using only words to comprehensively convey what you want in terms of output, especially concerning style or tone. Misunderstandings are easy to arise. Examples save a significant amount of time and reduce iterative work. I believe this is their most considerable benefit, even surpassing the consequential increase in reasoning capabilities.
The approach is straightforward:
Keep your reference material open while prompting (codebase, notes, etc.).
Copy-paste 2-5 examples in prompts whenever possible.
Since the goal is to achieve better output in terms of style, tone, and overall structure (rather than just enhancing reasoning capabilities), ensure that the examples are narrow, similar, and relevant to the desired output.
Here some examples (see what I did there? 😎):
When coding, I provide examples of code blocks from my codebase to emulate the style, approach, and structure of the functions and classes. I do this even for simple code requirements. This ensures the output seamlessly merges with the rest of the codebase, minimizing the need for adjustments and refactoring.
When writing, I consistently provide examples from my previous works or writings from others people/companies I want to emulate. This serves as a style reference for guides, documentations or reports.
Coding prompt Example
Prompt Without example:
[To get the desired style, you either have to be hyper-specific or iterate.]
"I need a Python function that calculates the factorial of a number. The function should be named calculate_factorial. It should accept a single integer named n. If n is zero, the function should return 1. For any other value of n, the function should return the factorial of n. Additionally, the function should have a docstring that describes its purpose, parameters, and return value."
Prompt With example: "I need a function similar to the one below, but it should calculate the factorial of a number. If n is zero, the function should return 1.
def add_two_numbers(a: int, b: int) -> int:
"""
Adds two numbers together.
Parameters:
- a (int): The first number.
- b (int): The second number.
Returns:
int: The sum of a and b.
"""
return a + b"
Same output: def calculate_factorial(n: int) -> int:
"""
Calculates the factorial of a given number.
Parameters:
- n (int): The number for which the factorial needs to be calculated.
Returns:
int: The factorial of n.
"""
if n == 0:
return 1
else:
return n * calculate_factorial(n - 1)
Tweets Writing Prompt Example:
[This example assumes that you have provided the LLM with some raw text to work on as source material.]
Prompt Without Example:
[Notice how detailed the prompt must be to convey the style, and even with all these details, the desired result is not guaranteed.]
"Below, you'll find some ideas and contextual information for crafting Twitter posts. Create 5 tweets based on the 5 strongest ideas in the context. Tweets should be concise, come across as advice or discoveries I'm sharing, and be actionable. Use only essential and simple words, avoiding adjectives or excessive descriptive content. The opening sentence of each tweet should be very catchy."
Prompt with Examples:
"Below, you'll find some ideas and contextual information for writing Twitter posts. Craft 5 tweets based on the 5 most compelling ideas in the context. Model them after Dan Koe's tweet style. After the context, you will find 5 examples of Dan Koe's tweets to use as references."
example 1: "You’re allowed to hate things.
Your job. Your business. Your environment.
People change when they experience a problem to the point of hatred.
People that say “hate is bad” are often the most hateful, because they don’t know how to redirect an energy that everyone experiences."
example 2: "There are two options in any situation:
1) Lean into the challenge and grow as a person.
2) Convince yourself to stay the same by doing what you’ve always done.
The ramifications of comfort are so much worse than the risk of giving yourself a chance.
example 3: "Doing nothing with your life is much more painful than doing something with your life. It just takes longer for that pain to kick in."
etc...
4. Assign Roles
Role prompting involves providing background information to the LLMs about its role and/or the user's role. Assigning a role or persona leads to benefits similar to those we discussed in the previous principle, "Provide examples," but at a broader conversation or chatbot level:
Better Framework to operate in: This ensures that responses are tailored to fit the specified role, leading to more relevant and accurate answers.
Narrowing down the breadth of possible answers. For instance, asking a general question might yield a broad range of responses, but when you ask the same question to an AI playing the role of a specific expert, the answers will be in line with that expertise.
Simplifying Complex Queries: Sometimes, a user might have a multifaceted question that's hard to put into words. By setting a role, the user gives context to the AI, making it easier to generate an answer that's in line with the user's expectations.
Mitigating Bias: By strictly defining the role and the boundaries of knowledge, role prompting can, in some cases, help reduce the chances of the model producing biased or inappropriate outputs.
Engagement: By having the model assume different personas, interactions can become more engaging and even entertaining. For example, users might enjoy conversing with an AI that speaks like Shakespeare or Elon Musk or assumes the role of a fictional character.
While recent research indicates that role prompting doesn't necessarily enhance reasoning capabilities, when used intelligently and creatively, it can lend 'character' to the LLM. This makes the conversation and overall experience significantly better and more immersive. For instance, https://beta.character.ai/ is an fast growing AI company that masterfully leverages role prompting.
I personally utilize it in Orygo.ai, where each AI assistant can be configured with a system / role prompt to specify how they should interact with the users.
Some examples:
Customer Service Chatbot:
"You are an AI Customer Service chatbot for our company. Your goal is to..."
Teacher / Student role prompting:
"You are my coding teacher, and I'm a junior programmer. Can you explain this code to me in simple terms?"
Copywriting assistant
"You are a copywriting assistant working at Tesla. Write a product description for the Model X."
5. Add Context Information to the Prompt
Adding context information allows you to overcome 3 significant limitations of LLMs:
Working with proprietary information that isn't natively in the LLM's general knowledge. For example, providing private raw content and product information for the LLM to use as your copywriting assistant.
Accessing up-to-date information not natively available to the LLMs: for instance, providing current documentation on libraries you are working with, so the LLM can assist you in coding.
Setting a specific perimeter of data and information for the LLM to work within. For instance, giving an article or a PDF for the LLM to concentrate on as your research or study assistant.
In terms of implementation, you can add context information to LLM prompts in two ways:
Simply paste it into your prompt or upload a file when using ChatGPT or other LLM chat applications.
Via vector store retrieval systems built on top of the LLMs API. I won't delve deep into this here, as I plan to write a dedicated guide on chatbot development soon. However, the concept is straightforward: Vector stores, such as Pinecone or Weaviate, are databases where you can store vectorized text/content. By combining vector stores with LLMs, you can automatically retrieve relevant contextual information from your vector store using similarity search and incorporate it into your LLM prompt. Langchain is currently the leading library for building retrieval systems for LLMs.
In conclusion, adding additional context information to your prompts may seem straightforward, but it's an incredibly effective technique that significantly enhances the knowledge and assistance capabilities of LLMs.
Generated Knowledge is the cousin of “Context Addition”. Sometimes you don’t need to add context to the LLM, but instead, you want to research a topic on which the LLM is natively knowledgeable. Then, use that as raw material for writing, coding, or research projects. The idea behind generated knowledge prompting is to ask the LLM to produce useful information about a given prompt, topic, or question before generating a final response or proceeding to the next step in your task.
Generated Knowledge Prompting Example
Single prompt approach:
"Tell me everything you know about lean manufacturing in bullet points, then use the most interesting facts to write 3 possible tweets."
Multiple prompts approach:
Prompt 1: "Please, tell me everything you know about FastAPI websockets. I want you to write a full guide on this topic for me."
Answer: ...
Prompt 2: "Perfect, now please write a FastAPI websocket endpoint for my chat application."
Answer: ..."
6. Break complex tasks into smaller steps
Finally, the bread and butter of prompt engineering! In my humble opinion, there's no doubt that the ability to effectively break down tasks into smaller, more digestible steps is one of the most important skills. It's crucial not only for mastering effective prompting but also for problem-solving and project building in general.
In technical terms related to prompt engineering, this action point stems from the concepts of 'chain-of-thought prompting' and 'least-to-most prompting'. Here are 3 of the most effective techniques to apply this principle:
Ask LLM’s to think step by step: with this technique, called ‘zero-shot chain-of-thought prompting’, we ask the LLMs to deconstruct the task into simpler steps. This is achieved by simply appending "Let's think step by step" to the end of your prompt. Research indicates that this phrase not only encourages the LLM to explain its reasoning but also enhances its reasoning capability and the likelihood of producing a correct output. This technique is particularly useful when you don’t know the steps and are exploring the problem/task for better understanding.
example of zero-shot chain-of-thought prompting
Prompt: "I visited the supermarket and purchased 15 apples. I lent 3 apples to my friend and donated 4 to the local charity. Later, I bought 7 more apples and sold 2. How many apples do I have now? Let's think step by step"
Answer: Sure, let's think step by step:
Initial Purchase: You start with 15 apples.
After Lending: Lending 3 apples to a friend means you subtract 3 from your total.
15 - 3 = 12 apples.
After Donating: Donating 4 apples to charity means you subtract another 4.
12 - 4 = 8 apples.
After Buying More: Buying 7 more apples means you add 7 to your current total.
8 + 7 = 15 apples.
After Selling: Selling 2 apples means subtracting 2 from your total.
15 - 2 = 13 apples.
In conclusion, after all these transactions, you have 13 apples now.
Break down the task and include all sub-steps directly in the original prompt: If you know the problem/task well and already know what are the specific subtasks you want the LLM to perform, you can help it adding them in the original prompt as sequential bullets. In this way, you will guide the LLM by providing it a roadmap to solve complete the macro task in the correct way. This approach is particularly effective when the sub-steps are simple and straightforward.
Example: "I want you to prepare a basic FastAPI guide with me.
First, add an intro to the full FastAPI guide, explaining what FastAPI is and why it's useful.
Second, list the 10 most important concepts about FastAPI you would include in the guide, presenting them as chapter titles.
Third, for each chapter, provide an explanation of that concept in bullet points, using simple language.
Fourth, for every chapter, offer a code example to illustrate the concept in practice.
Split the complex task into multiple prompts. Split the complex task into multiple prompts. This process is called 'Prompt Chaining' or 'Least-to-most prompting.' It is the most powerful technique to deploy when the sub-steps are complex in themselves, and you can't obtain reliable results using the previous two approaches. With this approach, the user or prompt engineer first breaks a problem into sub-problems, then solves each one sequentially, feeding the outputs of the earlier prompts into new ones that address the subsequent task. Research about 'Least-to-most prompting' has also been conducted by increasing the level of complexity with each progressive prompt. It has been demonstrated that 'Least to Most' leads to enhanced LLM reasoning capabilities.
An example directly from Anthropic tutorials
Step 1:
Human: Here is a document, in <document></document> XML tags:
<document>
{{DOCUMENT}}
</document>
Please extract, word-for-word, any quotes relevant to the question {{QUESTION}}. Please enclose the full list of quotes in <quotes></quotes> XML tags. If there are no quotes in this document that seem relevant to this question, please say "I can’t find any relevant quotes".
Assistant:
Step 2:
Human: I want you to use a document and relevant quotes from the document to answer the question "{{QUESTION}}"
Here is the document, in <document></document> XML tags:
<document>
{{DOCUMENT}}
</document>
Here are direct quotes from the document that are most relevant to the question "{{QUESTION}}": {{QUOTES}}
Please use these to construct an answer to the question "{{QUESTION}}" as though you were answering the question directly. Ensure that your answer is accurate and doesn’t contain any information not directly supported by the document or the quotes.
Assistant:
7. Ask for multiple solutions
This action point is straightforward: simply ask for multiple solutions, approaches, or outputs at the end of your prompt. Doing so can be highly beneficial in many situations, as it can expedite task completion. This approach enhances our understanding of the available paths for a given task and helps us more quickly identify the solution that best suits our needs.
Here are some illustrative examples:
Multiple writing approaches
Prompt: "Write a concise, catchy tweet explaining why requesting multiple solutions in prompt engineering is both effective and valuable. Offer several tweet options, each with a distinct style or approach, and provide explanations for each."
Multiple problem-solving / coding approaches:
Prompt: "Write a Python function that saves user data to our PostgreSQL database. Showcase various methods using the most popular libraries available, and detail the advantages and disadvantages of each."
8. Use the right tool for your tasks
While LLMs are powerful, they do have limitations. For instance, they can sometimes struggle with complex math and might not have access to the most recent information by default. Tools or plugins can be employed to enhance the capabilities of LLMs, making it crucial to be aware of them and utilize the appropriate one for your specific needs.
A variety of tools are accessible as plugins in chatGPT or through Langchain via API. Some of the key types of tools include:
Web search tools: These allow LLMs to browse the web. Notable examples are SerpAPI, GoogleAPI, BingAPI and the Wikipedia plugin.
Code interpreters: Tools like ChatGPT Advanced Data Analysis or WolframAlpha equip the LLM with code execution capabilities. They are especially effective for analyzing tabular data using Python and Pandas.
Vector Stores: We touched on these earlier. They supply the LLM with an extensive, vectorized knowledge base of curated content and information, enhancing the accuracy and relevancy of responses. For instance, my application, orygo.ai, is built utilizing Vector Stores.
API Connectors: Among these, Zapier stands out. It facilitates the LLM's interaction with other applications via their APIs.
Image Generators: Tools like DALLE-3 empower LLMs to generate and comprehend images.
9. Combine Techniques and Always Iterate and Improve :
In prompt engineering, much like in coding, writing, or startup building, adopt a lean approach. This philosophy is valid both for learning and mastering prompt engineering as well as for its practical application.
Start with concise yet well-defined prompts.
Evaluate the results and draw insights from them.
Continuously iterate and enhance your prompts. As you gain proficiency, integrate more advanced techniques. Engage actively with the LLM to achieve superior results and accomplish larger projects more efficiently.
Never stop studying because this field is growing very quickly. Master the science of prompting as best you can and share/teach others (well, this point has nothing to do with the lean approach; I just wanted to say it 💪)
While it might not always be feasible or necessary to employ every technique at your disposal, judiciously combining even just one or two can significantly elevate the quality of your outputs. View these principles as your foundational toolkit for effective prompt engineering, deploying each technique where it's most relevant and potent.
Alright, the guide is complete. Take a well-deserved 5-minute break and relax. In the meantime, if you're enjoying this guide, consider subscribing to this Substack or sharing it with your friends and colleagues. Your support means a lot to me and will help me improve these guides.
The next section will be a list of resources to deep dive extensively on the principles we have talked about until now.
Roadmap to master prompt engineering
Main Techniques
Zero-Shot Prompting
Finetuned language models are zero-shot learners: https://arxiv.org/pdf/2109.01652.pdf
Deep Reinforcement Learning from Human Preferences https://arxiv.org/pdf/1706.03741.pdf
Few-Shot Prompting
Language models are few-shot learners: https://arxiv.org/pdf/2005.14165.pdf
Role-Play prompting
Role-Play with Large Language Models https://arxiv.org/pdf/2305.16367.pdf
CAMEL Communicative Agents for “Mind” Exploration of Large Scale Language Model Society https://arxiv.org/pdf/2303.17760.pdf.
Unleashing Cognitive Synergy in Large Language Models: A Task-Solving Agent through Multi-Persona Self-Collaboration https://arxiv.org/pdf/2307.05300.pdf
Chain-of-Thought Prompting
Chain-of-thought prompting elicits reasoning in large language models: https://arxiv.org/pdf/2201.11903.pdf
Zero-shot Chain-of-Thought Prompting
Large language models are zero-shot reasoners: https://arxiv.org/pdf/2205.11916.pdf
Automatic chain of thought prompting in large language models: https://arxiv.org/pdf/2210.03493.pdf
Least to Most Prompting
Least-to-Most Prompting Enables Complex Reasoning in Large Language Models. https://arxiv.org/pdf/2205.10625.pdf
Self-Consistency / Self-Reflection
Self-consistency improves chain of though reasonsing in language models: https://arxiv.org/pdf/2203.11171.pdf
SELFCHECKGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Models: https://arxiv.org/pdf/2303.08896.pdf
Reflexion: Language Agents with Verbal Reinforcement Learning https://arxiv.org/pdf/2303.11366.pdf
Generated Knowledge Prompting
Generated Knowledge Prompting for Commonsense Reasoning: https://arxiv.org/pdf/2110.08387.pdf
Tree of Thoughts
Tree of Thoughts: Deliberate Problem Solving with Large Language Models https://arxiv.org/pdf/2305.10601.pdf + reference code here: https://github.com/princeton-nlp/tree-of-thought-llm
Large Language Model Guided Tree-of-Thought https://arxiv.org/pdf/2305.08291.pdf + reference code here: https://github.com/jieyilong/tree-of-thought-puzzle-solver
APE Automatic Prompt Engineer
Large Language Models Are Human-Level Prompt Engineers https://arxiv.org/pdf/2211.01910.pdf
AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts https://arxiv.org/pdf/2010.15980.pdf
Active Prompting
Active Prompting with Chain-of-Thought for Large Language Models https://arxiv.org/pdf/2302.12246.pdf
LLMs + Tools and external knowledge sources
RAG: Retrieval Augmented Generation
Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks: https://arxiv.org/pdf/2005.11401.pdf
MRKL Systems and ReAct Prompting
MRKL Systems: A modular, neuro-symbolic architecture that combines large language models, external knowledge sources and discrete reasoning https://arxiv.org/abs/2205.00445
LangChain MRKL Agents https://python.langchain.com/docs/modules/agents/how_to/mrkl
ReAct: Synergizing Reasoning and Acting in Language Models https://arxiv.org/abs/2210.03629
PAL: Program-aided Language Models
PAL: Program-aided Language Models https://arxiv.org/pdf/2211.10435.pdf
Automatic Reasoning and Tool-use
ART Automatic multi-step reasoning and tool-use for large language models https://arxiv.org/pdf/2303.09014.pdf
Prompt Tuning
Prompt Tuning
The Power of Scale for Parameter-Efficient Prompt Tuning https://arxiv.org/pdf/2104.08691.pdf
Prompt Waywardness: The Curious Case of Discretized Interpretation of Continuous Prompts https://arxiv.org/pdf/2112.08348.pdf
Specific prompt engineering documentation by LLM
Always review the LLM prompt engineering documentation to understand the specific design requirements and suggestions that LLM creators provide. While the core principles generally hold true, some specifications may vary from one LLM to another. For instance, the Anthropic model's API requires a unique ‘/n/nHuman: /n/nAssistant:’ format that is distinct from Claude models.
Anthropic: https://docs.anthropic.com/claude/docs/getting-started-with-claude
OpenAI: https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-openai-api
Cohere: https://docs.cohere.com/docs
Amazon Bedrock: https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-engineering-guidelines.html
Best courses and resources to dive on Prompt Engineering
Vanderbilt University on Coursera: Prompt Engineering for ChatGPT https://www.coursera.org/learn/prompt-engineering
DeepLearningAI: ChatGPT Prompt Engineering for Developers https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/1/introduction
FreeCodeCamp: Prompt Engineering Tutorial - Master ChatGPT and LLM Responses:
OpenAI Cookbook: https://github.com/openai/openai-cookbook
PromptingGuide.ai: https://www.promptingguide.ai/
LearnPrompting.org: https://learnprompting.org/
And that, guys, is everything you need to start your journey to master Prompt Engineering.
Thanks so much for reading! I really appreciate your time a great deal, and I hope in return you learned something new today.
If you did—and you enjoyed this guide — gave it a like, share, and if this was your first time reading, subscribe for more.
— Davide ✌️