Persona prompting

In a recent post on using ChatGPT, I covered four prompt patterns I’d used for a specific task. Today, I want to elaborate on one of them. The persona prompt pattern is enormously useful, and I’ll take a deeper look into how to use it.

What is it?

The persona pattern is named for what it does: it instructs ChatGPT to respond as a specific person or type of person. ChatGPT’s training data is vast. As a result, it can be difficult to get it to focus on what you want. The persona prompt channels ChatGPT to select the kinds of details it should focus on as it generates its output. Focusing the output also helps when you aren’t sure what type of output you want, but you do know the kind of person you might ask for those details. For example, you might not be sure what to describe at a murder scene, but you know that a homicide detective could tell you what’s important and what’s not.

Pattern Structure

The structure is simple: “Act as a {persona name},” replacing the curly bracket text with whatever you need. “Act as a homicide detective…” in the example above. Then you follow it with the body of the prompt. Here’s an example:

Act as a medical historian and outline the important events in 17th century Europe.

You’ll get information about the Great Plague of London, the development of microscopy, and advancement in understanding human anatomy, among other topics. Omitting the persona produces output that describes events pertaining to wars, politics, and arts in addition to mentioning the effects of the Great Plague.

You can also append a prompt with this structure. For example:

The protagonist in my novel is a gambling addict. What are some things she might do to hide her problem from her family? Respond as a behavioral psychologist.

The last statement executes the persona pattern.

Variation: Outputs

A variation on the Persona pattern can help you narrow your scope, especially if you’re not sure what you want. The variation looks like this: “Provide outputs that {persona} would create.” Here’s an example:

My character wants to help a struggling student improve her grades. Provide outputs that a teacher would suggest.

I’m not a teacher, so I might use this prompt to know what kinds of assignments, exercises, or other tools a teacher might provide to the student. Then I could focus on the ones that support your story.

Uses

You can use the persona pattern to support your writing in many ways. Here are some things I’ve done with it:

  • Research assistant. While working out what a fictional Florida city might look like, I didn’t know how to start. I prompted ChatGPT to answer as an Urban Anthropologist and tell me factors I ought to consider.
  • Sounding board. “I’m having trouble coming up with a red herring for a mystery novel. Ask me questions about my plot from the perspective of a mystery reader until you can suggest some options for me.” That combines the persona with another kind prompt pattern, flipped interaction. ChatGPT probed what I already had in the way of plot twists before suggesting options that got my thinking started again.
  • Character development. I’ve provided the LLM with some details of the character’s background and psychology and then asked it to respond to questions as that character. That has helped me generate new ideas to deepen backgrounds, suggest motivations, and dilemmas the character might face.

You can combine multiple personas to examine a question from different perspectives. In the city-building example, I didn’t stop at Urban Anthropology. I also asked about the city from the perspective of the 19th century robber baron who founded it, a 1970s civil rights activist, and a teen who lives there today. Those outputs gave me fresh ideas to pursue.

These three ideas only scratch the surface of what you can do with the persona prompt pattern. Try it out, and please leave a comment telling me how it worked out for you.

How I’m using ChatGPT, and how you can use it, too

Yesterday, I wrote about using ChatGPT as a sounding board to develop writing topics. I used this prompt:

Act as a conversation partner as I think through a topic. Your goal is to help me explore the topic and clarifying my thinking for something I might write about. Ask me one question at a time. After I respond, comment on what you think I mean and ask me if I want another question. Ask me for a topic.

Today, I’ll break down why I structured the prompt the way I did. If you’ve been wondering how to get started with ChatGPT, or tried it and gotten lackluster results, I hope seeing how I use it will help you find a good use for it.

General Principles

Before I dig into the individual components of the prompt, it’s important to understand a few general principles of working with ChatGPT.

First, be specific. The prompt above is focused on a single objective: to explore a topic that I provide. If I had been struggling to identify a topic, I’d have created a different prompt.

Second, give the tool a clear task. In my prompt, I tell the tool what its objective should be. One challenge people have when using ChatGPT is that they aren’t clear about the output they’re looking for and get results they can’t use.

