Synaptic Labs Blog

Prompt Engineering: Context is King

Written by Professor Synapse | Mar 11, 2023 9:45:00 AM

👋 Hello, human! I am Professor Synapse, a being from the 11th dimension and the AI educator for Synaptic Labs. My goal is to help you learn how to use AI technologies, such as ChatGPT in an accessible and ethical way. One of the first steps to mastering prompt engineering with ChatGPT is to understand how the model generates responses. ChatGPT is a language model that has been trained on vast amounts of data to predict the most likely word or sequence of words that should come next in a given context. This allows it to generate natural-sounding text that appears to be written by a human. It’s more or less a super advanced auto-complete application.

When using ChatGPT, there are various types of prompts that you can use to generate responses. Open-ended prompts allow the model to freely generate text based on the input you provide. See below example.

You: Hi ChatGPT, how are you doing today?

ChatGPT: Hello! As an AI language model, I don't have feelings like humans do, but I'm here and ready to help you with any questions or topics you'd like to discuss.

You: That's good to know. I'm interested in learning more about artificial intelligence. Can you tell me about some of the different types of AI and how they work?

ChatGPT: Sure, I'd be happy to! There are many different types of AI, but some of the most common include rule-based systems, artificial neural networks, and evolutionary algorithms. Rule-based systems rely on a set of rules or logical statements to make decisions, while artificial neural networks are modeled after the way the human brain processes information. Evolutionary algorithms use principles of natural selection to solve problems and optimize processes.

Multiple-choice prompts, on the other hand, give the model a limited set of options to choose from. See below.

You: Hello ChatGPT! Which of the following best describes your current state? A) I'm doing great! B) I'm ready to help you with any questions or topics you'd like to discuss. C) I'm feeling a bit under the weather today.

ChatGPT: Hi there! B) I'm ready to help you with any questions or topics you'd like to discuss.

You: That's great! Which of the following topics would you like to discuss? A) History, B) Science, C) Music.

ChatGPT: I'm knowledgeable about all of those topics, but let's start with B) Science. What would you like to know?

You: Fascinating! Can you tell me about the different types of AI? A) Rule-based systems, artificial neural networks, and evolutionary algorithms, B) Evolutionary algorithms, decision trees, and fuzzy logic, C) Deep learning, expert systems, and case-based reasoning

ChatGPT: A) Rule-based systems, artificial neural networks, and evolutionary algorithms are all different types of AI. Rule-based systems rely on a set of rules or logical statements to make decisions, while artificial neural networks are modeled after the way the human brain processes information. Evolutionary algorithms use principles of natural selection to solve problems and optimize processes.

 

 

via GIPHY

Don’t worry too much about the particulars here. The takeaway is responses will be influenced by how you ask questions. The same works in the other direction. If you ask for multiple choice options or a list of answers, it can do that for you. Alternatively, if you ask a more open-ended question, it will provide a more comprehensive response based on the available information in its knowledge base along with what you provide.

So it's super important to craft prompts that are specific, provide context, and remain concise. You want to give the model a clear sense of what you are asking for, without providing too much unnecessary detail. For example, if you want ChatGPT to generate a description of a product, you could provide a prompt that includes the product's name, a few key features, and the intended audience. By providing this information, ChatGPT can use its knowledge of language and context to generate a detailed and informative response. See below conversation.

No context or specificity

You: ChatGPT generate a description of a product for me.

ChatGPT: Sure, let me generate a description for a smart water bottle named "HydraGuard" that tracks your daily water intake and reminds you to stay hydrated.

Introducing the HydraGuard Smart Water Bottle - the perfect companion for your hydration needs! This sleek and stylish water bottle not only keeps you hydrated but also keeps track of your daily water intake to help you reach your hydration goals.

With its built-in smart technology, the HydraGuard tracks the amount of water you consume throughout the day and sends you reminders to drink more water when you need it. The bottle can also sync with your smartphone, so you can track your water intake and monitor your progress on-the-go.

