Hacker News new | ask | show | jobs
by pitched 15 days ago
An approach I like to help solving this is antagonistic or review agents. The first agent decides that eye glows turn NPCs into enemies, the second agent is fully dedicated to deciding if that is valid. If the review fails, it leaves notes and the original agent tries again.
3 comments

This is also the best approach I've found thus far when I'm seeing how well LLMs can form narrative content.

I don't frame its prompt as antagonistic though - I've found in the past (with weaker models, so YMMV) that this can be overly officious, sometimes blocking more creative outputs that you'd want to retain.

The structure I've found that works best is to have six or seven agents chained, each roughly mimicking a part of the mind, or a role in film production. Broadly:

- A high-temp "Id" agent, tuned to output only vaguely related noise. This really helps creativity.

- An "Ego" agent, who receives the "Id" noise and is then given the initial response task.

- A low-temp "Super-Ego" or "script supervisor" agent, who can grep back across longer contexts to check detail, and is asked to ensure that the initial response is within narrative reason. Not telling it that one role of the dialogue was "user" and one was "assistant" really helps with it not siding with the user.

- A "continuity editor" agent, who is explicitly tasked with world and character lore-checking, building and updating character & world MD docs, etc.

- A "prose editor" agent, whose sole task is to ensure it's tonally in-line with initial guidelines.

You can add more as needed, depending on what is important to you.

I think expecting competent narrative from a single model is a big ask. When writing and telling or performing a story, you have to engage several different parts of the brain, with very different tasks. The creative part of the brain has to have lots of bad ideas in it to surface a compelling idea; the parts dealing with immersion and/or realism have to incredibly restrained.

The Id agent is very important. By appending 100 tokens of noise to a prompt asking: "Write a short story about [subject]", then asking an LLM to blindly score the short stories generated across a range of creativity metrics (such as they can exist!) I personally saw a ~40% score increase vs control over 3k short stories.

I’ve never seen the Id approach before, that’s a good idea ! Though I was wondering how do you manage to keep costs low within the 7 agents ?
The whole thing was borne out of wanting to keep costs low! My favoured approach (last time I was doing this) is using only a tiny sliding context window based on message pairs, rather than tokens, and only for the agents that need it. Amending prose style, for example, shouldn't need context beyond the message it's working on, and then its system prompt.

For the models that require context, I personally found combining a tiny sliding window with a lazy version of the "Recursive Language Models" approach broke immersion least often and had a significantly lower cost. That + the "Id noise" + the strict agents also allowed cheaper models to overperform for me personally.

My lazy version of the RLM approach is basically just giving the agent a grep tool across the full message history & "lore" documentation created by agents, combined with repeated, low-context turns, and a "submit answer" tool for when it felt like it had finished working.

When I looked at the internals of what each agent turn looked like, it did look like a complete mess - but the context window only needs to surface the things it actually needs to know each turn.

Short outputs help a lot with immersion, too - brevity means there is a lot less you can get wrong, and also aids response time & cost.

It does take me an awful lot of prompt tuning to get what I want creatively from LLMs in any format, especially weaker models working in this chain, but I think that's likely always going to be true. Art can have rules, but that doesn't make it science :-)

The RLM approach is detailed here, and I've found it really useful for any cost-sensitive/long-context task: https://alexzhang13.github.io/blog/2025/rlm/

Is this lazy version of RLM where we use subagents and get them to output markdown documents? With one root agent coordinating, it can create a reasonable prompt and provide paths to the markdown documents for the next agent. This keeps context really low because each subagent is filtering the context needed for the next by bouncing it through that document.

Proper RLM looks like you’re allowing agents to directly modify their own context though, like closing browser tabs they don’t need anymore. I haven’t seen anyone actually doing this though.

When I'm doing it, it depends on whether the agent has ownership of an MD (or other) doc in the flow. If they do, this remains either in-context or greppable, each fresh-context turn.

If not, my agent-level chains just look like:

'''

Turn 1: OK, my task is X, so I should grep for it. Oh, it produced these results:

(Message pairs)

I should expand the context around those message pairs that look relevant.

(3 message pairs around search result)

I should save 1 of these, as it contains relevant information.

[Enforce Tool call limit]

[Delete all context added, except the search tool used already, and the relevant result(s) found.]

Turn 2: OK, my task is this, and it seems I already have this result, but I still need...

...

Turn 10: OK, after that search, my answer is:

[Response]

'''

