GPT-3 for Writing Dialog

David Shapiro · Beginner ·🧠 Large Language Models ·4y ago

Key Takeaways

The video demonstrates the use of GPT-3 for generating dialogue between characters, with a focus on fine-tuning and prompt engineering to control the conversation flow and tone. Tools such as GPT-3, Instruct Beta, and Vinci are used to showcase the capabilities and limitations of LLMs in dialogue generation.

Full Transcript

hey everyone david shapiro here with a video um on using gpt3 to create uh fiction so here are just a few tips and tricks that i use to uh to generate you know dialogue or whatever so first is the brainstorm brainstorm some ideas for a funny scene between let's use characters that uh gpt3 is going to know between spider-man and mary jane and then i'll just go ahead and give it a dash so the purpose of this dash is to tell it to do a list whoops then ctrl enter okay so let's see um it likes uh if you so um first thing if you use imperative verbs like brainstorm or imagine um gpt3 does really well with that um so it is really helpful to open with an imperative uh thing not just write right because you know write or create or generate that's where i started but if you can be more specific you'll get better results so i want it to brainstorm that's the behavior i want alright so it says spiderman and mary jane are sitting in a cafe spider-man is trying to read a book but keeps getting interrupted by people coming up to him and asking for pictures mary jane is trying to talk to him but he's not paying attention that's kind of mean um spider-man and mary jane are at a fancy restaurant mary jane is trying to eat her food but spider-man keeps stealing her food off her plate i can imagine him doing that with a spider silk um also he's unironically dressed as spider-man in public spider-man and mary jane are in bed but he won't stop talking okay that's kind of lame spider-man and mary jane are at a park is right mary jane is trying to read a book but spider-man keeps climbing on her and hanging off of her spiderman i'm not a lamppost okay so you also see this where there's no space this is another aberration so let me take a screenshot of that so i can send it off to the gpt3 folks because they want to see this kind of stuff this is one of those weird things okay so let's grab one of these i think that this last one is the most absurd so let's grab that one and i'll say uh let's see um imagine a scene let's see imagine the following scene right the screenplay uh dialogue for this scene scene okay um be creative so then we'll just prompt it to start with spider-man and we'll hit go see what it does okay so it says hey mj what are you reading mary jane just a book what kind of book a romance novel ooh can i read it with you no spider-man this is my alone time but i'm lonely go swing on some web or something but i don't want to well i'm sorry but you're just gonna have to find something else to do fine okay so let's see he was clingy but not climbing on her hanging off of her that's okay so let's restart this let me show you how temperature might affect this let's see what happens if we turn up the temperature [Laughter] okay makes him sound like a little kid come on mary jane play with me spider-man i'm trying to read but i'm bored well why don't you go swing on the swing or something okay um so we're still not quite getting what we want right um because that behavior that it brainstormed of like climbing on someone is really difficult so here's another thing that i do i will often use the next line as a stop so spider-man and mary jane so we'll use those as stops um so let's see so hey mj what you're reading and so then we'll just manually type it in mary jane see what she says just a book spider-man i'm wondering why why it doesn't call her call him peter parker okay we'll say we'll change this to peter let's see spider-man uses webs to um yank the book away um mary jane let's see what she says to this hey give that back spider-man only for a kiss okay so he's being he's being trying to be sweet that's that's what's emerging from this scene no way spider-man i'm not kissing and so it also does this thing where um you see how it like adds a few new lines even though it's supposed to be continuing this i'm not sure why it does that no way spider-man i'm not kissing you let's see pouting oh why not and also sorry i keep bumping the microphone let me move it just a little bit there we go okay he climbs on her back like a spider [Laughter] get off me you're so annoying okay so now let's from since we've since we've given it something to go off of usually gpt3 can cue off of something if you've already got it started so let's just go ahead and see where it cut where it goes with this looks sullen okay um well this ended up being very very wholesome i'm not sure if i agree with this i mean sure it's uh you know it's it's nice that they they reconciled very quickly [Music] let's let's change this a little um so let's add something to the prompt the scene escalates into a f uh let's say argument because argument is a safer word than fight it's also more specific so again you got to be specific because if you say it escalates to a fight you and i might know that like okay that means a couple's argument or a couple's quarrel but because it's spider-man gpt-3 might be like oh he starts beating up mary jane and of course that's not safe um did i misspell argument and argument there we go escalates into an argument so let's just change this one thing and see how that changes the outcome slaps him yeah so you see how like it uh you know it's okay with violence um so even just saying it escalates into an argument but it drastically changed the outcome you love it he leans in to kiss her she slaps him leave me alone um okay so instead of saying it escalates into an argument let's say it escalates into a comical misunderstanding let's see how that goes okay this is this is so painfully cringe um but i'm just showing you like how modifying one little thing at a time will uh we'll do this okay so let's go back let's leave the same prompt but let's change the engine so let's go back to um davinci instruct beta so da vinci instruct beta was before it was more aligned so it is instruct beta tends to be a little bit more creative although sometimes it goes off the rails so let's see what happens on instruct beta am i too short okay it's just it runs on and on and on okay so you see here it's being like why don't you want to kiss me am i too short that's more creative so they've they've actually like trained out a lot of the creativity of the latest instruct series so if you need to be more creative i find that going back to instruct beta or even vinci the original one you'll get a lot more creativity you're just not my type so that's like okay that's really different spider-man looks puzzled am i i'm i'm your type mary jane laughs peter us becoming friends that's my type oh he just got friend zoned okay and so then it kind of restarts the scene this is one problem with some of the older models is that they're still they're still liable to go off the rails um but it basically like reinvent reinvented the scene um so we can just delete that uh okay so i think we've i think we've taken this to its logical conclusion spider-man and mary jane are known characters but what if you want to invent new characters okay so let's say let's say this is the dialogue for a video game um the player is a lone ranger type in the american wild west in 1840 the player has entered a frontier town called podunk the player has walked up to the town sheriff and is looking for quests the sheriff knows that there are bandits hidden out in a ravine but doesn't trust the player yet the player must earn the sheriff's trust through doing side quests and smooth dialogue um one second okay um sorry i had to let my dog in um okay the player must earn the sheriff's trust through doing side quests and smooth dialogue the sheriff has a lazy eye that he's really insecure about okay so player um are you the sheriff around here and let's add those stops because basically what we're going to do is simulate a dialogue tree that would happen in a video game so we actually want it to generate one thing at a time and then i as the player quote unquote will um will uh we'll fill in dialogue okay so player and we'll also do sheriff um just so that it does one thing at a time all right sheriff he says yep that's me sounds good enough player um got any work for a uh for a random cowboy sheriff let's see what the sheriff says to that yeah i got two quests for you as it turns out well that was easy um okay well that was easy what you got sheriff the bandits bother our cattle all the time and i want them gone so you should pay them a visit so that's pretty cool it obviously was not quite able to handle um the trust part um but let's see if it can remember let's see player what's up with your hi dude sheriff [Laughter] okay let's see what is with your eye let's try that again oh that might be why the temperature is too high so let's turn the temperature down just a little bit um what your eye are you looking at me or the mountains sheriff i can't tell anymore okay so this has gone a little too far and gpt3 has kind of lost the plot so to speak um okay let's do an experiment let's go to an older da vinci to see if it can figure out what's going on here one day i'll tell you all about it this sheriff is very very willing to talk um okay so one thing is that the older davinci um is it does okay as long as there's enough of a of a prompt um like a few shot prompt so that it understands the pattern and so here it sees that there's a dialogue going on so even original davinci without any other instructions can usually handle this and you'll get a lot more creativity and you see how like okay go switching back to original davinci it just said okay let's let's carry on the conversation how do i get to black thorn ravine and let's see what it makes up you'll need a horse i got a couple that might suit you player for free oh look at that look at that oh that was clever okay so sheriff says you'll need a horse so he told us the mission up front this was unexpected so the sheriff told us about the mission up front he says you'll need a horse and i asked for freeze like well you gotta earn my trust first so it actually did harken back to the sheriff doesn't trust the player yet so i'll tell you where the horses are but you got to do some work for me first player find what work let me guess save a little girl from a well or something oh it just went straight to an end [Laughter] uh i want you to murder a guy for me completion may contain unsafe content yes um unfortunately i can't tell gpt3 that this is this is writing fiction and it's hypothetical um yes okay all right the sheriff wants us to murder someone player wow really trusting of you of youtube casually mention murder like that okay went straight to it his name is clem the guy's in the next room over he's a real jerk but i can't afford to lose his vote well that doesn't make any sense so why kill him okay uh i think this one has gone on far enough you can see that if uh if if these if this was happening you um you could easily just you know stuff this into a video game let's try an experiment though let's go back up so instead of because one thing is that gpt3 won't if you're open ai rather if you're trying to do this in a game it won't allow you to put in your own dialogue you have to it has to present you dialog options so let's say generate dialog options for the user um okay so dialog options one perfect okay that's plenty um yep so what you can do is instead of instead of you know asking the player to put in you know whatever they want you can also just have it you know generate some options for the user to pick from what's the second quest i'll go to the ravine how will i know the blackthorne ravine an eye for an eye i like it um you said there was a second quest so this is great um yeah i think that this is probably good i'll just break this down a little bit so this top part is what i call either the framing or the persona so you just give it a situation you tell it what's going on and usually it can go from there another thing to that i want to point out is davinci o2 is the most quote unquote aligned but it also means it's the most uh or the least creative instruct beta is a little bit more creative but it does still have some random behavior and then plain vanilla da vinci once you get good with it you can get this to do pretty much anything but it does require a lot more structure because well here let me just show you if you remove everything and you go back to plane da vinci this is what might happen hi sheriff let's see if we remove all this player sheriff yeah so you see how it's just like kind of just running off with it here actually let me remove the stop so you can see just how random this is player horse [Laughter] yep so this is what i mean by like da vinci can completely go off the rails if you don't provide it enough structure it's just taking this and running with it but you know if you go back a few a little ways in the video and you see where i had given it some dialogue already da vinci understood oh we're writing dialogue now okay i think that's good um yeah just some tips and tricks about using gpt3 to generate fiction thanks for watching

