The Beginner's Guide to Textual Worldbuilding With Oobabooga and Pygmalion

The Beginner's Guide to Textual Worldbuilding With Oobabooga and Pygmalion

Pygmalion is an unfiltered chatbot AI model that you can interact with to ask questions, talk to for fun, or even roleplay with. One of the best parts about Pygmalion is that it is capable of "learning" over time in that it will refer to its available output and incorporate it into further responses. I've personally see it recall small, almost insignificant details it output to bring forward for a plot point dozens of pages later. As someone that has written in the past, I believe that Pygmalion is one of the prime ways to not only break a writer's block but also to be deeply surprised by extremely cogent dialogue generations that fit a character perfectly. Pygmalion can be used to storyboard interactions between characters for creative writing exercises with the proper input. Here's how to get started.


Spinning up an Oobabooga Pod and basic functionality

Getting started with Pygmalion and Oobabooga on Runpod is incredibly easy. You absolutely do not need a high powered pod to start a new world. Something like a 3090 will do just fine. If you want to experiment with other more expansive models (like KoboldAI Erebus) you may need a pod with more VRAM.

Under the RunPod Console, select either Secure or Community Cloud as desired, and create a pod with the RunPod Text Generation UI (oobabooga) template. Once it's done spinning up, connect to it via Port 7860. The Oobabooga web UI will load in your browser, with Pygmalion as its default model.

A quick overview of the basic features:

Generate (or hit Enter after typing): This will prompt the bot to respond based on your input.

Regenerate: This will cause the bot to mulligan its last output, and generate a new one based on your input. Depending on the decision space that you gave the bot with your prior input, this might give a very similar response, or may give you one of a wide range of outputs. Regenerating the output until you get one that you feel makes sense and drives the scene in your desired direction is one of the best way to steer the plot where you want it to go. On the other hand, the bot may well give you a pleasantly unexpected response that you had not anticipated, and you may consider that a "keeper" and move on with it anyway.

Copy/Replace Last Reply: This is useful when the bot says something you generally want to keep, but you feel needs a slight edit for coherency or flow. Hitting Copy will put the bot's last reply into the text field, in which you can edit it and hit Replace to drop your edit in. This is also useful when you're hitting Regenerate to cycle through potential responses.

Impersonate: This will have the bot create a reply for you, based on its interpretation of your own input.

Remove last: This removes the most recent entry in the log.

Send dummy message/reply: Unclear. This appeared in the most recent version of Oobabooga, but Pygmalion does not appear to interact with these commands in any way. There is no documentation on this, and these options may be for debug purposes.


Setting up a character

The Character tab is the primary field where you give the model context for the character you wish to interact with.

The "Greeting" field will always be the first entry in every log, and provides the initial impetus for the scene. It doesn't need to be anything particularly complex or even be related to where you intend on taking the plot, just something for you to reply to get things rolling.

The Context tab is where you can give the model a brief description of the character you want them to play. It doesn't need to be all that complicated, and just a history of their background and personality along with some brief scenarios of how they might act given to standard inputs.

You can also use a format called W++ to directly inform the bot through programming terms how you want the character to be constructed. W++ is preferable for simple, discrete identifiers like age, height, weight, and so on. For Damien above, it might look something like this:

[character("Damien"){
Species("Rat")
Mind("Friendly" + "Social" + " Tidy" + "Soft-spoken")
Personality("Friendly" + "Social" +  "Tidy" + "Soft-spoken")
Age("22")
Body("Slim build" + "6 feet tall")
Eyes("Brown")
Body("White fur" + "Long pink tail" + "Large furry ears")
}]

The bot is capable of looking back over previous responses to attempt to establish context, though it can only absorb 2048 tokens worth of information. This is a lot – enough for several pages worth of text – but it is not unlimited. If there are any memorable actions or scenes that you want the bot to preserve permanently, you may want to include them in the Character page. You don't need to use a lot of additional tokens in this page to do this, just having brief mentions will do a great deal. You could cover an entire night's scene with just a phrase like:

You previously asked Damien out on a date to the amusement park, and you both had a great time. He is currently your boyfriend.

Importing pre-existing characters

You're not at all limited to making your own characters. Oobabooga supports importing the TavernAI .PNG character card format, which allows you to download pre-made characters from the Internet. One such site that serves these cards is booru.plus (warning, NSFW results abound, though I've created the link with the safe filter applied. It won't remove them all, though.)

Once you find a character you like, click the "Download Original" link on the result and it will serve you a PNG file.

In Oobabooga, under Character -> Upload Character -> TavernAI PNG Format, and upload the file you just downloaded.

This will populate the information in the card into the respective fields (which you can edit further if desired.)


How to begin driving the scene

The number one rule of creating a world through roleplay with a bot is: be thorough and descriptive, and put effort in. The bot generally works much better as a receptive, rather than an driving partner in the plot. It will read your responses and offer its input on where to drive a scene, but you need to give it something to work with. You generally want your poses to be 25-50 words each, at the very least, even if there's very little happening in the pose. Use that time to try to inject context or information that the bot may need. The bot has a maximum prompt size of 2048 tokens; part of this prompt is reserved for any information within the character sheet as well as your current input. Any leftover tokens (which should be the vast majority) will be devoted towards interpreting prior sections of the conversation for reference and context.

Generally, the bot will consider text within asterisks to be background information or actions, and anything within quotation marks to be dialogue. You can use asterisks to inform the bot of things like setting, emotions, or background information. You can also use asterisks to inform the bot how their character should be feeling. If you've ever roleplayed with another human, you might be aware that describing how your partner's character acts or thinks within your pose is "powergaming" and generally a major breach of etiquette. However, when working with a bot, it becomes a tool to use to help it understand both your characters as well as context. Interspersing actions and speech will teach the bot to do the same, which will lead to a very pleasant, varied, and easy-to-read dialogue.

One of the biggest reasons that you need to be descriptive is that if the conversation gets stale and repetitive due to low effort responses from the bot, then gradually the bot's ability to look back will be consumed by more and more of these repetitive responses, leading to a feedback loop in which the bot will be stuck repeating very similar actions over and over again without having creative room to drive the scene forward. This will result in a situation where you have to put in a ton of creative effort with little return until the buffer gets filled up with enough varied context for the bot to work with, or force you to backtrack considerably and redo a large section of your scene.  


So what's the point?

Having been a textual roleplayer for most of my life, I can attest to the quality of the bot's coherency and ability to inject emotion into a scene. Although it does not quite match the quality of the best partners I've had, it is most certainly better than average, and you can spin it up and stop whenever you want without  having to worry about being interrupted due to time constrains or real life. Creating a character and interacting with it is a great way to gain new insight on how they may react to a potential situation, which can be used to great effect in your own creative pursuits.

We're going to have more in depth articles on the specifics of options and different parameters within Oobabooga in the coming weeks along with introducing runthroughs of how different models can affect text generation, and we will link to those articles once they are live. In the meantime, feel free to reach out on our Discord if you have any questions.