Policy Learning from Tutorial Books via Understanding, Rehearsing and Introspecting

Xiong-Hui Chen, Ziyan Wang, Yali Du, Shengyi Jiang, Meng Fang, Yang Yu, Jun WangNeurIPS 2024

TL;DR

Researchers have developed a three-stage framework called URI (Understanding, Rehearsing, Introspecting) that allows AI agents to learn complex skills, like playing football, directly from tutorial books. By using Large Language Models (LLMs) to "rehearse" imaginary games and then distilling that knowledge into a policy network, the system outperforms direct LLM-based agents and even beats built-in game AIs—all without initial real-world interaction.

The Modality Gap in Reinforcement Learning

Traditional Reinforcement Learning (RL) is notoriously data-hungry. To learn a skill, an agent typically needs millions of trial-and-error interactions with an environment. Humans, however, have a shortcut: we read. We can pick up a textbook or a tutorial and gain a functional understanding of a task before ever attempting it.

Comparison of traditional RL and Policy Learning from Books

The challenge in AI is the "modality gap." Tutorial books are written in natural language, while a policy network (the "brain" of an agent) operates on mathematical parameters and state-space vectors. Current attempts to bridge this gap usually involve using an LLM as the agent directly, which is incredibly slow, expensive, and prone to "hallucinating" illegal moves. To address this, researchers introduce Policy Learning from tutorial Books (PLfB) to move beyond simple text-following toward true offline policy distillation from literature.

The URI Framework: Understanding, Rehearsing, Introspecting

To solve the PLfB problem, the authors propose the URI framework, which mimics the human learning process through three distinct stages:

The detailed architecture of the URI framework
  1. Understanding: The system uses an LLM to scan tutorial books and extract knowledge into a structured "Knowledge Database." Crucially, it converts text into pseudocode. Code is used because it is more precise than natural language but more flexible than raw neural network weights.
  2. Rehearsing: The agent performs "mental rehearsal." Using the extracted pseudocode and a small set of initial states, LLMs act as a world simulator (predicting rewards and next states) and a teacher policy. Together, they generate an Imaginary Dataset of decision-making trajectories. To ensure the LLM picks the right "lesson" for a specific game situation, the authors developed a "State-based Knowledge Scope Retrieval" method to bridge the gap between raw game coordinates and textual descriptions.
  3. Introspecting: Because LLMs can hallucinate or provide sub-optimal advice, the agent doesn't just blindly follow the rehearsal data. Instead, it uses Conservative Imaginary Q-Learning (CIQL). This offline RL technique treats the imaginary data as a starting point but adds "uncertainty penalties" to avoid regions where the LLM’s predictions were inconsistent or likely wrong. The final result is a compact, fast neural network policy.

Key Insights

  • Code as the Universal Translator: One of the core breakthroughs is using Python-style pseudocode as the intermediate representation. It forces the LLM to structure the book's knowledge into logic (if-then-else) that maps more cleanly to decision-making than prose does.
  • The LLM as a "World Model": Instead of just asking an LLM "what should I do?", URI uses the LLM to build a temporary, internal simulator. This allows the agent to explore "what if" scenarios entirely in its "mind."
  • The "BS Detector" (Introspection): The authors realized that LLM-generated data is noisy. By applying Conservative Q-Learning to the imaginary data, the agent learns to identify and ignore "hallucinated" successes, resulting in a policy that is more robust than the "teacher" LLM that created the data.

Datasets and Results

The researchers evaluated URI on two main benchmarks: Tic-Tac-Toe (TTT) (a proof-of-concept using manually constructed tutorials) and Google Research Football (GRF) (a complex 11vs11 physics-based simulator). For GRF, they curated a dataset of 90 football tutorial books from the RedPajama-1T open-source corpus. While the learning is from books, the agent was given 7,500 real-world starting states from the simulators to kickstart its "imagination."

Performance Highlights: * Football Mastery: In the complex 11vs11 football environment, the URI policy achieved a 37% winning rate against built-in AI. In contrast, an agent using GPT-3.5 directly (LLM-as-agent) only managed a 6% win rate. * Tic-Tac-Toe: URI achieved a minimum of 44% net win rate against GPT-based baselines. * Massive Efficiency Gains: By distilling the LLM's knowledge into a simple neural network, the final agent is 300x faster at making decisions than an agent that queries an LLM at every step. The distilled URI policy takes only 0.009 seconds per action, compared to 2.84 seconds for a standard LLM agent and 4.12 seconds for an LLM using Retrieval-Augmented Generation (RAG). This makes URI viable for real-time applications.

Limitations and Future Work

The authors acknowledge that URI is heavily dependent on the quality of the books. If a tutorial is missing key information about game dynamics or rewards, the "rehearsal" will be flawed. They also note that currently, the system only handles single-agent formulations for the football task, though the game is inherently multi-agent.

Future directions include integrating multimodal learning (like tutorial videos and match replays), combining book-learning with a small amount of real-world interaction to fine-tune the distilled policy, and developing automated metrics to evaluate the quality of text for policy learning.

Summary updated

BibTeX
@inproceedings{chen2024policy,
  author = {Xiong-Hui Chen and Ziyan Wang and Yali Du and Shengyi Jiang and Meng Fang and Yang Yu and Jun Wang},
  title = {{Policy Learning from Tutorial Books via Understanding, Rehearsing and Introspecting}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=Ddak3nSqQM},
}
Figure