Original Description

The Kickstarter for my Post-Labor Economics book is live! https://www.kickstarter.com/projects/daveshap/labor-zero
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from David Shapiro · David Shapiro · 15 of 60

1 Raven MVP Demo 2021-04-02
Raven MVP Demo 2021-04-02
David Shapiro
2 Get Started with Raven AGI
Get Started with Raven AGI
David Shapiro
3 Coding Raven's Encyclopedia Service (v.1)
Coding Raven's Encyclopedia Service (v.1)
David Shapiro
4 Prototype AGI demo - Natural Language Cognitive Architecture "NLCA" running on GPT-3
Prototype AGI demo - Natural Language Cognitive Architecture "NLCA" running on GPT-3
David Shapiro
5 Raven Release 1 Deep Dive
Raven Release 1 Deep Dive
David Shapiro
6 Fine-tuning GPT-3 to generate questions about anything
Fine-tuning GPT-3 to generate questions about anything
David Shapiro
7 Fine-tuning GPT-3 for benevolent and trustworthy AGI
Fine-tuning GPT-3 for benevolent and trustworthy AGI
David Shapiro
8 Implementing Natural Language Cognitive Architecture with GPT-3 and the "nexus" concept
Implementing Natural Language Cognitive Architecture with GPT-3 and the "nexus" concept
David Shapiro
9 5 Tips and Misconceptions about Finetuning GPT-3
5 Tips and Misconceptions about Finetuning GPT-3
David Shapiro
10 How to create synthetic datasets with GPT-3
How to create synthetic datasets with GPT-3
David Shapiro
11 What is a heuristic imperative? What imperatives should we give AGI?
What is a heuristic imperative? What imperatives should we give AGI?
David Shapiro
12 Talking Philosophy with GPT-3
Talking Philosophy with GPT-3
David Shapiro
13 Talking Boundaries and Consent with GPT-3
Talking Boundaries and Consent with GPT-3
David Shapiro
14 Convergence and acceleration towards AGI (or Artificial Cognitive Entities)
Convergence and acceleration towards AGI (or Artificial Cognitive Entities)
David Shapiro
GPT-3 for Writing Dialog
GPT-3 for Writing Dialog
David Shapiro
16 Co-writing flash fiction with GPT-3
Co-writing flash fiction with GPT-3
David Shapiro
17 From zero to finetuned model in 1 hour with GPT-3. Generate a movie script from any premise!
From zero to finetuned model in 1 hour with GPT-3. Generate a movie script from any premise!
David Shapiro
18 GPT-3 Working Session: Finetune an information companion chatbot in 30 minutes (RESEARCH ONLY)
GPT-3 Working Session: Finetune an information companion chatbot in 30 minutes (RESEARCH ONLY)
David Shapiro
19 What is "toxic stoicism"? Talking philosophy with GPT-3
What is "toxic stoicism"? Talking philosophy with GPT-3
David Shapiro
20 Billion-dollar GPT-3 startup! Fix education with an expert tutor chatbot!
Billion-dollar GPT-3 startup! Fix education with an expert tutor chatbot!
David Shapiro
21 Finetune GPT-3 to write an entire coherent novel (part 1)
Finetune GPT-3 to write an entire coherent novel (part 1)
David Shapiro
22 Concepts in Neuroscience and Cognition - Deficits of GPT-3 and the path to AGI and ACE
Concepts in Neuroscience and Cognition - Deficits of GPT-3 and the path to AGI and ACE
David Shapiro
23 Finetuning GPT-3 to be a master tutor that can handle any topic and hostile students
Finetuning GPT-3 to be a master tutor that can handle any topic and hostile students
David Shapiro
24 Testing "Theory of Mind" in GPT-3 - making fully aligned ACOG (Artificial Cognitive Entities)
Testing "Theory of Mind" in GPT-3 - making fully aligned ACOG (Artificial Cognitive Entities)
David Shapiro
25 Finetune GPT-3 to write an entire coherent novel (part 2)
Finetune GPT-3 to write an entire coherent novel (part 2)
David Shapiro
26 Finetune multiple cognitive tasks with GPT-3 on medical texts (and reduce hallucination)
Finetune multiple cognitive tasks with GPT-3 on medical texts (and reduce hallucination)
David Shapiro
27 Finetune GPT-3 to write a novel - Part 3 (IT WORKS!!!) ...at least a little bit
Finetune GPT-3 to write a novel - Part 3 (IT WORKS!!!) ...at least a little bit
David Shapiro
28 How will we know when we've invented AGI? How will we know it is complete?
How will we know when we've invented AGI? How will we know it is complete?
David Shapiro
29 Finetuning a Creative Writing Coach in GPT-3 - Part 1
Finetuning a Creative Writing Coach in GPT-3 - Part 1
David Shapiro
30 Finetune GPT-3 to write a coherent novel - Part 4 (success! with minor bugs...)
Finetune GPT-3 to write a coherent novel - Part 4 (success! with minor bugs...)
David Shapiro
31 Recursively summarize text of any length with GPT-3
Recursively summarize text of any length with GPT-3
David Shapiro
32 Finetuning a Creative Writing Coach in GPT-3 - Part 2
Finetuning a Creative Writing Coach in GPT-3 - Part 2
David Shapiro
33 Increasingly Verbose Bot with GPT-3 - Expand any word or phrase into a whole paragraph
Increasingly Verbose Bot with GPT-3 - Expand any word or phrase into a whole paragraph
David Shapiro
34 Metaprompting with GPT-3 to dynamically generate arguments
Metaprompting with GPT-3 to dynamically generate arguments
David Shapiro
35 I'm taking a short break from research and YouTube
I'm taking a short break from research and YouTube
David Shapiro
36 Are LaMDA or GPT-3 sentient? No, but...
Are LaMDA or GPT-3 sentient? No, but...
David Shapiro
37 Can GPT-3 generate training data? Short answer? Yes! Here's why that's a legit methodology...
Can GPT-3 generate training data? Short answer? Yes! Here's why that's a legit methodology...
David Shapiro
38 DALLE2 Style Tags Tutorial - "Elven archer in a sunny forest" with different tags
DALLE2 Style Tags Tutorial - "Elven archer in a sunny forest" with different tags
David Shapiro
39 Many of you have asked for it: Join my new research Discord! Link in description
Many of you have asked for it: Join my new research Discord! Link in description
David Shapiro
40 Answer complex questions from an arbitrarily large set of documents with vector search and GPT-3
Answer complex questions from an arbitrarily large set of documents with vector search and GPT-3
David Shapiro
41 Fixing "goldfish memory" with GPT-3 and external sources of information in a chatbot - part 1
Fixing "goldfish memory" with GPT-3 and external sources of information in a chatbot - part 1
David Shapiro
42 Fixing "goldfish memory" with GPT-3 and external sources of information in a chatbot - part 2
Fixing "goldfish memory" with GPT-3 and external sources of information in a chatbot - part 2
David Shapiro
43 Python & GPT-3 for Absolute Beginners #1 - Setting up your environment
Python & GPT-3 for Absolute Beginners #1 - Setting up your environment
David Shapiro
44 Python & GPT-3 for Absolute Beginners #2 - Your first chatbot
Python & GPT-3 for Absolute Beginners #2 - Your first chatbot
David Shapiro
45 Python & GPT-3 for Absolute Beginners #3 - What the heck are embeddings?
Python & GPT-3 for Absolute Beginners #3 - What the heck are embeddings?
David Shapiro
46 Introducing the RAVEN MVP - a general purpose AI companion (with a live DEMO)
Introducing the RAVEN MVP - a general purpose AI companion (with a live DEMO)
David Shapiro
47 I needed SQLITE but for vectors so I wrote it myself. Now it's on PyPI - introducing VDBLITE
I needed SQLITE but for vectors so I wrote it myself. Now it's on PyPI - introducing VDBLITE
David Shapiro
48 Prompt Engineering 101: Autocomplete, Zero-shot, One-shot, and Few-shot prompting
Prompt Engineering 101: Autocomplete, Zero-shot, One-shot, and Few-shot prompting
David Shapiro
49 Prompt Engineering 101: Introduction to CODEX
Prompt Engineering 101: Introduction to CODEX
David Shapiro
50 Prompt Engineering 101: Summarizing, Extraction, and Rewriting
Prompt Engineering 101: Summarizing, Extraction, and Rewriting
David Shapiro
51 Summarize product reviews with GPT-3 fast and easy, get product insights and improvements fast!
Summarize product reviews with GPT-3 fast and easy, get product insights and improvements fast!
David Shapiro
52 Finetuning GPT-3 101: Synthesizing Training Data
Finetuning GPT-3 101: Synthesizing Training Data
David Shapiro
53 Finetuning GPT-3 101: Augmenting Training Data
Finetuning GPT-3 101: Augmenting Training Data
David Shapiro
54 Finetuning GPT-3 101: Using Your Finetuned Model
Finetuning GPT-3 101: Using Your Finetuned Model
David Shapiro
55 Modeling different viewpoints with GPT-3 for automatic debates
Modeling different viewpoints with GPT-3 for automatic debates
David Shapiro
56 Finetune a perfect email generator in GPT-3 - take any input and generate a great email
Finetune a perfect email generator in GPT-3 - take any input and generate a great email
David Shapiro
57 Research Update: Nexus microservice for Artificial Cognition + microservices architecture (MARAGI)
Research Update: Nexus microservice for Artificial Cognition + microservices architecture (MARAGI)
David Shapiro
58 Research Update: Microservices! Text-based simulation, Embeddings, and Nexus
Research Update: Microservices! Text-based simulation, Embeddings, and Nexus
David Shapiro
59 It's alive! The first 3 microservices are up and running!
It's alive! The first 3 microservices are up and running!
David Shapiro
60 What is a Microservice? What does it have to do with AGI?
What is a Microservice? What does it have to do with AGI?
David Shapiro

