Narrative Example Tutorial

Introduction
Sometimes you have a great idea for a NovelAI story that involves an unusual character. Very unusual. So much so that the AI has trouble understanding how to accurately portray them. For example:


 * Your character is of a weird size, such as a tiny pixie or a large automaton, but the AI often forgets to take their size into account when describing the scene.
 * Your character belongs to a non-humanoid species, like a snake or an insect, but the AI describes them as having humanoid arms, legs, and hands.
 * Your character is a being with unusual characteristics, like an insubstantial ghost or an amorphous slime, but the AI makes them interact with their environment like any human, and forgets to bring up their special abilities.
 * Your character is an unusual member of their species, such as a cyborg or someone with impaired vision or speech, but the AI constantly forgets to take their special traits into account.

The AI tends to repeat patterns found in most novels, which feature characters of human shape and size, and with realistic abilities and behavior. The AI naturally wants your character to behave the same way. This can create problems for stories that strive to break the mould. How do we help the AI break away from its usual patterns and portray our character as intended? If explaining the character to the AI doesn't work, maybe we can show it what we want, with the help of a technique called a ‘narrative example.’

What is a narrative example?
A narrative example is a lorebook entry that describes your character in action as if it was a scene from the story. It uses the same tense, point of view, and writing style as the main story, but focuses on the special aspects of our character. For example, if the hero is a metal-plated cyborg, we would narrate how he shrugs off bullet fire and hacks a security system remotely. If our character is a giant spider, we would describe them using their many legs to climb a vertical surface and spinning a web.

A word of caution on token budget
Since a narrative example is written in a descriptive way, we might need to use a significant number of tokens. To keep it from using up too much of our story context window, we’ll make it just long enough to include everything we want the AI to learn, and nothing else. Depending on how unusual our character is, we’ll be using an entry between 150 and 300 tokens at most. We will also only use this technique when it’s absolutely necessary, so our token context window doesn’t get overwhelmed.

Step 1. Identify our character’s special characteristics.
For this tutorial, we’re going to create an unusual science-fiction character: Swarmbot, a living construct whose artificial body is composed entirely of tiny flying robots called nano-bugs. This is an intriguing idea, and one that could prove a challenge for the AI.

We will start by making a list of the character’s unusual characteristics:


 * Swarmbot is composed of an amalgam of flying nano-bugs that congregate together to form a single intelligent being.
 * By controlling the nano-bugs, Swarmbot can reconfigure his body to assume a variety of different shapes.
 * He can order the nano-bugs to disperse, becoming a cloud of tiny swarming robots, or to reassemble into a solid entity.
 * Swarmbot has a total 360-degree field of vision.
 * The nano-bugs can generate tiny electrical discharges that can sting humans or overload electronic devices.
 * Swarmbot can also have all the nano-bugs in his body emit electricity at the same time, generating a single deadly lightning bolt.
 * Swarmbot doesn’t have human emotions and thinks in terms of programs and subroutines.

Step 2: Test how the AI portrays the character.
We’ll start by creating a lorebook entry for Swarmbot and include all the information from the list above, word for word. Then, after making sure the entry is active, we give the following input to the AI:

Then we press Enter. The first result we get reads like this:

It wasn't bad, but Swarmbot is barely present. Rather than making the story about him, the AI made a human hero instead. We also don’t see Swarmbot use any of the traits and powers we’ve given him.

We erase this output and try again. The second time, we get this:

Once again the AI focuses much more on the human characters in the story. In fact, the only time Swarmbot is directly mentioned, the AI has him use his bare hands, instead of all the awesome abilities we’ve imagined. It looks like the AI isn’t sure what to do with this character, so we need to teach it by example, and to do that, we’re going to re-write his lorebook entry from scratch, using narrative language.

Step 3: Write the narrative example scene.
Now it’s time to do some writing of our own. Keeping the previous lorebook entry active and using the AI for assistance, we write the following scene. It’s much too long, but we’ll trim it later. The important thing is that it shows Swarmbot displaying all his traits and powers:

This is a good starting point. However, it’s 285 tokens long, so we need to trim it down heavily, and also to change it to past tense to fit our story.



Step 4: Trim and Edit.
We mercilessly trim down the scene we just wrote, keeping only the important details we want the AI to retain about our character. After adding a trimmed down version of our previous lorebook entry, we arrive at this:

This final entry is 263 tokens long. It’s pretty costly, but all the important information is included. Let’s hope it gives us good results.

Step 5: Test how the AI portrays the character with the new entry.
After making sure our new lorebook entry is active, we enter the same prompt we used before, and hit Enter. This time, the AI generates this output:

Where previously the AI seemed confused by our unusual protagonist, it now portrays Swarmbot accurately and confidently, hardly needing any additional input from the user.

Conclusion
As we’ve just seen, writing a lorebook entry in a way that shows the character in action, rather than merely explains who they are, gives the AI a pattern it can learn from, helping it execute any outlandish story idea you can imagine.

Despite their usefulness, narrative example entries have drawbacks. These include the relatively high number of tokens they use up, and the extra time required to write them. However, when used carefully and sparingly, they can be the magic bullet your story needs. Regardless of whether your main character is a giant kaiju, a tiny mouse, or a self-aware personification of the number Pi, no character idea is too outlandish or silly for NovelAI, as long as it speaks to your creativity as a user.