Reinforcement Learning (RL) agents often struggle with "hierarchical" tasks—complex challenges that require completing a specific sequence of sub-goals to succeed. For example, in a crafting game, an agent cannot smelt iron until it has acquired both iron ore and a furnace.
Standard RL agents typically attempt to learn the "utility" (expected reward) of every possible action at every step. If an agent tries to smelt iron without the right tools, it receives no reward. While it might eventually learn that smelting iron in that specific state has low value, this trial-and-error process is incredibly inefficient. Existing hierarchical methods often rely on rigid symbolic logic, like finite state machines, to track progress. However, these break down in stochastic environments. If an agent drops a required item, a history-based symbolic model might still think the next subtask is possible, leading to a reasoning dead-end.
To address this, researchers have introduced Hierarchical Affordance Learning (HAL), a framework that teaches agents to identify which high-level subtasks are actually possible in a given state before deciding which ones are useful.
The HAL Framework
By pruning impossible actions from the agent's search space, HAL enables significantly faster learning and greater robustness. The framework consists of several novel components:
- Milestones: Instead of relying solely on complex reward functions, the environment provides "milestones"—discrete symbols indicating subtask completion (e.g., "picked up wood").
- Affordance Classifier: A neural network predicts whether a specific milestone is immediately achievable from the current state without needing intermediate milestones.
- Affordance Masking: The "meta-controller" (the high-level decision-maker) has its choices restricted. It can only select subtasks that the affordance classifier deems possible.
- Context Learning: To handle the "chicken and egg" problem of learning affordances while simultaneously learning the tasks themselves, HAL uses a contrastive loss. This groups states together in an embedding space if they share the same "achievement context" (the same set of possible subtasks).
- False Negative Filtering (FNF): A major challenge in RL is that an agent might fail a task because it lacks the skill, not because the task is impossible. HAL uses a K-Nearest Neighbors (KNN) approach in the context embedding space to filter out these "false negatives," ensuring the agent doesn't prematurely prune a subtask it simply hasn't mastered yet.
Environments and Evaluation
The researchers evaluated HAL on two custom environments built on the minigrid framework:
- CRAFTING: A 2D grid-world inspired by Minecraft featuring a deep dependency hierarchy (e.g., logs → sticks → crafting bench → wooden pickaxe → stone → furnace → iron ore → iron ingot → iron pickaxe → diamond).
- TREASURE: A navigation and logic task where agents must manage a limited inventory, find keys, and use weight-based sensors to unlock doors in a procedurally generated layout.
Key Insights and Results
The core philosophy of HAL is "Possibility Before Utility". Pruning the search space based on what can be done is a powerful inductive bias that mirrors how humans navigate the world.
By grounding affordances in the current state (e.g., "Do I have the pickaxe in my inventory right now?") rather than a symbolic history ("Did I craft a pickaxe earlier?"), the agent naturally handles environmental changes, like losing an item or stumbling upon a shortcut. Furthermore, False Negative Filtering allows the agent to remain "optimistic," only pruning a subtask when it is statistically confident that it is truly impossible.
In empirical tests, HAL demonstrated several key advantages:
- Superior Learning Speed: In the CRAFTING environment, HAL reached a high success rate significantly faster than strong hierarchical baselines (like H-Rainbow) and performed nearly as well as an "Oracle" with perfect knowledge of affordances.
- Robustness to Stochasticity: When tested against "edge stochasticity" (where items randomly disappear from the inventory), HAL maintained a high success rate, whereas symbolic/history-based methods typically failed.
- Incomplete Specifications: HAL is robust to "missing" milestones. Even if some intermediate steps are removed from its vocabulary, it can still learn to bridge the gaps. Logic-based methods, by contrast, often require a complete, perfect hierarchy to function.
- Task-Agnostic Exploration: When trained without a specific end-goal (extrinsic reward), HAL agents explored the hierarchy much more deeply than baselines, successfully reaching rare milestones simply by following the "ladder" of possibilities.
Limitations and Future Work
While HAL presents a significant step forward, it has limitations. The current implementation relies on a predefined set of discrete milestone symbols, requiring a human to define what constitutes a "milestone." Future work could integrate HAL with automatic option discovery to learn these milestones directly from raw data. Additionally, extending hierarchical affordances from discrete grid-worlds to continuous state and action spaces (such as robotics) remains an exciting open challenge.
Summary updated