Writing Dialog with ChatGPT

David J. Germain
8 min readFeb 18, 2023

--

Using Elmore Leonard to Inspire Characterization

“Yellow Chamber” by David J. Germain with Midjourney V4

Introduction

In my two previous articles, I focused on using ChatGPT for descriptive fiction writing (Iain M. Banks), as well as physical writing (Joe Abercrombie). In this piece, I will shift focus to characterization through dialog.

Rather than use ChatGPT’s standard dialog, or tell it to write “in the style of” another writer, I’ll analyze some of Elmore Leonard’s excellent dialog using ChatGPT, then use that analysis to inspire better “colloquial characterization.”

Typical ChatGPT Dialog

Let’s use ChatGPT to write some vanilla dialog:

Two people, Karen and Jack, are locked in the trunk of a car. Jack’s friend is driving and Karen wants to get out. Karen is a police officer. Jack is a bank robber. Write dialog.

Here’s the horrendous result:

Karen: “Jack, we need to find a way to get out of here. I’m a police officer and I need to call for backup.”

Jack: “What do you want me to do about it? I’m just a bank robber, remember?”

Karen: “We need to work together. Is there any way to escape from the trunk of this car?”

Jack: “I think there’s a release lever inside the trunk. Let me take a look.”

Karen: “Be careful. If the driver realizes what we’re doing, they may stop the car.”

Jack: “Found it! Here, let me try to pull it.” (pulls lever)

Karen: “Great, it worked. Let’s get out of here and call for backup.”

ChatGPT, left to its own devices, is winning no Booker awards. It writes very on-the-nose dialog (“I’m a police officer…”) with no difference between the two voices.

“Trunk of a Car #1” by David J. Germain with Midjourney V4

Selection from Elmore Leonard

Now let’s look at some Elmore Leonard dialog from his excellent novel, Out of Sight. At this point in the story, Karen Sisco, a law enforcement agent, is locked in the trunk of her car with Jack Foley, an escaped bank robber.

His voice in the dark, breathing on her, said, “You comfy?”

The con acting cool, nothing to lose. Karen was holding the Sig Sauer between her thighs, protecting it, her skirt hiked up around her hips.

She said, “If I could have a little more room.”

“There isn’t any.”

She wondered if she could get her feet against the front wall, push off hard and twist at the same time and shove the gun into him. Maybe. But then what? She said, “I’m not much of a hostage if no one knows I’m here.”

She felt his hand move over her shoulder and down her arm. “You aren’t a hostage, you’re my zoo-zoo, my treat after five months of servitude. Somebody pleasant and smells good for a change. I’m sorry if I smell like a sewer, it’s the muck I had to crawl through, all that decayed matter.”

She felt him moving, squirming around to get comfortable.

“You sure have a lot of shit in here. What’s all this stuff? Handcuffs, chains … What’s this can?”

“For your breath,” Karen said. “You could use it. Squirt some in your mouth.”

“You devil, it’s Mace, huh? What’ve you got here, a billy? Use it on poor unfortunate offenders … Where’s your gun, your pistol?”

-Out of Sight, Elmore Leonard

The dialog is punchy and full of character. What makes Leonard’s dialog so much better than vanilla ChatGPT?

“Trunk of a Car #2” by David J. Germain with Midjourney V4

Analyzing the Selection

Let’s ask ChatGPT. I’ve analyzed dialog before and found that its difficult to get useful results from some analysis. This time, I started by asking ChatGPT for a general approach to analyzing dialog. Here’s the prompt:

What are some important things to consider when analyzing dialog in fiction?

It answered by listing a series of concepts, some of which I hadn’t considered before. For instance:

Register… the level of formality or informality in the language used…

Speech Acts…the functions of language, such as making requests, giving commands, making apologies…

Discourse Markers…words or phrases that signal the flow of conversation…

I then incorporated these into a large prompt that I run against several samples of Elmore Leonard dialog. Here’s the first prompt I used:

You are an expert in discourse analysis and natural language processing (NLP). You’ve been teaching dialog writing for over 20 years. Analyze [Sight Sample] with an emphasis on the dialog. Discuss dialog sentence length, parts of speech, and number of declarative vs questions. Analyze the dialog, with an emphasis on Word choice, Grammatical structures, Register, Speech Acts, Discourse Markers, and Prosody. Discuss how these differ from typical fiction dialog. Make sure to compare sentence fragments vs complete sentences, questions vs declaratives vs instructions, and dialog tags.

This was very useful because the responses were often organized into a list of topics. Since I ran the analysis against multiple samples, I used these lists to match up similar topics.

Here’s the second prompt, which gave me a second opinion on the same topic:

If you were to instruct an AI to write dialog in this way, what instructions would you give? Provide your answer as if you’re speaking directly to another AI.

