Introduction
Reinforcement Learning (RL) agents typically learn through trial and error, guided by a numerical reward signal. However, designing these signals—a process known as "reward engineering"—is often a significant bottleneck. OCALM (Object-Centric Assessment with Language Models) introduces a novel framework that allows agents to derive their own reward functions from natural language task descriptions by leveraging the reasoning capabilities of Large Language Models (LLMs).
The Challenge of Reward Engineering
In standard RL, agents start with no prior knowledge and must discover optimal behaviors by maximizing a scalar reward. For complex tasks, creating a balanced objective function requires expert intuition and often results in "black-box" models that are difficult to interpret or debug. While a human can easily describe the goal of a game like Freeway—"cross the road without hitting cars"—translating this into a robust mathematical signal is non-trivial.
OCALM addresses this by using LLMs to bridge the gap between human language and executable code. Unlike previous methods that might produce opaque reward models, OCALM generates interpretable Python code focused on the relationships between objects in the environment.
The OCALM Framework
The OCALM pipeline is a neurosymbolic approach consisting of three primary stages:
- Object-Centric State Abstraction: Using the OCAtari framework, raw pixel data is converted into a symbolic representation. This turns the screen into a list of objects with specific properties (e.g., position, class, velocity).
- LLM-Driven Reward Generation: The system uses a multi-turn prompting strategy to guide the LLM. It first extracts relational concepts (e.g., "is the player colliding with an obstacle?") before generating the final Python reward function. This structured approach ensures the rewards are grounded in logical object interactions.
- Policy Training: A standard RL agent, such as Proximal Policy Optimization (PPO), is trained using only the LLM-generated Python function as its reward signal.
Experimental Evaluation
The researchers evaluated OCALM across four Atari games: Pong, Freeway, Skiing, and Seaquest. These games provide a diverse set of challenges involving navigation, collision avoidance, and goal-seeking. By using OCAtari for ground-truth object data, the LLM could reason effectively about the game state.
Key Insights and Results
- Human-Like Inductive Bias: LLMs excel at reasoning about symbolic objects rather than raw pixels. By framing the environment as a collection of objects and relations, OCALM provides a powerful inductive bias that aligns agent learning with human logic.
- Competitive Performance: OCALM agents achieved performance comparable to agents trained on ground-truth game rewards. Notably, in Freeway, the agent reached near-perfect scores without ever seeing the actual game score during training.
- Interpretability and Debugging: Because the reward function is human-readable Python code, it is entirely transparent. Developers can inspect the logic, understand exactly why an agent is being rewarded or penalized, and manually refine the code if necessary.
- Relational Prompting: Ablation studies confirmed that forcing the LLM to define relational utility functions (like
detect_collision) significantly reduced logical errors and improved the quality of the generated rewards.
Conclusion and Future Directions
OCALM demonstrates that LLMs can successfully translate "common sense" task descriptions into functional, interpretable reward signals. While the current framework relies on external object extractors like OCAtari, future work could integrate learned object detectors to handle raw video input directly. By making reward functions readable and verifiable, OCALM moves the field toward RL systems that are more accessible, trustworthy, and aligned with human intent.
Summary updated