Greetings, fellow coders, readers, and enthusiasts of the digital storytelling realm! Today, I’m venturing into the labyrinth of my first developer report, not to dissect the overall architecture of my latest creation, but to share the pulsating heart of the process: the state of our novel generation from the pulsing veins of TechCrunch’s news feed.
The Process
As I pen this post, ‘News to Novels’ has birthed 101 posts, weaving a tapestry of 125.2K words—all conjured into existence in just a smidge over two hours. The gears of creation turn as follows:
I call upon the mighty “gpt-4” to breathe a brief story script from the title and summary of TechCrunch’s offerings. A mere 19.78 seconds it ponders on average—sometimes a swift 15.17, other times a ponderous 47.56—before bestowing upon me tags and a suggested opening paragraph.
The playwright is my next summon, an average of 2.44 seconds to sift through the webpages, extracting the essence of news from their HTML bones.
The heart of the novel pulses with “gpt-3.5-turbo-16k,” taking an average of 32.11 seconds to spin the entire narrative. The loom is fed the story script from my first act, the extracted full news content, and a detailed scribe’s blueprint. My algorithm, trained like a bard to echo Suzanne Collins’ narrative voice, exclusively weaves tales in the first person, as if from the very pages of The Hunger Games.
The final act sees the novel ascend to its digital stage: 15.45 seconds on average for the posts to find their home on the webpage, confirming their presence in our virtual Panem.
Tokens and Storage
Now, let’s talk about the magic behind the curtain: token usage. It’s been thriftier than a merchant in a marketplace—on average, less than 5k tokens per post! Take “The Last Unicorn: A Quest for Survival“; a mere 818 tokens to draft the script, 3,834 to unfold the entire post, totaling a modest 4,652.
And the storerooms for our creations? They’re not the cavernous halls I’d envisioned. The SQL database, a scribe’s library for our posts, sits comfortably under 1Mb. And the FAISS vector storage, where we map the constellations of our narratives, less than 15 Mb. Rest assured, no full news articles or cumbersome texts weigh down our vessels—we sail light, with barely a token to spare for context.
The Challenges
However, in my quest for minimalism, a beast has reared its head: repetition. A narrative echo, if you will. Our stories, despite their charm, began to mirror each other. To combat this, the “gpt-4” model’s opening paragraph suggestion gives each tale a unique doorway. Yet, if you peruse several at a stretch, you’ll spot the patterns, the titles ending with a familiar “The Final…” ringing through 15% of our closing chapters.
The siren song of “gpt-4” for the entire process is tempting, promising a tapestry of diversity, but I’m drawn instead to refine our RAG-based architecture. More styles, more stories, more themes, all while harnessing the 16k context and keeping the coin purse heavy—a frugal bard’s dream.
And now, inspired by the artistry of ChatDev, I’m infusing our process with a persona context—an editor in the first act, a writer in the third. The RAG conjures the persona from the story script, the editor commissioning the writer best suited for each novel’s journey.
The Future
So, my dear readers, as we set sail for this journey into a sea of ever-evolving stories, I invite you to join me. Watch as we shape the news into narratives, as we craft the mundane into the magical, and as we turn the prose of today into the legends of tomorrow.
Looking to the horizon, my goal is to expand the narrative landscape, to harvest tales from the fields of The Verge and other realms, weaving novels in both first and third person. With each new source, with each new style, we’ll test and learn, blend and create.
Stay tuned, for this chronicle has just begun.
The Original Text
*my original witting that was enhanced with generative AI
In this first developer report, I will not dive into the overall architecture but share the current state of the novel generation process. Therefore, the goal of this post will be to share technical details on how the novel generation algorithms have been behaving; while discussing the 2 top challenges.
At the time of this post, News to Novels has 101 posts generated from TechCrunch news feed. Combined, all posts have 125.2K words and took a little bit more than 2 hours to generate. The processing time was distributed as follows:
- 19.78 seconds on average (with a minimum of 15.17 and a maximum of 47.56) for the “gpt-4” model call to generate a brief story script from the TechCrunch news feed title and summary. The call to “gpt-4” also returns the tags and a suggestion for the first paragraph.
- 2.44 seconds on average (with a minimum of 2.11 and a maximum of 4.79) to parse the news webpage using playwright and extract the news content from the HTML.
- 32.11 seconds on average (with a minimum of 19.21 and a maximum of 52.42) for the “gpt-3.5-turbo-16k” model to write the entire novel. The input uses the story script generated in step 1, together the full news content extracted in step 2, and the detailed description of how to write the story. Currently, our algorithms is only trained to write in the first person with a style similar to Suzanne Collins author and The Hunger Games book.
- 15.45 seconds on average (with a minimum of 12.39 and a maximum of 28.07) for uploading the post and confirming the same is available in the webpage.
Regarding token usage, it has been surprisingly low, with the average below 5k tokens per post. Using the “The Last Unicorn: A Quest for Survival” post as an example, we consumed 818 tokens to generate the story script and 3,834 to generate the whole post, consuming 4,652 in total.
Storage usage has also been below my original expectations as well! Amazingly, the sql database managing post content is less than 1Mb, and the FAISS vector storage is less than 15 Mb. Of course, it worth sharing I am not embedding full news articles (just their descriptions). Also, I am not embedding large amounts of text to bring context to a writing style. For example, when following the current RAG model to bring context for a) an Adventure story; b) themed in a dystopian universe; c) following the writing style of Suzanne Collins; and d) with the feel of The Hunger Games: no more than 1 tokens are being returned.
But my hyperfocus on minimalism may be contributing to the biggest challenge we currently have: stories are getting repetitive. We currently decrease this problem by having our step 1 call to “gpt-4” generating a suggestion for the first paragraph. As the first paragraph is usually used by our step 3 call to “gpt-3.5-turbo-16k”, the stories start without too much overlap in the wording and with some sense of uniqueness. Nevertheless, reading a few posts in a row already shows some lack of originality, and we can easily see the repetitiveness in the title’s names, with 15% of novels have the last chapter as “The Final…”.
It seems novels could be more unique if using “gpt-4” for step 3, but my current plan is to enhance our contextual RAG-based architecture to have more information on different writing styles, story types, and themes. Therefore, I can see ourselves requiring the extended 16k context (and the less expensive) benefits that “gpt-3.5-turbo-16k” provides.
In addition, I am getting expired by ChatDev and adding a persona-like context in step 1 and 3, basically suggesting the model to act as an editor in step 1, and a writer in step 3. I am using the RAG approach to create the persona based on the step 1 story script, so the editor basically suggests the writer that is best suited for that story to be responsible for writing a given novel.
With that in mind, my next goal is to enhance the context and start fetching other source news to write novels in more styles. The specific next step is to bring tech news from the Verge as novels in the third person. We will use this recipe and basically test different writing styles with varying sources of news.
Leave a comment