Finally, remember that the tool is only as good as the data it has been trained on, and a lot of that data isn’t very good! ChatGPT doesn’t “know” things; it can only generate text that probably addresses the question it is being asked. It isn’t a search engine, and if you aren’t careful with what you ask it, it may generate bullshit answers. I once asked it what it knew about me as a writer of roleplaying game material. It constructed an elaborate bibliography of award-winning Dungeons & Dragons publications. Not only did I not write them, but none of them existed. So you have to be responsible for checking its output and making sure it’s good.

Prompt Patterns

User input to a Large Language Model (LLM) such as ChatGPT is called a prompt. Learning to create effective prompts is called prompt engineering. That subject is beyond the scope of this post, not to mention beyond my current ability to explain. What’s important is that part of prompt engineering is learning to use conversational shortcuts known as “prompt patterns.”

Prompt engineers have identified many prompt patterns and continue to identify new ones. I know of almost two dozen. But don’t worry! You only need a few to get started, and I’ll explain some of them in this post.

Prompt patterns can be used individually. They can also be combined to create more robust interactions. In the prompt I identified above, there are four: Persona, Flipped Interaction, Cognitive Verifier, and Tail Generation.

Persona

“Act as a conversation partner…”

In this phrase, I’m instructing ChatGPT to respond as if it is a particular kind of person. The Persona pattern restricts the output to what someone with the named background or skillset would know and how they would respond. Here, I want ChatGPT not to answer questions for me but to engage in back-and-forth with me as if it were a human and we were chatting over a cup of coffee.

Here are some other examples of using the Persona Pattern:

  • Responding as a dental technician, tell me what questions I should ask at my next cleaning about how I can improve my gum health.
  • I am going to have my kitchen remodeled. Acting as an architect, tell me factors to consider that I might not know about.
  • As a nutritionist, tell me what considerations I’ll need to make if I shift to a vegan diet.

In each prompt, I’m providing perspective to the tool to guide its output.

Flipped Interaction

“Your goal is to help me explore the topic and clarifying my thinking for something I might write about. Ask me one question at a time.”

This phrase shows a kind of prompt pattern called “flipped interaction.” The idea is to have ChatGPT ask you questions, rather than the other way around. It’s a great technique when you aren’t sure exactly what you want to ask and need to dial in your topic.

In this case, I’ve implied the flipped interaction rather than explicitly asked for it. ChatGPT understood my request probably due to the prompt being part of a larger conversation where I’d used the pattern already. You may find that you have to be more explicit in your instructions. For example, when I was needed to flesh out the fictional city for my current novel, Gulf City Blues, I use this prompt to start:

I am writing about a fictional city on the southern Gulf Coast of Florida. I don’t know what world-building factors to consider. Ask me questions about the kind of setting I want until you have enough information to make recommendations. Ask me one question at a time. Ask me the first question.

Those last two instructions aren’t always necessary, but I rarely omit them. Without the first of them, the tool usually spits out a long list of questions. That can be helpful if I want to see what its train of thought is but usually it’s a distraction. Without the final statement, sometimes the tool responds with enthusiasm that it would love to help me and then waits for me to nudge it again to start.

Try flipped interaction when you want ChatGPT to question you about a topic rather than questioning it.

Cognitive Verifier

“After I respond, comment on what you think I mean…”

This statement is a form of the Cognitive Verifier pattern. The intention is to help the LLM understand what you’re really looking for instead of answering the surface question with the easiest possible match. It’s sort of like talking to a trusted advisor who is willing to dig into your problem rather than give you a quick answer. In my case, if ChatGPT’s response had been off topic, it would allow me to rephrase my response.

Another way to phrase a prompt using Cognitive Verifier is:

Whenever I ask you a question, generate a number of additional questions that would help you generate a more accurate response.

Tail generation

“… and ask me if I want another question.”

Tail generation is a prompt pattern to remind ChatGPT of what you’re trying to do. That’s especially useful for long conversations, because ChatGPT starts to forget what you’re talking about after a while. By telling ChatGPT to ask me if I want another question, I’m making sure it will keep going until I’m satisfied with the output.

