Get the Most Out of AI Writing Tools With Prompt EngineeringBy Payal Dhar August 4th, 2022
As a science journalist, part of my job is to decode the jargon in scientific research papers to find the news underneath. As I’m not a scientist, this can be a brain-scrambling task. So recently, I jumped at the chance to take an artificial intelligence (AI) tool for a spin. After feeding it a research paper, I asked, “Can you summarize this paper?”
The first reply from the AI? “Yes, I can.”
Cheek from a machine is particularly hard to swallow, but it serves me right for not remembering that machines don’t understand context. To get anything noteworthy out of an AI writing app, figuring out what—and how—to ask is a crucial first step.
Numerous AI-based tools are available to assist writers these days—from analyzing, summarizing, optimizing, and transcribing, to actually churning out text. And some of these platforms do so with “mind-boggling fluency,” according to the New York Times. (Sometimes, they can also go spectacularly wrong, but that’s a different matter.)
Getting useful and coherent content out of these tools is more complicated than just pressing a button. It’s all about prompt engineering, which is essentially the technical term for “how to get an AI to do what you want.”
How AI-based content generators work
The specific type of AI that underpins content-generating applications is called natural language processing (NLP). It’s what helps us “build machines that understand and respond to text or voice data—and respond with text or speech of their own—in much the same way humans do,” according to IBM.
Though writers who use AI-based content generators don’t necessarily need to know what machine learning or deep learning is, Pete Herzog, a researcher at ISECOM who helped develop the AI assistant Urvin, said it helps to have a basic understanding of how these concepts work. “These AI tools are fed millions and millions of conversations, texts, and dialogue, and this builds their database of how they answer,” he explained. Popular AI engine GPT-3, for instance, which fuels apps like Jasper.ai (formerly Jarvis) and Rytr, is built around 175 billion parameters.
“If I talk about depression, an AI doesn’t know if I’m a materials engineer or a psychiatrist… or an economist.”
Herzog elaborated that when these tools reply to a question, they don’t actually know the answer—they’re simply providing an amalgamation of the predominant responses others have given to similar prompts. “They’re able to understand the question, or—and this is the real AI part—a variation of the question… and find the proper response, because somebody has asked it somewhere on the internet before,” he said.
This brings us back to the point that an AI doesn’t have context. “If I talk about depression, [an AI] doesn’t know if I’m a materials engineer or a psychiatrist… or an economist,” Herzog said. “It’s going to do better with a whole paragraph [as a prompt] versus just a sentence.” In other words, the more information you can give the AI, the better it can help you.
Understanding prompt engineering
Prompt engineering, noted Briana Brownell, a data scientist, author, and entrepreneur, involves figuring out how to formulate the first part of the text so that the AI can complete it.
“These tools work by reading what you have in your prompt, and then continuing on,” she said. “It uses that text as a prompt in order to figure out what to do next.”
If you give the AI an example or lead it toward what you need, it will work a lot better. “But there are unlimited ways you can do that,” Brownell said. “So practicing figuring out how to do so most effectively is really important.”
Examples of effective prompts
Prompt engineering takes trial and error—and you may need to get a little more clever or creative with your requests than you would with, say, a search engine. There are also a number of tricks for getting an AI to provide you with valuable intel, and these tend to vary from tool to tool. With some platforms, for instance, you may be able to use simple shorthand like “TLDR” after a chunk of text when you’re looking for a summary.
Brownell illustrated a couple of prompt formats to generate a summary of an article:
- My 10-year-old asked me what this passage meant: [text you want summarized], so I summarized it for her in a way that any second grader could understand.
- [Text you want summarized] TLDR
The more specific you are in your prompting, the better the results are likely to be. For example, I got two very different results with the following:
- Define red shift for graduate students
- Define red shift for primary school students
Similarly, to generate headlines or taglines, you might use the following prompts:
- Generate a headline for a blog post [your text]
- Generate a tagline for an advertising brochure [your text]
Don’t shy away from using the AI to generate actual copy. You can use prompts to nudge it in a specific direction, such as listing positives or negatives, writing a conclusion, and more:
- [Text you already wrote] They are confident that
- [Text you already wrote] On the other hand
- [Text you already wrote] To conclude
Finally, if you’re looking to drum up new ideas, you can enter some basics about the umbrella topic, and the AI might suggest a few more (I was pleasantly surprised by the results below):
- Ideas for blog post on blockchain:
There are, of course, any number of ways to approach prompt engineering. “You have to get to know [the tool] and spend some time with it—don’t just throw it away right away,” Herzog said. “And if you feel that it does what you want to do, then stick with [that approach] and keep working on it. If it doesn’t work for you, then move on.”Image by gmast3r