Is it possible to write longer stories without the AI hallucinating?

The context window is a killer when it comes to AI: you can only stuff so much relevant info into the prompt.


Recursive Reprompting and Revision

One way to avoid hallucination and get AI models to produce reliable output is to recursively reprompt them with prior information, and ask them to rewrite out inconsistencies...More


Mike Taylor

Built a 50-person growth agency.
💪 Useful 0
😓 Difficult 0
🎉 Fun 0
😴 Boring 0
🚨 Errors 0
😕 Confusing 0
🤓 Interesting 0
Premium subscription required.
Python experience recommended.
1. Scenario
Ultra HQ Editorial Meeting
You want to produce longer form stories with AI, but you find you can't fit enough info into the prompt to guide it to reliable results.
Dushyant Dixit
at Ultra

It's a tradeoff

Don't put enough context and the AI hallucinates

Put too much and you hit the token limit

There is a paper I read which helps you recursively build a coherent story using reprompting

Let me dig that out for you...

This course is a work of fiction. Unless otherwise indicated, all the names, characters, businesses, data, places, events and incidents in this course are either the product of the author's imagination or used in a fictitious manner. Any resemblance to actual persons, living or dead, or actual events is purely coincidental.

2. Brief

Recursive reprompting and revision is a technique for writing coherent stories that goes beyond the context length of traditional natural language processing (NLP) models. This technique was developed by a team of researchers to enable artificial intelligence (AI) to generate longer stories, and it involves using a plan and draft module, combined with a rewriting module.

In the plan module, the premise of the story is given. For example, a new law graduate who returns home to start a career while facing a broken justice system. This is then used to generate the setting and characters. For example, the two characters in the story could be Lela Smith and Toby Johnson. The main plot points of the story can then be outlined. In this case, the story follows the hero's journey template, with Lillyn and Toby discovering the broken justice system, fighting against injustices, and ultimately becoming respected advocates.

The draft module is used to generate the story. It works by first providing the previous summary and the upcoming passage. For example, if the previous summary is "Lula moves back to her hometown", the upcoming passage could be "She is dismayed to discover...". The draft module also uses the least to most technique, starting with the least amount of information (the premise) and gradually expanding to more information (the plan).

The rewriting module is used to correct any issues with the text, such as hallucinations, or facts that don't make sense. For example, if the story says that Lela and Toby have been friends for a long time, even though the previous text said that they only just met, the rewriting module would identify this inconsistency and correct it. It also works by progressively extracting facts from the text, building a list of facts as it goes. This allows it to check for inconsistencies between the old facts and the new facts in the text.

Overall, the recursive reprompting and revision technique is a great way for AI to generate longer, more coherent stories. It allows AI to be more creative, as it can generate stories that reflect the structure of successful stories, such as the hero's journey. It also prevents issues like hallucinations, as the rewriting module can identify any inconsistencies it finds.

3. Tutorial

00:01 Okay, so this is recursive, reprompting and revision. So this is a technique for writing coherent stories way beyond the context length.

Recursive Reprompting and Revision.ipynb
4. Exercises
5. Certificate

Share This Course