Learning Policies for Variable Numbers of Entities

You are reading version 1 of this direction, frozen 2026-10-04. The latest version is version 2.

Version 1 of 265 papers66 conceptsfrozen 2026-10-04

In standard deep learning, we typically treat the world as a fixed-dimensional vector. If you are training a robot to pick up a block, your neural network expects a specific number of inputs: the block’s X, Y, and Z coordinates. But what happens when the robot encounters a pile of coins, or a swarm of drones, or a computer network where nodes are constantly being added and removed?

Traditional architectures like Multi-Layer Perceptrons (MLPs) break in these scenarios. They are hard-wired to specific "slots." If a model is trained to track five agents and a sixth appears, there is no place to put the data. This "fixed-input bottleneck" has forced researchers to use inefficient workarounds like zero-padding (filling empty slots with useless data) or data clipping (ignoring entities that don't fit), both of which compromise the agent's situational awareness.

To solve this, a growing body of research focuses on architectures that treat the environment not as a fixed vector, but as a variable-length set of entities.

The Permutation Invariance Problem

The first hurdle in processing a variable number of objects is that the order in which you list them shouldn't matter. If a self-driving car sees two pedestrians, the policy should be the same whether Pedestrian A is listed first in the data or Pedestrian B is.

Yangang Ren and colleagues addressed this in Self-learned Intelligence for Integrated Decision and Control of Automated Vehicles at Signalized Intersections by proposing permutation-invariant representations. Instead of feeding raw coordinates into an MLP, they use an encoding network to process each entity independently and then apply a symmetric operator—like a summation or a mean—to collapse them into a single, fixed-size "context" vector.

A similar approach, called Encoding Sum and Concatenation (ESC), was shown to reduce policy errors by over 60% in autonomous driving tasks. By decoupling the number of entities from the dimensionality of the input, these models can handle any number of traffic participants without manual sorting rules.

Relational Reasoning with Graphs

While simple summation works for basic awareness, complex tasks require understanding how entities interact. In Symbolic Relational Deep Reinforcement Learning based on Graph Neural Networks, Jaromír Janisch and his team argue that we should represent states as graphs.

In a graph-based policy, each entity is a node, and their relationships are edges. Because Graph Neural Networks (GNNs) use message-passing—where nodes update their state based on their neighbors—the architecture naturally scales. You can train a GNN on a small task with three blocks and then deploy it on a task with twenty. This leads to zero-shot generalization: the agent learns the "logic" of the task (e.g., "stack the smaller block on the larger one") rather than just memorizing a specific spatial configuration.

This relational approach is particularly powerful for "open" environments. Arrasy Rahman demonstrated in Towards Open Ad Hoc Teamwork Using Graph-based Policy Learning that GNNs allow agents to "plug and play" into teams where the number of teammates changes mid-mission. The agent doesn't need to know the team size in advance; it simply processes the available "nodes" in its current local graph.

Transformers and Entity-Based Attention

The most recent shift in this field involves moving from graphs to Attention Mechanisms. While GNNs are great for explicit relationships, Transformers allow the model to discover which entities are important on the fly.

In On the Use and Misuse of Absorbing States in Multi-agent Reinforcement Learning, researchers at Unity Technologies introduced MA-POCA. They realized that in many games and simulations, agents "die" or "spawn" frequently. Instead of using "absorbing states" (placeholders for dead agents), they used self-attention to let the model focus only on the active participants. This solved the problem of Posthumous Credit Assignment, allowing the system to reward agents for actions that helped the team even after those agents had left the environment.

This "entity-as-token" philosophy is also being applied to robot morphology. Brandon Trabucco developed AnyMorph, which treats a robot’s sensors and motors as a sequence of tokens. Because the Transformer doesn't care how long the sequence is, a single policy can control a four-legged robot, a six-legged robot, or a robot that has lost a limb, simply by attending to the available hardware.

Why It Works: The Intuition of Modularity

The core intuition behind all these methods—whether they use Deep Sets, GNNs, or Transformers—is modularity.

By moving away from fixed-size vectors, we stop asking the neural network to learn a "global map" of the world. Instead, we ask it to learn a local rule for how to interact with an entity.

When the network learns how to relate to an object rather than the third slot in an input vector, it gains the ability to scale. This shift from "spatial memory" to "relational logic" is what allows AI to move out of the laboratory and into the messy, fluctuating reality of the physical world.

Papers in this version

Showing 60 of 65 papers.

History & citationVersion 2 · 2026-10-04

Current · Permanent link

  1. Version 2 (latest) · 2026-10-04 · 75 papers
  2. Version 1 · 2026-10-04 · 65 papers
Cite this direction

Latest version (a living page):

@misc{lacuna_dynamic_input_dimensionality_522717fc,
  title = {dynamic input dimensionality},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/dynamic-input-dimensionality/rdr_522717fc2549440db995578e7a31c628},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-23},
}

This exact version (version 1, frozen text):

@misc{lacuna_learning_policies_for_variable_numbers_o_522717fc_v1,
  title = {Learning Policies for Variable Numbers of Entities},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/learning-policies-for-variable-numbers-of-entities/rdr_522717fc2549440db995578e7a31c628/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-23},
}