website/content/posts/using-llms-for-writing-fiction.md
Anthony Wang 8b211cd467
All checks were successful
ci/woodpecker/push/<no value> Pipeline was successful
Fix links
2023-07-30 23:17:49 +00:00

7.7 KiB

title date description type tags
How I Use LLMs for Writing Fiction 2023-07-30T23:16:00Z The one thing that I've found LLMs to be good at for helping me write fiction post
llms
ai
humor
writing

When I was in grade school, I hated writing.

Now in retrospect, it's pretty obvious why: I was being forced to write about stuff I didn't care a thing about, such as thematically analyzing some random book or stuff like that. Later, in high school, I started blogging about jailbreaking graphing calculators, and I found out I did like writing, just not the kind I was forced to do in school.

There's another thing I always struggled with: the curse of the blank page. Picture this. An empty, clear, unfilled, lifeless page lays before you, and now you need to turn nothing into some piece of writing. So many possibilities! So many choices! So many ways to start!

So yeah, I always get severe choice paralysis when starting any sort of writing. Including this post, where I rewrote the first paragraph six times.

This is where LLMs really shine. They're great for prototyping (and not much else). Throw any idea at them, no matter how ridiculous (but some LLMs might get upset if it's morally questionable), and they'll turn it into some text. Hey ChatGPT, write a short paragraph on how PyTorch tensors can reduce their tension and stress using relaxation exercises!

In a lighthearted analogy, we can envision PyTorch tensors as hardworking entities tirelessly crunching numbers and processing data. Just like us humans, these tensors can also accumulate tension and stress due to their computational demands. To alleviate their virtual strain and maintain their efficiency, they can benefit from relaxation exercises. One such exercise involves performing operations like tensor reshaping or transposing, allowing them to stretch and unwind. Additionally, they can engage in mathematical functions like sigmoid or tanh activation, analogous to deep breaths, to gently ease their "virtual muscles." Through these relaxation exercises, PyTorch tensors can find a sense of calmness, ensuring they remain resilient and poised to tackle complex tasks with ease.

With LLMs, instead of starting from a blank page full of nothing, I can now start with something, even if it's not great writing.

For the three stories published on my blog, Beavers, Azerbaijan, and Ennui, I used LLMs extensively for prototyping, specifically ChatGPT. But very little of the LLM output actually made it to the final stories, since the output usually just isn't good enough. I have a weird writing style so I had to rewrite a lot of stuff. I also enjoy adding lots of jokes to these stories, and LLM jokes are... well, here's an example:

Why did the HTML developer go bankrupt?

Because he used up all his tags!

Yeah... Ha. Ha. Ha. Very funny. LLMs are fundamentally uncreative. They generate statistically probable text, not interesting text. If they do generate something interesting, it's because the prompt itself is interesting. Like when ChatGPT first came out and everyone was going crazy about it, I made it generate some fake news. ChatGPT isn't making anything creative here. It's just taking the prompt and stretching it into a serious-sounding news story about something ridiculous. So LLMs aren't some magical shortcut to give you new ideas. You have to find the ideas yourself. All it takes is time.

For instance, this spring I spent four months writing a 10000-word political satire story (currently unpublished), which sounds like a disproportionate amount of time. But I actually only worked on it once or twice a week and spent the rest of the time doing other stuff but keeping an eye out for ideas. For example, the TED Talk "This is what happens when you reply to spam email" inspired a section in the story where the characters use a series of increasingly ridiculous codenames in a silly attempt to obfuscate their plot to overthrow the government. One day, a random idea just somehow popped into my head of having Trump bond with dictators while watching the Secret Life of Pets 2, and I asked ChatGPT to sketch out the scene. With some edits, here's the final result:

I have a tremendous, tremendous, tremendous story for you. Okay? It's a tremendous story. Believe me, you're gonna love it. So, picture this. It's 2 AM, okay? It's 2 AM, and I'm sitting there in my big, beautiful Trump Tower penthouse. And guess who's with me? Vladimir V Putin, Chairman Xi Jinping, and Kim Jong-un the Fat. Yeah, that's right. The whole gang, all together. And you know what we're doing? We're watching a movie. Yeah, a movie. We're watching "The Secret Life of Pets 2." Can you believe it? I mean, who knew world leaders had movie nights? I did. I did. I knew it. So, we're watching this movie, and let me tell you, folks, it was fantastic. It was fantastic. It was better than any movie you've ever seen, believe me. Now, here's the thing. You know, I'm not gonna spoil the movie for you, okay? I'm not gonna do that. But there's this one scene, okay? There's this one scene that hit us right in the feels. I mean, right in the feels. We were sobbing, folks. We were sobbing. And you know what? I'm gonna tell you something. I'm gonna tell you something. There were tears, big, beautiful, manly tears. But you know, not too manly. Not too manly. Just the right amount of manly. Just like my hair. So, there we were, crying like babies, folks. And let me tell you, let me tell you, it wasn't a pretty sight. It wasn't pretty. You had my lad Vlad over there. He was wiping his tears with his bare chest, folks. Bare chest. And you know, Kimmy, he had his little nuke-shaped tissues. Very cute. Very cute, I must say. And lil' Xi, oh, lil' Xi, he had this teensy Winnie-the-Pooh-themed handkerchief. It was adorable. Adorable, folks. But me, me, folks, I had the best tears. The best. My tears were tremendous. They were tremendous. They were the best tears. And I know more about tears than anyone else in the room. Believe me. Believe me. And I was using the Constitution to wipe them away. That's right. The original copy of the Constitution. Because that's what a true patriot does. Okay? Now, I'm not saying we were crying because of the movie, okay? We were crying for other reasons. Very important reasons. And let me tell you, folks, when world leaders cry together, it's a beautiful thing. It's a beautiful thing. We were so moved, folks. So moved. We were like, "Oh my God. Oh my God. Those pets. They have such secret lives. Such secret lives. It's unbelievable." And we were sobbing. We were sobbing. But you know what? We bonded. We bonded over those tears, folks. We bonded over those tears. And we made a pact. We made a pact right then and there. We said, "We will never let our differences tear us apart. Never. Never." And let me tell you, folks, let me tell you, we've been best buddies ever since. Ever since. So you see, you see, movies bring people together, folks. They bring people together. Even world leaders. Even world leaders. So, if you take anything away from this story, folks, take this. Take this. The Secret Life of Pets 2 is a tremendous movie. And if it can bring Vlad, Xi, Kimmy, and me together, then it can bring anyone together. Anyone. Believe me. God bless America. And God bless the Secret Life of Pets 2. Tremendous.

One last thing: ChatGPT was all I had when I wrote some of those earlier stories, but now llama.cpp and it's awesome. In particular, it's incredibly useful to increase the temperature to get crazier results with more hallucinations, which aren't necessary a bad thing when writing fiction, and overall just more customizable.