Choose Your Own Adventure


GitHub: Backend Frontend

When I was a kid, the place I absolutely wanted to be was the public library that was at the end of our street. Some of my earliest memories are of sitting in the “youth” section of that library. I knew it so well I could immediately tell when they’d placed new books out, or when some furniture was re-arranged. Hell, I’m only half the programmer I am today because, by necessity, I had to learn how to use the terminal-based inter-library book search database.

I read everything, but there was one specific section that captured my imagination like none other: the shelf devoted to the Choose Your Own Adventure book series. I checked out every one the library offered. Some were excellent, some were weird, some were — well, they were pulp kids books, what do you want? But the raw imaginative wonder they elicited is something I still remember to this day.

Part of my fascination with generative AI is in exploring how it can “unlock” the parts of our brain that, for this reason or that, are found lacking or wanting within us. I am not a great writer. Even less am I a great creative writer. However, it seems that generative AI can give me the “training wheels” to express myself.

Much handwringing has been done about AI destroying this profession or that profession. As a developer, the advances in coding AIs (e.g. codegen, StarCoder) may even threaten my profession even more than creative ones. But rather than being reactionary, I think we should look at these tools as lever-and-pullies for the mind; such tools that extended man’s ability to perform manual labor weren’t inherently unnatural or evil, but instead enabled man to become a better version of himself. The same can be true for generative AI.

Working on literAI helped me learn how to use large language models, but I came away really wanting to know how to make (or at least, augment) them. I work best when I have a defined goal or project to achieve, so a few months ago I set myself the task to re-create the Choose Your Own Adventure experiences of my youth. Here are my results!

cyoa is a mobile-friendly web app for creating your own story. It uses a finetuned version of LLaMA that I trained on a set of long-form public science fiction and fantasy stories to generate interesting and fun illustrated “books”. Trained at a context length of 8K tokens, it (seems to be) able to keep coherence of story/characters quite well over long spans, which is essential for good story telling.

Users can pick from one of two auto-generated “next steps” in the story, or alternatively write their own. What I enjoy when using the it is the ability to “jump in” and have a specific character say or do something, and then let the AI take over from there.

The core model beyond cyoa is available on my Hugging Face page as delta weights against the base LLaMA model (to comply with the LLaMA license). Summarizations of the generated choices and prompts for image generation is done using mosaicml/mpt-7b-instruct and the images themselves use DreamShaper.

The model does a good job carrying on the specific line of the story, although it sometimes struggles with major plot elements, preferring instead to keep the characters linearly progressing the established narrative. One thing that can helpful is using the “Write your own” option to add in a sudden change like the start of a new chapter (just writing “CHAPTER ONE” is enough to do this) or perspective shift.

CYOA is a novelty, but I hope it’s one that you enjoy as much as I do. Using AI to help us unlock new methods of expression within ourselves is, in my opinion, net positive for society. Enjoy 🙂.

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.