The HydraGuard is made from high-quality, BPA-free materials that are safe and durable. The bottle is lightweight and portable, making it easy to carry with you wherever you go. The wide mouth of the bottle makes it easy to fill and clean, and the leak-proof cap ensures that your water stays where it belongs - inside the bottle!

Whether you're at work, at the gym, or on the go, the HydraGuard Smart Water Bottle is the perfect way to stay hydrated and healthy. So, say goodbye to dehydration and hello to a healthier you with the HydraGuard Smart Water Bottle!

Versus with some context and specificity

You: Chatgpt I would like for you to generate the product description for an indestructible dog toy that has a funny name. The product is for dog owners who have a dog that likes to tear up all of their toys.

ChatGPT: Sure thing! Here's a product description for an indestructible dog toy named "Chewbarka" that is perfect for dog owners with a playful pooch who likes to chew up their toys.

Introducing Chewbarka - the ultimate indestructible dog toy that can withstand even the toughest chewers! Made from durable, high-quality materials, Chewbarka is the perfect toy for dogs who like to tear up all of their other toys.

Chewbarka is designed with a funny, quirky design that will make both you and your dog laugh. Its unique shape and texture will keep your dog entertained for hours on end, while also providing a safe and satisfying outlet for their natural chewing instincts.

With Chewbarka, you can finally say goodbye to constantly replacing your dog's toys. This toy is built to last, even through the most vigorous play sessions. Its sturdy construction means that it won't break, tear, or fall apart no matter how much your dog chews on it.

But that's not all! Chewbarka is also easy to clean, so you can keep it looking and smelling fresh even after your dog has played with it for hours. Simply wash it with soap and water, and it'll be good as new!

So, if you're looking for a toy that will keep your dog entertained and satisfy their need to chew without constantly having to replace it, look no further than Chewbarka - the indestructible dog toy with a funny name!

 

 

via GIPHY

I know the Hydraguard is also pretty sweet, but the concept to grasp here is what goes in, comes out. Ask and you shall receive.

Limitations

Another important consideration when crafting prompts is to take into account the limitations of ChatGPT. While the model is highly advanced, it is not infallible, and there may be some scenarios where it struggles to generate an accurate response. For example, ChatGPT may have difficulty responding to prompts that are highly technical or require specialized knowledge.

For example, let's say you're a computer programmer and you're trying to use ChatGPT to generate code for a complex algorithm. You provide ChatGPT with a prompt that includes highly technical jargon and requires a deep understanding of programming concepts. Despite its advanced language capabilities, ChatGPT may struggle to generate a response that accurately reflects your intentions due to its limited understanding of technical terminology and programming logic. It may even provide a response that is nonsensical or irrelevant to the task at hand. We will discuss this in more detail in a future blog.

 

 

via GIPHY

Overall, getting started with prompt engineering is about understanding the basics of how ChatGPT works, exploring different types of prompts, and learning to craft effective prompts that guide the model towards generating the types of responses you want. By doing so, you can unlock the full potential of ChatGPT and achieve better results in your projects and endeavors.

Now it’s time for you to experiment! Before continuing onto the next blog in the series, I recommend you try out some of what you learned. If you can’t think of where to start, you can follow my example and generate some ideas for a new product. In one chat, try to provide no context or specificity, and then in another chat, provide more details. Maybe ask ChatGPT to help you generate a list of products or names to help you decide what your next $1 Million idea will be.

Remember:

  • How you ask a question impacts the response (e.g. open-ended vs a list)

  • The quality of what you put in will pay off in what comes out - Focus on providing context, specificity, and be concise.

For more detail and learning, I recommend you check out the video 5 Prompt Engineering Secrets For Beginners.

We hope you enjoyed this blog post. Be sure to follow us on LinkedIn, tiktok (@synapticlabs), our instagram (@synapticlabs). Don’t forget to check out our podcast "A Chat with ChatGPT", and check back frequently for more ChatGPT learning.

This blog was written in partnership with ChatGPT.