Creating Samantha from “Her” by Fine-tuning GPT-3 on the Movie Script

Mate Marschalko
3 min readMar 20, 2023

If you ever talked to ChatGPT, you know how boring it can be.

But even with a carefully crafted prompt, it won’t be as accurate as if you fine-tuned the model on a specific question/answer dataset.

If you’ve seen the film Her with Joaquin Phoenix and Scarlett Johansson you know the kind of futuristic AI assistant I’m excited about.

The things Samantha can do in the film is quite fascinating but probably mainly because she can access Theodore’s computer, read emails, make phone calls and access the internet.

Fine-tuning

ChatGPT is great but you can take things further by fine-tuning the GPT-3 model with some training data.

You don’t need a lot of data but it needs to be in a very specific format:

[{
"prompt": "USER: Hey, how are you?###",
"completion": "ASSISTANT: I'm good thank you!END"}
}]

The prompt and completion pair is essentially and example for the model to see how to respond to certain inputs.

The important thing to note here is that this won’t need to be an exact match later on when we interact with the assistant, this is just an example from which it can learn a style.

--

--

Mate Marschalko

Senior Creative Developer, Generative AI, Electronics with over 15 years experience | JavaScript, HTML, CSS