This video teaches how to use GPT-3 to generate dialogue between characters, with a focus on fine-tuning and prompt engineering. By following the steps and using the tools demonstrated, viewers can learn how to control the conversation flow and tone, and generate more creative and engaging dialogue. The video also showcases the capabilities and limitations of LLMs in dialogue generation, and provides insights into how to optimize their performance.

Key Takeaways
  1. Brainstorm ideas for a funny scene between Spider-Man and Mary Jane
  2. Use imperative verbs like 'brainstorm' or 'imagine' to help GPT-3 generate better results
  3. Use 'next line as a stop' to control the conversation flow
  4. Restart the conversation to try different temperatures
  5. Manually type in lines to continue the conversation
  6. Change the prompt to see how it changes the outcome
  7. Add something to the prompt to see how it changes the outcome
  8. Change the engine to see how it changes the outcome
  9. Delete the previous output and start again
  10. Simulate a dialogue tree in a video game
💡 Small changes to the prompt can drastically change the outcome of the generated dialogue, and using older models like Instruct Beta or Vinci can lead to more creative results.

Related AI Lessons

Claude AI vs ChatGPT: Which One Is Actually Better in 2026?
Compare Claude AI and ChatGPT based on real-world usage and benchmarking to determine which one is better in 2026
Medium · AI
Claude AI vs ChatGPT: Which One Is Actually Better in 2026?
Compare Claude AI and ChatGPT to determine which AI model is better for your needs in 2026
Medium · Programming
IntelliBooks: Classic RAG vs Graph RAG vs Agentic RAG – Choosing the Right AI Retrieval Architecture for Enterprise AI
Learn to choose the right AI retrieval architecture for enterprise AI between Classic RAG, Graph RAG, and Agentic RAG
Dev.to AI
Fluid, natural voice translation with Gemini 3.5 Live Translate
Learn about Gemini 3.5 Live Translate, a new voice translation technology that enables fluid and natural conversations across languages
Dev.to AI
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →