Introduction
Reinforcement learning (RL) is notoriously difficult when starting from scratch (tabula rasa). Agents often spend millions of steps flailing randomly before stumbling upon a reward. However, humans usually possess "obvious" prior knowledge about a task that could drastically accelerate this process. For example, in a video game, we intuitively know that jumping avoids pits or that specific items are required to craft others.
The challenge is that there has not been a unified, standardized way to impart this "advice" to an agent. Existing methods are often ad-hoc, hard-coded into specific algorithms, or limited to describing only a single facet of the environment (such as just the reward function or a partial policy). To address this, researchers have introduced RLang, a new domain-specific language (DSL) that allows humans to communicate partial world knowledge to RL agents. Unlike previous tools, RLang can describe every part of a Markov Decision Process (MDP) in an algorithm-agnostic way, significantly accelerating learning across diverse tasks.
The RLang Pipeline
The core contribution of the paper is the definition of the RLang DSL and its grounding semantics.
As illustrated in the pipeline above, the system operates in three primary stages:
- RLang Program: A user writes a script defining their domain knowledge. This can include State Factors (naming parts of the state vector), Propositions (boolean conditions like
at_workbench), Policies (suggested actions), and Effects (how actions change the state or provide rewards). - Interpreter and Grounding: The RLang parser converts this human-readable code into formal mathematical objects grounded in the MDP formalism $(S, A, R, T, \gamma)$. Crucially, it creates a partial world model. If the RLang script does not mention a specific state-action pair, the system simply flags it as "unknown."
- Informed RL Agent: Because the grounded output is a set of standard data structures (like partial transition and reward functions), it is completely algorithm-agnostic. Various agents—from simple tabular Q-learning to deep hierarchical methods like DDQN and policy gradient methods like PPO—can query this knowledge to guide their exploration and learning.
Key Advantages and Insights
- Completeness: RLang is the first DSL for RL that is "complete" in the sense that it can describe every element of an MDP, including state features, rewards, transitions, and hierarchical policies (options).
- Embracing Uncertainty: RLang does not require a full model of the world. It is designed specifically for partial knowledge. Agents use the provided "hints" where available and learn the rest through standard exploration.
- Algorithm Agnosticism: By separating the expression of knowledge from the exploitation of it, RLang allows the exact same piece of human advice to be utilized by entirely different types of RL algorithms.
- Vocabulary Grounding: RLang allows users to import "vocabularies" (like pre-trained visual classifiers), enabling the language to ground high-level terms (like "lava") to raw, high-dimensional observations (like pixels).
Experimental Validation
The authors evaluated RLang across several environments designed to test different types of knowledge, including a Lava-Gap gridworld, a 2D Minecraft environment (Craftworld), Taxi (Flat and Object-Oriented), and Classic Control tasks (CartPole, Mountain Car, Lunar Lander).
Across all experiments, RLang-informed agents significantly outperformed their tabula rasa counterparts:
- Faster Learning: In the Lava-Gap environment, informed Q-learning and RMax agents reached optimal performance much earlier by avoiding lava pits they already "knew" were dangerous.
- Jump-start Performance: In Lunar Lander and CartPole, providing a simple, non-optimal policy prior gave agents a massive "jump-start," allowing them to begin learning from a much higher baseline than random exploration.
- Solving Complex Hierarchies: In the 2D Minecraft task, providing the hierarchical structure (the "options") allowed a DDQN agent to solve a task that was nearly impossible for an uninformed agent to learn from scratch.
- Efficiency in OO-MDPs: In the Taxi domain, using RLang to describe object-oriented dynamics (e.g., "you cannot move through walls") allowed a DOORmax agent to converge much faster.
Limitations and Future Directions
While RLang provides a powerful way to express knowledge, the authors note that determining how an agent should best use that knowledge remains an active area of research. While they provided several "informed" versions of standard algorithms, more sophisticated integration methods likely exist.
A major future direction is using RLang as an intermediate representation for natural language. Instead of training an agent to understand English directly—a notoriously difficult task—researchers could use existing natural language processing tools to translate human speech into RLang. This would provide the precise, grounded "hints" the agent needs while maintaining a natural interface for the human user.
Summary updated