[Paper Review] Learning Abstractions for Hierarchical Planning in Program-Synthesis Agents
TheoryCoder-2 autonomously learns reusable abstractions via in-context learning, enabling hierarchical planning with improved sample efficiency and generalization across diverse environments.
Humans learn abstractions and use them to plan efficiently to quickly generalize across tasks -- an ability that remains challenging for state-of-the-art large language model (LLM) agents and deep reinforcement learning (RL) systems. Inspired by the cognitive science of how people form abstractions and intuitive theories of their world knowledge, Theory-Based RL (TBRL) systems, such as TheoryCoder, exhibit strong generalization through effective use of abstractions. However, they heavily rely on human-provided abstractions and sidestep the abstraction-learning problem. We introduce TheoryCoder-2, a new TBRL agent that leverages LLMs' in-context learning ability to actively learn reusable abstractions rather than relying on hand-specified ones, by synthesizing abstractions from experience and integrating them into a hierarchical planning process. We conduct experiments on diverse environments, including BabyAI, Minihack and VGDL games like Sokoban. We find that TheoryCoder-2 is significantly more sample-efficient than baseline LLM agents augmented with classical planning domain construction, reasoning-based planning, and prior program-synthesis agents such as WorldCoder. TheoryCoder-2 is able to solve complex tasks that the baselines fail, while only requiring minimal human prompts, unlike prior TBRL systems.
Motivation & Objective
- Motivate the need for human-like abstraction learning to improve planning efficiency and generalization in AI agents.
- Develop a Theory-Based RL agent (TheoryCoder-2) that autonomously synthesizes high-level abstractions (PDDL operators) and grounds them with a low-level world model.
- Enable reuse of learned abstractions across multiple environments through curriculum-driven learning.
- Demonstrate improvements in sample efficiency and task success over baselines including LLM-assisted planning and WorldCoder.
Proposed method
- Extend TheoryCoder to automatically synthesize high-level abstractions with LLM in-context learning.
- Represent abstractions as PDDL domain and problem files for a hierarchical planner (Fast Downward) and ground them with a Python-based world model.
- Use a bi-level planning loop where a high-level planner selects abstract operators and a low-level planner executes grounded action sequences via the learned transition function.
- Ground predicate semantics with Python predicate classifiers learned from environment data.
- Iteratively refine the world model and abstractions via prompting the LLM with prediction errors and planning outcomes.
- Growing a library of abstractions through episodic curricula that group similar environments and promote re-use of learned operators and predicates.

Experimental results
Research questions
- RQ1Can TheoryCoder-2 autonomously learn abstract states and actions that transfer across different environments?
- RQ2Does reusing learned abstractions improve sample efficiency in new tasks?
- RQ3How does TheoryCoder-2 compare to baselines in terms of token cost, compute time, and solution rate across diverse domains (VGDL, BabyAI, Minihack)?
Key findings
- TheoryCoder-2 learns core abstractions (e.g., move_to) and reuses them across Labyrinth, Maze, and Sokoban.
- Abstractions learned by TheoryCoder-2 transfer to harder tasks (e.g., BabyAI Boss) and enable solving problems that baselines struggle with.
- TheoryCoder-2 achieves higher sample efficiency and competitive or superior solution rates compared to LLM-based baselines and WorldCoder, with lower token costs and faster planning.
- Abstractions learned by TheoryCoder-2 approach the quality of hand-engineered Oracle abstractions in performance.
- Curriculum-based learning and grounded, code-based abstractions contribute to faster synthesis and planning than prompting-based abstractions.
- Zero-shot transfer is observed in Minihack where a learned move_to abstraction enables rapid solving of subsequent tasks.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.