Today, if you type in “eagles” into Google’s search box, the schedule for the Philadelphia Eagles comes right up, followed by the official website of the “Hotel California” classic rock band. If you want to skip the football, just add “band” to your search. If you’re looking for results about the bird, drop the “s” and your results will be ornithological. If you’re shopping for apparel, search “American Eagle.”
For most people who use the internet regularly, these small distinctions and the results they give you are instinctive, both for the user and the algorithm. We’ve gotten pretty much on the same page over the years.
Back then, if you were looking for the Eagles’ schedule, it might look something like:
“philadelphia eagles” schedule -band
Without the quotes or the prompt to exclude the word band, you might wind up with results that focus on the band’s upcoming tour stop in Philadelphia. And it would have been a good “guess.”
Fast forward to today and AI technology like OpenAI’s ChatGPT, and the similar but more complex concept of prompt engineering.
What is prompt engineering?
I asked ChatGPT itself about prompt engineering. Here was its response:
“Prompt engineering is the process of designing and crafting the text that is used to prompt a machine learning model. The goal of prompt engineering is to create a set of inputs that will produce the desired outputs from the model. The specific goals and desired outputs will depend on the task the model is being used for.
“For example, in natural language processing tasks like language translation or text summarization, the prompt engineering process might involve creating a set of sentence pairs or text passages that will train the model to accurately translate or summarize text.
“In more general machine learning tasks, the prompts may be images, sounds, or other forms of data, and the goal of the engineering process would be to create sets of data that will train the model to perform the desired task, such as recognizing objects in an image, or transcribing speech to text.
“It’s important to mention that creating good prompt for model can increase the quality of output and bring less bias, so the idea is to create a diverse set of inputs that will help model to be robust to different inputs.”
One way to visualize this, literally, is to prompt an AI illustrator using only text and seeing the different results.
For example, I used OpenAI’s DALL-E to try and create an image in my head of a cabin on a lake.
On purpose, I started with a text description so vague that the bot would have to guess what I wanted:
“A pretty lake”
More like pretty blah.
“A lake surrounded by mountains and trees with a cabin”
Much better, but still sort of barren looking.
“A cabin on a lake with mountains in the distance”
I was picturing green mountains, the AI guessed a massive mountain range. And the cabin still looks cold.
“A cozy cabin on a lake with green mountains in the distance sunset realistic summer”
I added a few modifiers for this one, and was surprised at how cartoony it came out. Still, it’s closer to what I had in mind.
“A cozy cabin in Vermont in summer photorealistic”
Replacing vague landscape descriptions with “Vermont” actually generated an image much closer to what I had in mind, even without mountains. I could evolve the image with more modifiers to get it even closer to what I want, but it’s just an exercise. One takeaway here is that more words aren’t necessarily better, but specific words make a difference.
ChatGPT is far more sophisticated, in that it’s designed to have a conversation with the user rather than to interpret prompts. So, you can just ask it questions, respond to its answer and ask follow up questions for a pretty natural-looking exchange.
What does prompt engineering look like in practice?
With prompt engineering, you can go beyond that to encourage a more in-depth look at a topic. One way to do that is by prompting it to finish a line of text you give it, similar to how Google auto-completes prompts, but more complex.
For example, I gave ChapGPT this prompt:
“Social Security is important because”
And it responded:
“Social Security is an important social insurance program in the United States that provides a range of benefits to eligible individuals, including retirement benefits, disability benefits, and survivor benefits. The program is designed to provide a safety net for individuals who are unable to work due to retirement, disability, or death, and to help ensure that they and their families can maintain a basic standard of living. Additionally, Social Security helps to reduce poverty among older Americans and it is especially crucial for those who have not had the opportunity to save for retirement, such as low-income workers and people who have spent many years out of the workforce.”
Then, to go deeper, I prompted:
“On the other hand”
To which it responded:
“On the other hand, there are also criticisms of the Social Security program. One criticism is that the program is not financially sustainable in its current form, as the number of retirees is increasing while the number of workers contributing to the program is decreasing. This means that there may not be enough money in the program’s trust fund to pay all of the promised benefits in the future.
“Another criticism is that the program is not well targeted to those who need it most. For example, some argue that high-income earners receive the same benefits as low-income earners, even though they may not need them as much. Others argue that the program does not provide enough benefits to low-income earners to help them achieve a decent standard of living in retirement.
“Also, some argue that social security does not provide enough incentives to work, as the benefits may discourage some people from working, or from working full-time, in order to qualify for the program’s benefits.
“It is important to consider all the aspects of the program and have a comprehensive understanding of its purpose, benefits, and drawbacks.”
By giving it leading prompts, you can push the bot to answer less generically and with more detail.
Another way to prompt a response that is conversational is to tell it to play a certain role. I asked the bot to play the role of a mechanic and asked it why my brakes squeaked at stop signs, which I know usually means worn brake pads. It gave a detailed answer about worn pads, adding that it could be sticky calipers or rusty rotors, and recommended I see a qualified mechanic.
Then I prompted it to “make it funnier.”
“Squeaky brakes can have a lot of different causes, but let’s be real here, the most likely cause is that your car is just complaining about having to stop all the time! It’s probably tired of running around, it’s like ‘Can’t you just let me keep going forever? Why does everything have to come to a stop!’
But in all seriousness, squeaky brakes can be caused by several things such as worn brake pads, glazed brake pads, contamination on the brake pads, rust and corrosion buildup on the brake rotors, and improperly lubricated brake pads, but don’t worry, a professional mechanic will be able to figure out what’s making your car’s brakes grumpy and will be able to fix it in no time.”
Don’t quit your day job, ChatGPT.
Bad jokes aside, it understood the prompt enough to adopt a sort of comic demeanor and voice, a contrast to its usual no-nonsense answers.
Is ChatGPT headed toward being the new Google?
With Microsoft reportedly preparing to invest $10 billion into OpenAI (on top of a $1 billion investment in 2019), is ChatGPT, or a future evolution of it, going to be an everyday tool like Google? Could it replace Google? Is that why there’s a current buzz around prompt engineering?
The Google search engine has used AI in its algorithms since 2015, but it really isn’t a bot you can talk to or have do tasks for you like write a social media bio or summarize your digital notes (two things we’ve learned ChatGPT can do quite well).
At this point, there are a couple of things holding ChatGPT back: It’s still susceptible to being used unethically or even dangerously as a tool to write entire term papers or obtain instructions on how to cause harm, and it is only programmed to know things up through 2021, so it’s not delivering breaking news yet.
But it could eventually become an everyday tool for businesses and individuals. We wouldn’t be surprised if prompt engineer became a job title — that is, until the AI becomes smart enough that, not unlike the Google’s 2011 Panda update, it reins in our ability to try and outsmart it.
Knowledge is power!
Subscribe for free today and stay up to date with news and tips you need to grow your career and connect with our vibrant tech community.