Up to Main Index                           Up to Journal for October, 2024

                    JOURNAL FOR FRIDAY 25TH OCTOBER, 2024
______________________________________________________________________________

SUBJECT: AI for NPCs and creative writing
   DATE: Fri 25 Oct 20:50:33 BST 2024

This entry is way overdue, partly due to illness on my part :( I also had to
totally rewrite this entry after new AI models from IBM were released that
changed everything.

To provide some context, my journal entry from a few weeks ago caused quite a
bit of excitement. In the entry I showed a conversation with the barkeeper
augmented with artificial intelligence — using NVIDIA's nemotron-mini model.

I was going to say I now need to disappoint everybody; due to licensing I
don't appear to be able to use NVIDIA's nemotron-mini and the performance of
LLMs in general is not great. For these reasons AI NPCs will not be coming to
WolfMUD anytime soon…

Then IBM released their open granite3 models[1]. They are fast. These are the
results I am seeing, all models are loaded onto an NVIDIA T1000 8Gb graphics
card:


    granite3-moe:3b  74.17 tokens/s
    llama3.2:3b      48.95 tokens/s
    qwen2.5:3b       47.59 tokens/s
    nemotron-mini:4b 42.89 tokens/s
    gemma2:2b        43.06 tokens/s
    phi3.5:3b        43.19 tokens/s
    mistral:7b       28.21 tokens/s


For role-playing an NPC, granite3-moe does quite well. This is a conversation
using the same test script as the previous NVIDIA nemotron-mini test:


    >mote ~/test.src
    Greetings, traveller! What can I get for you at The Dragon's Breath?
    ? hi! nice weather
    Indeed, the weather is quite pleasant today. But don't let it fool you,
    there's a chance of rain later.
    ? what drinks do you have?
    We have beer, ale, and wine available for purchase.
    ? I'll have an ale please
    Of course! I'll bring you your ale in a moment.
    ? how's the cat?
    The furball of a cat is not mine, it belongs to someone else. But don't
    worry, it's not causing any trouble.
    ? another ale please
    Another ale coming right up! I'm sorry about the delay, but the furball of
    a cat has been quite distracting.
    ? looks like the weather is changing
    Yes, the clouds are gathering and it looks like we might get some rain
    later on. Be prepared for that.
    ?


For NVIDIA's nemotron-mini model the slowest response was 2.21s. For IBM's
granite3-moe model the slowest response was 1.51s. It might be possible to
achieve better/richer results by tweaking the prompt used specifically for the
IBM model.

The tests are promising but AI is still slow. With the above test the GPU
peaked around 50% usage for each response. For a single player text adventure,
having AI NPCs would not pose a performance issue. However, if you had AI for
all the NPCs in WolfMUD with a reasonable number of concurrent players cracks
will soon start to show. It would only take several conversations ongoing at
once and the responses times would start to suffer. I'm going to go out on a
limb here and predict nobody is going to invest in an 80Gb NVIDIA H100 at
$25,000 for running WolfMUD ;)

Does this mean AI will not be used at all for WolfMUD? Well, experiments are
ongoing. I would like to release a version of "The Cottage" with some AI
sprinkled in. Quick reminder; "The Cottage" is a simple single player text
adventure demo. For a release I need a version of Mote (Mere rewrite) I can
release. At the moment Mote is in a weird limbo due to a busy work life.

One area where AI would be beneficial to WolfMUD is in improving my writing in
the stock zone files. Take the description of the corner of the tavern where
the fireplace is:


    You are in the corner of the common room in the dragon's breath tavern. A
    fire burns merrily in an ornate fireplace, giving comfort to weary
    travellers. The fire causes shadows to flicker and dance around the room,
    changing darkness to light and back again. To the south the common room
    continues and east the common room leads to the tavern entrance.


A description rewritten using AI[2] becomes:


    You find yourself nestled in a corner of the Dragon's Breath Tavern,
    warmth radiating from the ornate fireplace. The hearth is alive with
    flames that leap and dance, casting flickering shadows across the room
    like restless spirits. A symphony of light and dark ebbs and flows as the
    fire plays upon the tapestry of darkness, transforming the space from
    shadowy retreat to a comforting beacon of illumination. To the south, the
    common room stretches before you. Eastward lies the tavern entrance, its
    heavy door promising further adventures in this bustling haven for weary
    travellers.


