NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Story Shaping: Teaching Agents Human-Like Behavior with Stories

Xiangyu Peng, Christopher Cui, Wei Zhou, Renee Jia, Mark O. RiedlAIIDE 2023

Abstract

Standard Reinforcement Learning (RL) agents are highly effective at optimizing for specific goals but often do so through erratic or non-human-like behaviors. This paper introduces Story Shaping, a novel framework that uses natural language stories to guide agents toward human-like behavior. By rewarding agents for aligning their internal world model with a "story view," researchers from Georgia Tech demonstrate that agents can follow social norms and adopt specific personas while maintaining high performance on primary tasks.

Introduction

Reinforcement Learning agents are notorious "reward hackers." If an agent's only objective is to reach a finish line, it will often take the most mathematically efficient path, regardless of how nonsensical or socially inappropriate that path might be. For instance, in a text-based simulation where the goal is to "go to work," a vanilla RL agent might exit its house without dressing or eating, simply because those actions do not explicitly contribute to the reward of reaching the office.

Humans, by contrast, rely on "tacit procedural knowledge"—a set of common-sense norms and routines. Manually encoding these behaviors into reward functions is a tedious process that fails to scale. Story Shaping addresses this by using stories as a dense, intuitive source of behavioral preferences, allowing agents to learn how to behave by following a narrative exemplar.

The Story Shaping Framework

The Story Shaping framework operates through a three-stage pipeline designed to translate narrative text into actionable reinforcement signals:

  1. Story to Knowledge Graph (Story KG): The system processes an exemplar story (e.g., "I wake up, eat breakfast, and take a shower") using Semantic Role Labeling (SRL) via VerbAtlas. This converts the narrative into a set of triples: (Subject, Relation, Object). These triples form a persistent "ideal" world state that the agent should strive to emulate.
  2. World Knowledge Graph (World KG): As the agent explores its environment, it maintains an internal map of its current state. This is populated using a question-answering model (ALBERT-QA), which asks questions such as "What am I carrying?" or "Where am I?" to generate a real-time World KG.
  3. Intrinsic Reward Signal: The agent is trained using the Advantage Actor-Critic (A2C) algorithm. It receives a standard environment reward for task completion, plus an intrinsic "shaping" reward whenever it performs an action that adds a new edge to its World KG that matches an edge in the Story KG.

Experimental Setup and Datasets

The researchers evaluated the framework across three distinct text-game platforms to test different aspects of behavioral alignment:

  • 9:05: A classic interactive fiction game used to evaluate "normative" routines, such as the sequence of actions required to get ready for work.
  • TextWorld (Shopping & See Doctor): Procedurally generated environments where agents must navigate public spaces (like malls or clinics), requiring adherence to social norms.
  • LIGHT: A large-scale fantasy role-playing environment used to test persona adoption. Agents were tasked with acting as specific characters (e.g., a Thief or a Thug) based on different exemplar stories.

Key Results and Insights

Human-Likeness and Performance

In the game 9:05, the Story-Shaped agent achieved a Commonsense Score of 3.90, vastly outperforming the baseline agent's score of 0.40. Critically, this adherence to norms did not come at the cost of task success; story-shaped agents maintained a 100% win rate across most tests. While these agents took more steps to complete tasks (as they were busy performing "human" actions like eating or showering), their behavior was significantly more logical to human observers.

Stories as Compact Abstractions

One of the primary advantages of this approach is that stories serve as efficient abstractions. They focus on salient actions and skip mundane details, yet provide enough of a "bias" to guide the agent's exploration toward sensible states. Furthermore, the framework intentionally ignores the strict order of events in the Story KG. This allows the agent to remain flexible; if an environmental constraint prevents one action (e.g., the shower is broken), the agent can still pursue other parts of the story (e.g., eating breakfast) without getting stuck.

Robustness to LLM Hallucinations

The researchers tested the system's robustness by using ChatGPT to generate exemplar stories. Even when the LLM "hallucinated" objects that did not exist in the game world (e.g., mentioning "coffee" in a game that only contained "tea"), the agent remained functional. It simply ignored the impossible triples and focused on the achievable goals, demonstrating that the framework is resilient to imperfect narrative inputs.

Conclusion and Future Work

Story Shaping provides a scalable way to inject human values and common sense into RL agents. However, some limitations remain. The current model lacks complex temporal logic, meaning an agent might occasionally attempt actions in an illogical order (like dressing before showering) if the rewards are equal. Additionally, the system currently relies on a single exemplar story.

Future research will focus on incorporating temporal constraints into the Knowledge Graphs and moving toward a "library" of stories. This would allow agents to draw from multiple narrative sources to handle more complex, multi-faceted tasks in dynamic environments.

Summary updated

BibTeX
@inproceedings{peng2023story,
  author = {Xiangyu Peng and Christopher Cui and Wei Zhou and Renee Jia and Mark O. Riedl},
  title = {{Story Shaping: Teaching Agents Human-Like Behavior with Stories}},
  booktitle = {AIIDE},
  year = {2023},
  doi = {10.1609/aiide.v19i1.27528},
}

Loading related content...

Figure