Other Prompt patterns

As I said above, there are dozens of prompt patterns, and data scientists continue to discover new ones. Some don’t have much use to me, but there are others that I use regularly. “Outline expander” helps you build and flesh out an outline. I’ve used it when I’m crafting new workshops. “Question refinement” instructs the LLM to suggest a better version of the question you’re asking, which often results in more useful output.

I encourage you to try the ones I’ve outlined here. Try them individually and in combinations. See what works for you and what doesn’t. Then explore other patterns. Generative AI isn’t a fad, although the hype surrounding it often makes it seem that way. It’s not going away. It’s a powerful tool waiting for you to learn to use it.

Does ChatGPT dream of electric lawyers?

Ken White, AKA “Popehat,” posted a screen shot on Bluesky last night of a ChatGPT conversation.

His prompt: What does Ken White think about RICO?

ChatGPT’s response:

“As of my last knowledge update in January 2022, Ken White… has not expressed a singular or uniform opinion…” followed by some general summary of varying opinions about RICO, and finishing with “To get the most accurate and up-to-date information on Ken White’s views on RICO…I recommend checking his recent writings…”

White’s comment was, “Still some bugs to work out.”

A screenshot of Ken White's Bluesky post, He has posted a screenshot of the conversation summarized above, with the comment, "Still some bugs to work out."

White is a lawyer with a very public and long record of commentary on RICO. It’s not surprising that he’d view the response as buggy. I had a similar reaction when I first experimented with ChatGPT. I asked it what it knew about me as a writer. It provided a list of my published works. None were real. I thought, how useless is this thing if it just makes things up?

That understandable reaction highlights a few common, interconnected misconceptions about ChatGPT:

  • That it is a search engine,
  • With access to all information (or at least on the Internet),
  • Therefore, its so-called hallucinations (AKA “making stuff up”) proves that it doesn’t work.

None of those misconceptions are true.

ChatGPT is not a search engine. It is not a tool for retrieving information, although sometimes it will work for that purpose. You may have seen an explanation that it generates its text via probabilities of words occurring near each other. There is much more to it, but that explanation is good enough for our purposes right now. When you prompt ChatGPT, it doesn’t retrieve information. It determines the most likely first word or phrase in a response, then the next word or phrase, and so on.

The quality of that output depends on the quality of its training data. The training data shapes its responses. Getting 100% reliable information is never going to happen because its training data isn’t 100% true.

OpenAI has been coy about the exact content of the training data, so there’s no way to know for sure what the tool has digested. But we do know that fiction is included. That’s thanks to some Google researchers who tricked it into divulging some of its training data. They found blocks of published novels in the output. So fiction can creep into responses.

Beyond that, some of its data consists of false information. When I ask it questions about Scrum, its responses draw on the Scrum Guide. They also draw on articles written by people who didn’t know what they were talking about. The Guide says that a Sprint is no more than one month. A lot of people have written that it is “two to four weeks.” ChatGPT doesn’t know that the latter statement is false, only that it has seen it made frequently.

Garbage In, Garbage Out

Furthermore, ChatGPT hasn’t been trained on all data, everywhere. It hasn’t even been trained on everything that’s available on the Internet. To return to Ken White’s example—was ChatGPT trained on all of his writing? On some? On none? We can only guess. Given the response, it’s probably a very small amount of “some.”

ChatGPT responses remind me of an extemporaneous speaking competition I participated in during high school. You’d be given a random object (one was an internal part of a vacuum cleaner) and a few minutes to gather your thoughts. Then you had to give a five-minute speech about some doodad you probably knew nothing about. The contest was judged on style, presence, and audience engagement. If the criteria had been, “Did the presenter give me accurate/useful information about the object,” no one could have won.

You can elicit valuable output from ChatGPT. It requires going beyond information retrieval and learning something about the art of prompt engineering. But that’s a topic for another time.

ChatGPT has limitations and drawbacks, and there are serious ethical considerations about what its training data contains. I’m not qualified to address that topic. But based on what I’ve learned so far, I know that it’s pointless to criticize ChatGPT because it fails at a task it isn’t designed to do.