My original description of the fireplace itself:


    This is a very ornate fireplace carved from marble. Either side a dragon
    curls downward until the head is below the fire looking upward, giving the
    impression that they are breathing fire.


Transformed and rewritten by AI it becomes:


    This masterpiece of stonework, carved from luminous white marble veined
    with subtle streaks of gold, dominates the hearth. Flanking the fireplace,
    two majestic dragons are intricately sculpted, their bodies curved in a
    graceful descent. As they coil downwards, their scaled necks stretch
    outwards, culminating in heads that jut forward, positioned just below the
    fiery mantle. Their mouths are slightly agape, with tongues seemingly
    licking at the flames, creating an illusion so vivid it appears as though
    they are indeed breathing fire into the hearth. The dragons' eyes, crafted
    from glittering onyx, sparkle with a hint of mischief in the firelight,
    adding to the enchantment of the piece.


Then there is the fire itself. The current actions for the fire are pretty
boring and basic:


  · The fire gently pops and crackles.
  · The fire gently crackles.
  · The fire pops, sending little embers dancing up the chimney.
  · The fire flares for a moment as the logs shift and settle.
  · The fire flickers, flames dancing along the logs.
  · The fire dims, then flares back up again.
  · The fire sizzles and pops.


I asked the AI to rewrite the descriptions and to make up some new ones. This
is the list the AI produced:


  · The fire gently pops and crackles, releasing soothing warmth into the
    tavern.
  · The fire emits a soft, gentle crackle, its comforting sounds weaving
    through the room's murmur.
  · The fire pops vigorously, sending little embers dancing up the chimney,
    like fireflies escaping into the night.
  · The fire flares momentarily brighter as the logs shift and settle, casting
    a brief, golden glow across nearby faces.
  · The fire flickers wildly, its flames dancing along the logs in rhythmic,
    orange pulses.
  · The fire dims to a gentle simmer, then suddenly flares back up again,
    rekindling the room's warmth and light.
  · The fire sizzles and pops in contented harmony, its melody accompanying
    the tavern's atmosphere.
  · The fire casts a mesmerizing glow on the dragons' marble heads, as if
    igniting their stone breaths to life.
  · The fire spits a small spark onto the hearth, where it briefly twinkles
    before dying out, a fleeting, tiny star.
  · The fire's warmth causes the marble around it to subtly shimmer, blending
    comfort with ancient, crafted beauty.
  · The fire surges in intensity, its increased light momentarily chasing away
    all shadows from the tavern walls.
  · The fire's flames lick at the air, casting a warm, golden light on the
    faces of those gathered nearby.
  · The fire settles into a steady, comforting burn, its reliability a balm to
    weary travellers' souls.
  · The fire shoots up a particularly vigorous flame, briefly illuminating the
    dragons' upward-gazing eyes.
  · The fire's gentle hum and soft crackles create a soothing background
    melody for the tavern.
  · The fire dims slightly as a log splits, only to brighten anew with the
    fresh, exposed wood.


Now that is quite an improvement! :) Although, for random messages that are
supposed to give the fire a bit of life, would the original messages be
better? Would the longer improved messages just clutter the player's screen?

I can see the benefit of using an AI as a creative partner and have no issue
with acknowledging an AI's contribution. Using a collaborative approach, where
AI is used as a tool in the creative process, seems to be a developing trend.
In this case I'm using AI to enhance and refine my original work. However,
should I be worried? Is the result no longer my writing, no longer my work?

The world of AI is new and exciting with rules still being written. The last
thing I want is to be pulled into a debate about ownership and authorship :(

As always, your comments and ideas are very welcome: diddymus@wolfmud.org

--
Diddymus

  [1] IBM Granite 3.0; open, state-of-the-art enterprise models:
      https://www.ibm.com/new/ibm-granite-3-0-open-state-of-the-art-enterprise-models

  [2] All of the rewriting was done with Google's gemma2:2b model.


  Up to Main Index                           Up to Journal for October, 2024