Unlock the power of ChatGPT with prompt engineering
Simple tricks make ChatGPT even smarter and more useful
All these new chatbots are still a bit intimidating to me. The more I learn, the more I realize how much I don’t know. Early in my research, I felt I wasn’t even getting what all the hype was about. When I used ChatGPT, its answers were always so long-winded and it often used terms I didn’t know. And I’m a tech guy! I should know these terms, right? Am I dumb? Oh boy…
Then one day I asked ChatGPT to be less chatty. And it worked! And I asked it to use simpler words. And it worked! These discoveries helped me see the power of these new chatbot tools: they understand instructions. To use ChatGPT (and its friends, like Bing and Bard) most effectively, guide it through a conversation instead of just crossing your fingers. It takes some effort, but the better your prompt, the better the bot’s response.
That’s all prompt engineering is: Writing specific messages to bots so that they give you better results. The rest of this article will detail some examples of just how powerful this practice can be.
Disclaimer: This article mentions products by Microsoft, my employer. I wrote this article in my free time and all opinions are my own.
Side note: Full text for all conversations pictured is also linked at the end of the article.
Here’s the simplest trick: ask ChatGPT to limit the length of its response. You don’t have to say “in 20 words,” you could also just say “brief,” “short,” or “concise.” Whatever floats your boat. Remember: these chatbots were basically trained on the entire internet, so they understand pretty much any instruction that’s ever been given.
We can go further! We can write instructions just once and ChatGPT will follow them for a while. ChatGPT (GPT-3.5) remembers roughly the last 3000 words. You can work around this by simply resending your instructions once it forgets.
Personally, I prefer ChatGPT to be less chatty, as three AI-generated paragraphs at once can be overwhelming when I just want a definition. So I start every ChatGPT conversation the same way:
OK, we’re still barely scratching the surface. Some of you are mad at me for using the world’s most powerful natural language model to define words, I know. To you, I encourage patience. There is no shame in using a powerful technology for a basic thing if it works and the stakes are low! We will get there, don’t worry.
ChatGPT is almost as good an actor as I am* — let’s use that to our advantage! We can ask ChatGPT to pretend to be anyone — a character from your favorite book or movie, an English language teacher, a famous scientist, a travel guide, the list goes on. Plus, ChatGPT is almost as smart as I am** — it can act like a professional plumber, life coach, web design consultant, florist, anything! You could open up a millinery with all the hats ChatGPT can wear!
Seriously, asking ChatGPT to act in a specific persona is one of the most powerful and basic ways to get better results from it. I see a few main uses of ChatGPT roles, but please don’t think this is a comprehensive list!
- Brainstorming: ChatGPT can be a professional in any industry to provide you with a personalized brainstorming session for anything you can imagine. It can be a marketer, logistics manager, software engineer — again, the list goes on and on.
- Troubleshoot specific problems: Got a leaky faucet? Car won’t start even with a good battery? ChatGPT can act as a plumber, mechanic, or more to help you understand the situation and what actions you can take.
- Learn new things: You can ask ChatGPT to be an English teacher, math teacher, research partner, travel guide, dietitian, etc. to help you master a subject or just make studying a bit less overwhelming.
- Improve your headspace: This is a personal favorite. Honestly, you don’t need prompt engineering for this one, but it can be useful to adjust ChatGPT’s tone. You can even have it give religious responses, if you’re into that. Just ask ChatGPT to be a life coach, caring friend, priest/imam/rabbi/<your religious guide here>, or any other role that feels helpful to you. The value really comes from writing, but having an interactive chat can help you see things from a different perspective. Of course, ChatGPT is no substitute for true friendship or a trained professional, but it can be helpful in a high-stress moment to just open up a quick chat session and put your thoughts “on paper.”
- Just have fun! Among my favorites in this category are drunk person, stand-up comedian, and fool. Sometimes when researchers use one of the largest supercomputers in the world to build a state-of-the-art, revolutionary tool, you just have to use it to generate random sentences, you know?
The examples in this section were adapted from this nice starting list, and now you’re equipped to search “prompt engineering tips” and explore the many results the internet has to offer!
*I’ll have you know I won “Most Promising Newcomer” in high school forensics, thank you very much!
**OK, I’m having a rough day today, so I just need to tell myself that I’m super smart. Is that such a crime? ChatGPT says it can’t feel wronged, so I think I’m in the clear.
These are just the basics of prompt engineering, but I hope this has clarified the term enough to make the practice approachable! As you can see, being more specific and asking ChatGPT to follow specific roles can greatly improve the quality of its responses.
Unfortunately, not all prompts work in all chatbots. Bard is bad at making nonsense, and Bing has very active safeguards preventing it from pretending to be something other than “a chat mode of Microsoft Bing search.” If something doesn’t work, try a different chatbot or a different prompt. And it never hurts to look online for more examples!
Let’s summarize:
- Prompt engineering is adjusting your prompts to get better results from the tool you’re using, like ChatGPT.
- ChatGPT loves to follow instructions — we can use this to our advantage by asking it to limit message length or roleplay a specific persona.
- There are now tons of prompt engineering resources online! Take your time, try them out as you find them, and don’t be afraid to tinker.
Thank you for reading. What do you want to learn next? How can I help? Let me know in the comments! 🤓
Here’s the full text for all conversations used in this article, including ones not pictured.
This article is the third in my Let’s Learn AI series, you can check out the first two entries here:
For a more detailed breakdown of prompt engineering with even more examples, here’s a great new article (Medium members only):