I've never bothered to let agents self-remove from context, so I would guess it's 'lazy' in that sense. It seems more complex than the task requires in this case, though I can see the benefits on more complex tasks. If you're already saying "this is relevant info", I figure it's simplest to just enforce deletion of everything not marked relevant. In chained prompts, when you're trying to keep costs low and use weaker models, it seems best to limit decision-making as much as possible to make the models as deterministic as possible (on really dumb tasks like, "What is the colour of this goblin's hair?").

There are likely other parts of the actual paper's implementation where the ways I'm implementing it are lazy (because I'm doing this stuff for artistic/fucking around reasons, rather than to advance the field, or implement perfectly), and I think there are various interpretations of what "RLM" should mean. But I found the original paper very helpful, with lots of interesting ideas in, and think it's one where people can take what they need from.

Well, I had not heard of RLM before, just read the paper, thank you for introducing me to your lazy version !
Does the continuity agent create lore entries for planned-but-unrevealed stuff as well, so things that might happen in future?
For me: Kind of.

I find agents will reveal information marked as "lore" (or similar) almost immediately once it's in-context.

One thing I've tried when playing with longform fiction or screen stuff, where you have an expected wordcount or page count to structure around, and the audience has less agency - I've not experimented with this for a DnD-like interactive narrative - is to use an agent that will design context additions like "this information is revealed" to be triggered in X number of words/pages, and simply do not include it in-context until that time.

This needs heavy quality control from new, separate agents with further turns, also, or you end up with incomprehensible constantly-twisting narrative soup.

I expect you could do something similar for message-pair-based participatory storytelling formats like DnD.

Another approach I've tried which I think would be more suited to interactive storytelling is to have the agent tasked with designing characters/setting information include the twists a % of the time, and to include a trigger for that reveal. "If asked about X, they say Y".

Then I remove these from the context for all agents.

Then I run an agent which is looking for the pre-defined triggers each turn.

When the agent sees a pre-defined trigger appear in the story, it adds the pre-defined reveal back in to the context/lore.

Again, you need to run a quality control / superego across that to check it still works, and amend or remove it suitably if it doesn't! It gets convoluted fast.

"Revealed information" is, I think, significantly more of a strain on general immersion, because it inherently contains surprise for the reader or audience. So, I think tasking the agents doing any initial character or world design with "adding twists" makes sense, so revealed plot information isn't random-feeling or out-of-the-blue, but has intent and logic that fits the character or setting.

What would be "noise" in this context? Random words, random sentences, random complete short stories?
Uplift on "random dictionary words" (excluding 'stop words' & proper nouns) was ~20%; uplift on "random words from my local epub library" (same exclusion rules) was ~40%.

The random words from my local epub library (leans toward postmodern fiction) were definitely more evocative than the dictionary words when I eyeballed them.

I randomised each turn but kept the story prompt request the same across control, dictionary, personal library.

I must stress that I'm not claiming scientific method or certainty here - just sharing an approach that seemed to work well enough for me, and seemed like a reasonable conclusion: introduce noise, get more interesting output.

I haven't done the math but I think you'd need a much larger sample size than 1k per category to prove the uplift!

So far I only tried it with a single LLM in the dungeon master role. Your approach sounds promising (and I will definitly try it) but also a bit like a complicated workaround. What I mean: In games with humans the dungeon master is usually one person, not a whole council ;)
The magic of computers is that a complicated workaround can become modularized functionality very easiily.
The cost there is multiple rounds of review tokens making it both slow and expensive.
There are many models that are neither slow nor expensive that are suitable for targeted review tasks.
These things are still very far from human-level intelligence. Maybe a touch beyond a golden retriever in processing power. Ratcheting the intelligence up a notch from there is expensive. It’s a lot cheaper to simplify the problem it’s solving instead.
Man-computer symbiosis is the void: mechanically extended man or AI.

Distilling LLMs are a reversal of that.

But any competent human is also playing multiple roles mentally, mentally asking an entire series of questions about any new information. Discreet rounds of review emulate that. Write down the human process as a flow chart and then each interior node in the chart becomes a discreet review step with its own prompt.
If all or most LLMs are susceptible to failing this test, why would an LLM be a good means of evaluating performance on this test without being given a rubric?
Because evaluating a performance is different task from creating a performance. Someone who plays an instrument badly often has a different perception from someone who has to listen to it. ;)