“Space Explorers Talking” by David J. Germain with Midjourney V4

Using the output analysis, I came up with the following dialog paragraph:

Use an informal and colloquial register with a conversational tone.

Most sentences are short and concise, around 4–5 words in length. A few sentences may be 10–15 words, with 1–3 clauses. Use a balance of complete sentences and sentence fragments. Use simple grammatical structures, with mostly simple and compound sentences. Use a mix of declaratives, questions, and exclamations, with an emphasis on declaratives.

Use simple and straightforward vocabulary, with many colloquial and informal expressions that are commonly used in everyday speech. Make use of second person pronouns and contractions to create a sense of intimacy and informality. Avoid formal words and phrases and avoid technical jargon. Avoid polished, scripted dialogue. Avoid most adverbs and conjunctions. Include discourse markers to signal the transition from one utterance to the next and to indicate the speaker’s attitude towards what is being said.

Overall, the dialog is Informal, conversational, natural, and spontaneous, with a sense of immediacy.

One of the words that came up often in the analysis was “colloquial,” and this will factor into the next section.

Using the Elmore Leonard Selection

This time, I wasn’t really sure what my dialog was going to be about, so I gave the AI a fairly open-ended initial prompt. Ultimately, I want to use this dialog to build a sci-fi short story, but at this point, I don’t want the “sci-fi” element to misalign the AI, so I don’t mention it:

Tony is a young Italian-American from New York. Bob is in his late fifties and grew up on a farm in south Texas. Two workers, Tony and Bob, argue about who’s turn it is to enter the next chamber. Tony insists that he entered more chambers yesterday. Bob doesn’t remember it that way. Write a dialog between the two. Use an informal and colloquial register with a conversational tone…Overall, the dialog is Informal, conversational, natural, and spontaneous, with a sense of immediacy.

“Opening the Chamber Door” by David J. Germain with Midjourney V4

I included my entire Dialog Instruction paragraph at the end of the prompt.

Notice that I gave the two characters demographic information that might not apply to a sci-fi story. I’m trying to supply the AI with a basis for its colloquial instruction.

I improvised a fair bit, asking the AI to rewrite bits and pieces. When the AI introduced a third character, Boss. Because Bob and Boss sound too similar, I changed his name to Officer, and I gave him some demographic information as well:

Officer is a young British officer, proud of his bravery. As he enters the chamber, the other two men follow. Officer lectures the men on their poor ethics and performance. Write Dialog. Use an informal and colloquial register with a conversational tone

At this point, I haven’t specified what the “chambers” will be or any of the sci-fi elements that might accompany the story. Instead, I allowed the AI to flush out the characters through their dialog.

The Results

“Station Window,” by David J. Germain with Midjourney V4

Here are the results of the first two dialog chunks:

Bob: Hold up. I don’t remember it that way.

Tony: I’m telling ya, Bob. I went in three chambers, you only went in two.

Bob: I went in three, Tony.

Tony: I’m telling you, it’s your turn.

Bob: I’m telling you, it’s not.

Tony: (frustrated) Look, I don’t want to argue about this. Just go in the damn chamber.

Bob: (defensive) Why should I? You go in.

Officer: (interrupting) What’s the problem, gentlemen?

Tony: (pointing at Bob) He doesn’t want to go in.

Bob: (pointing at Tony) He doesn’t either.

Officer: (lecturing) Listen up, you two. I’m tired of this constant bickering. It’s unprofessional and it’s dangerous. We’re supposed to be a team.

Tony: (defensive) Hey, we’re just trying to figure out who’s turn it is.

Officer: (firm) I shouldn’t have to keep track. You two should be able to handle this yourselves. It’s basic ethics, gentlemen.

Tony: (skeptical) Ethics?

Bob: (skeptical) Right…

Officer: (determined) Yes, ethics. And bravery. I expect better from you two. I enter these chambers with pride, not fear. I expect the same from my team.

Conclusion

This dialog analysis process taught me a few key takeaways.

First, asking the AI how it would analyze a type of writing was helpful. I could incorporate its analysis suggestions into my analysis prompt.

Second, if I ask the AI to write colloquial dialog, I need to provide demographic data, and regularly remind the AI of this colloquial information.

Third, certain voices are easier to differentiate. Bob and Tony quickly blended together, while Officer was easy to differentiate, even without dialog tags.

In my next article, I’ll provide another example of a ChatGPT short story as I finish this off. I’ll use Iain M. Banks descriptions, Joe Abercrombie physicality, and Elmore Leonard Dialog.

“Enter the Chamber” by David J. Germain with Midjourney V4

--

--

David J. Germain

David J. Germain is a writer, teacher, and AI researcher based in Taipei. Topics include Natural Language Processing, Fiction Writing, and their intersection.