WorksComputer Science
When Does Opponent Modeling Pay Off? Spatial Inference Stabilises Reinforcement Learning under Partial Observability
Abstract
Deep reinforcement learning agents in partially observable competitive games must act on beliefs about an unseen opponent's intent. We study a spatial opponent model: a transformer trained with hindsight-relabelled opponent goals that outputs a subgoal heatmap from the opponent's observed trajectory, fused early into a dueling double DQN. In symmetric constant-sum foraging games with partial observability, the module stabilises training. Plain TD(0) DQN suffers degenerate seeds in three of four one-step configurations, whereas the opponent-model agent never collapses and, wherever training succeeds, recovers the majority of the symmetric game value. Transfers zero-shot to a foraging opponent unseen by the learner, with a positive goal advantage over the baseline, and loses this edge exactly where an information argument predicts: against a full-information tracking adversary whose intent is the learner itself, and on resource-dense maps where both agents saturate. A blindfold ablation, zeroing the heatmap at deployment, decomposes the advantage into two mechanisms: training-time stabilisation, which dominates where the credit assignment is hard and survives blinding on the dense map, and deployment-time inference, whose reliance shrinks as fog thins on the sparse map. We conclude that opponent-goal inference is a stability-and-transfer mechanism whose value is governed by measurable boundary conditions: visibility (fog thickness), opponent intent, and resource density.
Introduction
Competitive foraging [6] under fog (Figure 1) is a Partially Observable Stochastic Game (POSG) in which the pivotal latent is not where the opponent is, but where it is going. Classic DQN-style learners are hard to train in this regime: delayed sparse rewards combined with one-step temporal-difference learning (TD(0)) destabilise training.
Figure 1. The two foraging maps (11×11). MAP3 (left): five densely placed central goals; MAP4 (right): seven goals dispersed behind sectioned walls. Agents and foods spawn at fixed positions and compete for the resources.
The ability to reason about others’ behaviour can often be a defining factor between success and failure [1, 8, 14, 15, 18, 19, 23]. Relying solely on reactive policies is often insufficient. Instead, a prominent approach is to model the adversary directly, actively inferring their underlying strategies, intentions, or goals to anticipate future states. This approach is generally known as Opponent Modeling (OM). OM is usually evaluated only as “beats the baseline”, so we ask when it helps. The spatial opponent model and its ES formalism were introduced in prior work [16] for Fully Observable Stochastic Games (FOSG) [12]. Here we adapt it to partial observability, replacing privileged inputs with the fogged observation history and its first-order motion encodings, and fusing the inferred heatmap alongside learned belief channels. Using this adapted module, we contribute a boundary-condition analysis of when and why opponent-goal inference pays off.
Our contributions are: POSG instantiation of the spatial OM: The opponent model of prior work [16] re-instantiated for fogged observation histories, with motion-difference channels, hindsight supervision, and early spatial fusion in physical coordinates.
Stability: Across all training runs on two maps, the opponent-model agent never collapses, whereas plain DQN has degenerate seeds in three of four one-step configurations (every one-step configuration of the sparse map, and thick fog on the dense map).
In-distribution advantage: Where training succeeds, the opponent model recovers 95–99.9% of the symmetric game value against the training opponent (occasionally exceeding it by exploiting the suboptimal heuristic), versus 77–88% for the baseline on MAP4 and 52–107% per seed on MAP3, with degenerate TD(0) training runs finishing as low as 47%.
Generalisation across forager types: The paired advantage transfers to a foraging opponent unseen by the learner (+0.31–0.52) and, in well-trained scenarios, vanishes against a tracking adversary. Boundary conditions: The advantage disappears against opponents whose intent is the learner itself and saturates when resources are dense.
Mechanism: A blindfold ablation decomposes the advantage into training-time stabilisation and deployment-time inference, and shows inference reliance scales with fog.
Related Work
Opponent modeling has a long history, from theory-of-mind-style agent modeling [2, 17, 18] to game-specific predictors [4, 8]. Nashed and Zilberstein survey opponent-modeling methods and their design axes [14]. Closest to us, Yu et al. infer opponent subgoals and integrate them into policy learning [23]; their subgoal inference conditions on the full state, whereas we infer a spatial intent distribution from partial observations, and ask when the inference channel pays off rather than whether it improves a benchmark. Goal and plan recognition share our prediction target [5]; our hindsight-relabelled transformer (§ 4) is a lightweight online variant of such methods, using realised opponent outcomes as supervision in the spirit of HER [3]. Under partial observability, agent modeling has been tackled with recurrent opponent embeddings [15], Bayes-adaptive meta-learners [24], and policy-inference networks [10]; these predict opponent policies or types, not their spatial intent. Our games are partially observable stochastic games [7], and our contributions are orthogonal to MARL algorithmics: we modify the observation pipeline of a standard dueling DDQN [13, 21, 22] and measure the effect on training stability and transfer.
Problem Formulation
Definition 3.1 (Partially Observable Stochastic Game). A Partially Observable Stochastic Game (POSG) is a tuple
where:
is the set of agents.
is the global state space.
is the joint action space.
is the state transition function conditioned on joint actions, where denotes the probability simplex over the state space.
, , are the per-agent reward functions.
is the set of observation spaces .
, , are the per-agent observation functions mapping the global state to agent ’s observation space.
is the discount factor.
Foraging as a POSG. We model competitive foraging under partial observability as a two-player constant-sum POSG with agents , that represents the global state configurations that describe the positions of all agents, walls, foods, and the food’s state (present or eaten). The agents share the movement action set . is deterministic, meaning that the movement actions update the agent’s coordinates to the adjacent cell, agents automatically collect items upon entering a cell containing food if agent takes an action that would result in a collision with a wall or stepping outside the boundaries of the map, agent stays at its current position. Each episode places both agents in a finite set of food goals on a grid. Agent receives a reward if and only if it moves onto a cell containing food while the opponent is not present on that exact cell. If both agents enter the same cell containing food simultaneously, the food is split, yielding a reward of for each agent. In all other scenarios, including empty movements and wall collisions, the step reward is . Agent does not observe the true state : it receives a local observation restricted to a vision radius around its position, with cells outside the radius masked. Agents are also unable to see through walls. All agents additionally maintain belief channels (estimated food and opponent positions, updated on sighting), initialised from the environment’s opening state. The game is a partially observable multi-agent variant of the travelling-salesman problem, making the grids minimal instances of the problem class we ultimately target.
Explicit Sequential Subgoal Games. The ESS formalism and the spatial opponent model below were introduced in prior work [16]; we summarise them for completeness and describe our partial-observability adaptation. We now characterise the class of games for which inferring a spatial subgoal is the right prediction target. Many tasks are hierarchical: before winning, an agent must complete a sequence of intermediate objectives, or subgoals. Predicting the opponent’s full future state is unnecessarily noisy: the state carries contextual information that constrains movement but does not define the objective. We therefore decompose the state space as a Cartesian product where is the subgoal feature space, the state variables whose values complete the atomic objective (e.g. an agent’s coordinates), and is the context feature space, variables that constrain behaviour but do not define the objective (walls, free space). Let , for , be the projection onto .
Let be the rewarding states. We define the set of explicit subgoals . In the foraging POSG, is the pair of agent coordinates, collects walls and remaining food, and is the finite set of food coordinates.
Definition 3.2 (ESS game). A POSG is classified as an ESS game if and only if there exists a non-trivial decomposition of the state space such that , and the resulting set of distinct subgoals is finite.
The Spatial Opponent Model under Partial Observability
The Spatial Opponent Model (Spatial OM) was introduced for fully observable games in prior work [16]. Relative to that instantiation, partial observability requires three changes: (i) inference over a sliding window of logged observations rather than the full state, (ii) motion-difference channels as the primary sighting signal, and (iii) offline pre-training; in preliminary runs without it, the fusion channel is ignored by the Q-network and does not recover. The prediction target is unchanged: the adversary’s physical destination as a dense heatmap over the grid, with the ESS formalism restricting predictions to meaningful destinations.
Inference Model. The core of our module is the inference model , parameterised by (visualised in Figure 2). It approximates the opponent’s intended spatial destination at timestep , given the learner’s observation history and current observation, as a raw logit map over the grid.
Figure 2. Overview of the Transformer-based Spatial Opponent Model. The Transformer Encoder processes the sequence of past observations, attending to the current observation to output a 2D heatmap representing the inferred opponent subgoals. The Feature Embedder is detailed in Figure 3. The diagram also shows expected tensor shapes where: is the batch dimension, is the trajectory dimension, is the environment Feature dimension, and are the environment Height and Width dimensions, and is the embedding output dimension.
Let be the learner’s observation history over a fixed-length sliding window of maximum length (zero-padded for ). The architecture processes this sequence as follows:
Feature Embedding: Each observation in and the current observation are processed through a shared feature embedding. As depicted in Figure 3, the spatial tensor , formed by concatenating the observation with its first-order motion encoding , passes through a Convolutional layer with ReLU activation to extract local spatial features. The resulting feature map is downsampled, flattened and projected via a fully connected layer into a continuous vector of dimension . The motion channels are the key partial-observability signal: a negative difference marks a cell that just disappeared under fog or the opponent leaving the vision radius.
Figure 3. Feature embedding process inside the Spatial Opponent Model.
Transformer Encoder: A multi-layer Transformer Encoder with standard positional encodings processes the sequence; a boolean key-padding mask prevents self-attention from attending to unobserved history.
Spatial Head: To generate the prediction, the model extracts the “summary token” (the first output token, corresponding to the current observation ) and passes it through a shallow MLP that projects the vector back into the spatial dimensions , yielding the heatmap logits .
We define the probability of the opponent targeting a specific coordinate as the output of the inference model . The Spatial Head produces a raw logit map, . To ensure the final output represents a valid spatial probability distribution, we apply a Softmax activation function. This produces the predicted spatial intent heatmap , where each element represents the probability of the opponent targeting a specific coordinate conditioned on the learner’s current observation and observation history :
where the resulting heatmap is constrained such that the total probability mass sums up to 1:
By treating the opponent’s observable past as a sequence of tokens, the Transformer leverages self-attention to capture long-range temporal dependencies between historical movements and current intent. Training the model, however, requires ground-truth labels that are not directly observable in a decentralised multi-agent setting.
Hindsight Target Generation. To optimise the Spatial OM, the network requires spatial ground-truth labels. Because the opponent’s internal decision-making is not always accessible to the learner during an episode, we generate labels post-hoc with Hindsight Target Generation (strongly related to Hindsight Experience Replay [3]).
At the conclusion of an episode, the trajectory is analysed backwards to determine the opponent’s achieved subgoals. If the opponent successfully reaches a food at timestep , that coordinate becomes the ground-truth subgoal for the preceding sequence; if the opponent fails to reach a definitive objective before the episode ends, their final occupied position becomes the fallback target. To account for spatial uncertainty and avoid overly sparse gradients, we transform this single coordinate into a continuous target intent heatmap by applying a 2D Gaussian smoothing kernel with variance centred at the target coordinate:
Algorithm 1 Hindsight Subgoal Labelling with Gaussian Smoothing
Require:
Logged episode : the learner’s observations , the opponent’s rewards , and the pre-step and post-step privileged global states and (used for labelling only)
Grid dimensions , Smoothing variance
1: ▷ Current true goal coordinate 2: ▷ Target map for the next state
▷ Fallback goal for unsuccessful or truncated episodes
3: if is not empty then 4: 5: if then 6:
▷ Backwards Relabelling Trajectory
7: for downto 1 do 8: 9: if then ▷ Opponent achieved an objective (e.g., reached food) 10: 11: 12: if then 13: ▷ Assign one-hot target 14: ▷ Generate dense soft-target map 15: Label to transition as true_goal_map 16: Label to transition as true_goal_map_next 17: ▷ Carry target map backward 18: return Labelled episode
This smoothing provides a dense learning signal, penalising “near-misses” less severely than spatially distant errors. The systematic process for extracting these labels from raw trajectories is detailed in Algorithm 1.
Training Objective. Because is a continuous Gaussian density, we normalise it to a valid probability distribution (summing to 1 across the grid) and optimise the network against it with the KL Divergence objective:
This encourages the Transformer to capture the regional spatial intent rather than memorising discrete coordinate points.
Feature fusion. The Q-function is conditioned on the inferred intent: .
A low-dimensional latent summary of the opponent’s intent is easily drowned out by the far larger flattened spatial embedding of the Q-network’s CNN, so the intent signal is kept in physical coordinates: in an ESS game the opponent’s intent is tied to the grid’s physical layout. The Spatial Head therefore projects intent back into a heatmap, and the resulting (Eq. (1)) is concatenated as an additional channel of the network input (early spatial fusion) as depicted in Figure 4. The Q-network’s CNN thus sees the opponent’s likely destination as a heatmap overlaid on walls, food, and the agent’s own position, and learns their geometric relationships directly.
Figure 4. OM Dueling Q-Network. The observation and belief channels are concatenated with the inferred heatmap and processed by the CNN; Advantage and Value heads compute the final Q-values by Equation (6).
Let be the learner’s observation with feature channels, and with belief feature channels. This belief map is shared by all compared architectures. The inferred heatmap is concatenated with both along the feature dimension:
The embedding is processed by the dueling heads [22], which separate state value from per-action advantages . The final Q-value is computed as:
The Q-network is optimised with the double-DQN update [21]: the online network selects the greedy next action and the Polyak-averaged target network evaluates it, with target
and loss Huber [11] (Algorithm 2).
Pre-training the opponent model. If the Spatial OM and the Q-network are trained concurrently from random initialisation, the early heatmaps are indistinguishable from uniform noise; the Q-network’s CNN quickly learns to assign near-zero weights to the heatmap channel, and once ignored the channel rarely recovers. We therefore pre-train offline before joint RL training. A supervised dataset of trajectories is collected by simulating games between heuristic agents (various pairings of the SIMPLE and GREEDY profiles, Section 5) and labelled via hindsight labelling (Algorithm 1). This grants the Spatial OM a foundational understanding of the grid’s topology, agent movement, and the environment’s rules, so that
Algorithm 2 DDQN with the Spatial OM (OM-DDQN) using HER
Initialise:
Replay Buffer
Agent Network , Target Network
Spatial Opponent Model
Pre-train:
Train on offline heuristic dataset labelled via HER.
Collect data:
for episode to do
Initialise environment, observe , set history , and local episode buffer
for step to do
Inference:
Predict subgoal heatmap:
Action:
Select using Boltzmann exploration on
Step:
Execute , observe reward and next observation
Update history: slide window of length
Store step data in local episode buffer
Hindsight Labelling:
Label the logged episode as described in Algorithm 1
Transfer local buffer to global Replay Buffer
Training Phase:
Sample batch of transitions and sequences from Train OM Dueling Q-Network
Generate next step heatmaps using the Spatial OM inference
Select next actions
Calculate target
Compute Loss
Update via gradient descent
Update target network (Polyak): Train the Spatial OM
Compute using KL Divergence against normalised soft targets
Update via gradient descent
when joint OM-DDQN training begins (Algorithm 2) the Q-network receives structurally meaningful intent predictions from the first episode and integrates the heatmap channel during value estimation from the outset.
Experimental Setup
Environment. Foraging under partial observability (Section 3) played on two symmetric grids (Figure 1): MAP3 (dense central food, 5 goals) and MAP4 (sectioned walls, dispersed food, 7 goals), with fixed spawn and goal positions and vision radius (fog thickness). The symmetry and game rules ensure that each agent’s game value is half of the total food. Greedy vs greedy play shows this empirically (MAP3: 2.50/2.50; MAP4: 3.42/3.42).

Figure 5. Example of Spatial OM predictions on MAP4 (vision radius 2). Left: the learner’s observation under fog; the learner (green dot) sees only its surroundings, while the opponent’s true position (dark red when obscured by fog) and the food (green squares) are shown for reference. Middle: the OM’s predicted subgoal distribution fed to the Q-network. Right: the opponent’s true subgoal distribution, that is not accessible during match. The OM concentrates mass on the opponent’s actual target even when the opponent is outside the learner’s vision radius.
| Learning rate | Adam: (Q), (OM) |
| Discount / soft update | 0.985 / 0.001 |
| Batch size / train frequency | 128 / every 4 steps |
| Replay capacity | 450,000 |
| Episodes | 30,000 (60 epochs×500 episodes), max 50 steps |
| Boltzmann | 1.5 → 0.05 over 650k steps |
| Label smoothing | 2.0 → 0.5 over 150k steps |
| OM pre-training | 20 epochs heuristic self-play |
| Q-net | 3×Conv3×3 (), dueling heads 256 |
| OM transformer | , 2 layers, 4 heads, , dropout 0.05, history length 50 |
Table 1. Shared training hyperparameters and network sizes (both learning agents).
Opponents. All opponents share the learner’s action space and movement rules and act on their own partial observations (same vision radius). SIMPLE commits to a randomly believed food and replans when it is consumed or seen as collected. GREEDY targets its nearest believed food and switches away whenever it believes the learner is closer. ORACLE-STALKER (also denoted as “tracker”) sees the true state regardless of fog and races to the food nearest the learner that it can still reach first, loitering there to deny collection.
Training. Dueling DQN, -step returns [20], belief-map prior (belief map off/on), 60 epochs, 3 seeds per configuration, against the GREEDY opponent. Training used a single Tesla V100-SXM2-32GB GPU per run, taking about 7 hours plus per-epoch evaluation (classic OM and OM combined). Zero-shot evaluations ran on an Apple M3 Pro (12-core CPU, 18 GB RAM). Table 1 lists the shared hyperparameters.
†Excluding one collapsed CLASSIC seed (see Limitations); the collapse is reported as a finding.
Zero-shot evaluation. Checkpoints are evaluated against GREEDY (the training opponent), SIMPLE, and ORACLE-STALKER, with seatswap probability 0.5 and 1000 episodes per seed. We report differences paired by training seed (; the same seed index for both agents), split by -step configuration (pooled only where stated, as in the belief-prior comparison), mean ± std over seeds.
Results
Training stability. Plain DQN is unstable at (Figure 6). On MAP4 one CLASSIC seed collapses outright in and all three seeds finish at 37–46% of game value (1.3–1.6 of 3.5); on MAP3 at thick fog all seeds finish at 47–68% of game value (1.17–1.71 of 2.5). OM never collapses and never finishes below 80% of game value on MAP3 (floor 2.03 of 2.5). Across all zero-shot batches on both maps, seed-level standard deviation is 1.4–3.6× smaller for OM (MAP4: 0.16–0.31 vs. 0.50–0.79).
Figure 6. Per-epoch evaluation return against the training opponent, per seed: classic (blue) vs. om (orange), belief prior off. Top row map4, bottom row map3. classic degenerates at : on map4 one seed collapses outright, all three seeds finish below 1.7 of 3.5, and on map3 all seeds in the cell finish below 2.0 of 2.5 (thin fog recovers). om never collapses on either map.
In-distribution performance. Against the training opponent (Figure 7), OM recovers 95% (MAP4, ) to 99.9% () of the game value in well-trained () cells; CLASSIC reaches 77–88%. On MAP3 both agents reach 96–101% at , since the game is saturated. Under thin fog both even exceed the game value on average (104% for OM, 101% for CLASSIC; individual seeds up to 107%): a best response to the suboptimal training heuristic. Thick fog separates them: in the hard cell (, ) CLASSIC degenerates to 52–76% per seed (64% on average), because exploiting an opponent you rarely see requires predicting it.
Figure 7. Zero-shot return as a share of the symmetric game value, by opponent and cell (dots: seeds; bar: mean; dashed: game value). Left: map4 (prior off; collapsed classic seed excluded). Right: map3 (prior on/off pooled, 6 seeds per cell). Both agents exceed 100% under thin fog (best-response exploitation of the suboptimal heuristic) and both saturate on the dense map wherever training succeeds.
Opponent spectrum. The advantage transfers across forager types, seen or unseen, and in well-trained scenarios disappears against the tracker (Table 2). SIMPLE is unseen by the learner, but its profile appears in the OM’s offline pre-training corpus (§ 4), so this tests the learner’s policy’s transfer, not the OM’s. This fits an information argument. A forager’s intent is a fact about the environment: its trajectory reveals it, and the learner’s fogged observations do not contain it. A tracker’s intent is the learner itself, so predicting it is redundant with self-knowledge. Tracking is also costly for the tracker: total extraction drops from ~7 goals (against foragers) to
| Opponent | Fog | ||
| GREEDY (seen, forager) | +0.64 ± 0.20 | +0.71 ± 0.08† | |
| GREEDY (seen, forager) | +0.41 ± 0.07 | +1.50 ± 0.26 | |
| SIMPLE (unseen, forager) | +0.31 ± 0.31 | +0.66 ± 0.05† | |
| SIMPLE (unseen, forager) | +0.52 ± 0.10 | +1.16 ± 0.05 | |
| ORACLE-STALKER (tracker) | +0.12 ± 0.39 | +0.52 ± 0.13† | |
| ORACLE-STALKER (tracker) | +0.02 ± 0.09 | +1.13 ± 0.27 |
Table 2. Paired zero-shot advantage (mean ± std over seeds) by opponent, fog, and -step horizon on MAP4 (prior off). : well-trained cells; : cells where CLASSIC training is unstable. Seen forager means that the learner has trained against the opponent; unseen forager means that the opponent is not in the learner’s training set. Dense-map (MAP3) deltas are reported in the text and Table 3.
~3.5, as the tracker spends roughly 2.2 goals of its own foraging to remove about 1 from the learner.
On the dense map, pooling prior on and off, the paired advantage concentrates in one hard cell (, ): +0.57 vs. GREEDY, +0.52 vs. SIMPLE, +0.48 vs. the tracker. Wherever CLASSIC trains, the map saturates and the advantage falls to at most +0.13 against foragers and +0.23 against the tracker. The tracker at the hard cell is our mechanism probe: the advantage survives (+0.48), and blinding the heatmap leaves it nearly intact (+0.44, Table 3). Against a tracker, the gap is training-time stabilisation, not inference.
| Map / opponent | Cell | OM | OM blind | blind | |
| MAP4, GREEDY | , | 3.33 | 2.23 | +0.64 | −0.47 |
| MAP4, GREEDY | , | 2.86 | 2.43 | +0.71† | +0.28† |
| MAP4, SIMPLE | , | 2.77 | 2.10 | +0.31 | −0.37 |
| MAP4, SIMPLE | , | 2.55 | 2.31 | +0.66† | +0.42† |
| MAP4, ORACLE-STALKER | , | 2.09 | 1.71 | +0.12 | −0.26 |
| MAP4, ORACLE-STALKER | , | 2.10 | 2.10 | +0.52† | +0.52† |
| MAP4, GREEDY | , | 3.50 | 3.02 | +0.41 | −0.07 |
| MAP4, GREEDY | , | 3.17 | 2.50 | +1.50 | +0.84 |
| MAP4, SIMPLE | , | 2.81 | 2.57 | +0.52 | +0.28 |
| MAP4, SIMPLE | , | 2.54 | 2.31 | +1.16 | +0.92 |
| MAP4, ORACLE-STALKER | , | 2.29 | 2.17 | +0.02 | −0.10 |
| MAP4, ORACLE-STALKER | , | 2.50 | 2.24 | +1.13 | +0.87 |
| MAP3, GREEDY | 2.18 | 2.13 | +0.57 | +0.53 | |
| MAP3, SIMPLE | 1.67 | 1.64 | +0.52 | +0.48 | |
| MAP3, ORACLE-STALKER | 1.71 | 1.68 | +0.48 | +0.44 | |
| MAP3, GREEDY | 2.60 | 2.44 | +0.07 | −0.09 | |
| MAP3, SIMPLE | 2.44 | 2.29 | +0.12 | −0.03 | |
| MAP3, ORACLE-STALKER | 2.04 | 2.03 | +0.23 | +0.21 |
Table 3. Blindfold ablation: heatmap zeroed at deployment. Mean OM return over seeds; paired by training seed, zero-shot. MAP4: prior off, -split; MAP3: , prior on/off pooled, 6 seeds; vs. the opponent shown.
Ablating the inference channel. Table 3 completes the grid: all three opponents, both fog levels, and both returns configurations, with the paired advantage computed within the same runs. The picture splits along training difficulty. In the well-trained cells (), blinding erases the entire advantage in five of six cells: against the training opponent at thick fog +0.64 → −0.47, against the unseen forager +0.31 → −0.37. The one exception keeps just over half (+0.52 → +0.28, unseen forager, thin fog). Where training succeeds, the advantage is inference. In the unstable cells (), an edge survives blinding against every opponent (+0.28 to +0.92 over CLASSIC, excluding the collapsed seed at thick fog): stabilisation that does not require the heatmap at deployment.
Reliance on the channel is strongest in distribution and in fog. The largest drop is against the training opponent at thick fog (3.33 → 2.23, leaving OM half a goal below CLASSIC), with a worst per-seed drop of 1.81. Across the well-trained cells the drop shrinks as fog thins (1.10 → 0.48 goals against the training opponent): the policy consults the heatmap in proportion to how much its own observations leave unknown. The unstable cells show no consistent fog scaling, so their stabilisation is fog-independent even where their inference is not. Blinding never collapses an om seed (per-seed returns stay above 1.5), so the drop mixes information loss with input corruption (see Limitations). Where training is hard, the opponent model contributes stabilisation; where training is easy, it contributes inference.
The tracker rows tell the same story on the sparse map. In the unstable cells the gap survives blinding almost fully (+0.52 → +0.52 at thick fog, +0.87 of +1.13 at thin fog): stabilisation. In the well-trained cells the advantage is small, but its blindfold response still tracks fog: near zero either way at thin fog (+0.02 → −0.10), yet at thick fog the channel is still consulted (+0.12 → −0.26, a 0.37-goal drop for om itself); the heatmap there carries not the target (the learner knows its own position) but the tracker’s approach under fog. An opponent whose intent is about the learner rather than the environment yields stabilisation, not inference.
On the dense map, blinding is nearly neutral at thick fog (at most 0.05 goals in every cell), so the whole +0.05 advantage there is stabilisation. The largest drops come at thin fog (−0.16 against the training opponent at ) and flip the paired advantage slightly negative (−0.09). With the game saturated there is little for inference to add. The fog scaling of inference therefore needs a cell that is not saturated, which the dense map lacks: itself a density effect.
Resource density. Table 4 completes the picture. Wherever classic trains successfully (≥ 90% of value), om also sits at the ceiling and the advantage is at most 0.23 goals. On a dense map a lost contest costs little because another goal is nearby, so predicting the opponent’s target is worth little: the advantage vanishes by saturation, not by failure. The stability effect replicates and depends on fog. At thick fog all six classic seeds fall below 2.0 of 2.5 (minimum 1.17) while om never drops below 2.03; at thin fog even classic recovers (minimum 2.08). Across both maps, the advantage shrinks with the difficulty reducers that stabilise classic training (denser map, longer -step horizon), from +0.5–1.5 goals in the sparse map’s unstable cells to +0.04 on the dense map under thin fog. Fog is the exception on the sparse map: at the gap widens as fog thins (+0.71 +1.50 vs. the training opponent), because om improves with visibility (2.84 3.17) while classic does not (2.1 1.7 goals excluding the collapsed seed).
Belief-map prior. On map3 the prior is neutral for om: the largest cell-level return difference between and is 0.18 goals, and its effect on inference quality is small and inconsistent in sign (−0.28 to +0.26). It partially rescues classic where TD(0) fails: at the hard cell (, ; zero-shot vs. greedy), classic rises from 53% to 75% of game value with the prior, while om remains highest (91%). Table 4 shows the same direction with smaller gaps (55.1% 65.8%, om 82.3–89.4%).
| Fog | Prior | CLASSIC | OM | ||
| 1 | off | 55.1 | 82.3 | +0.68 | |
| 1 | on | 65.8 | 89.4 | +0.59 | |
| 3 | off | 90.5 | 99.5 | +0.23 | |
| 3 | on | 98.4 | 99.8 | +0.04 | |
| 1 | off | 96.2 | 105.3 | +0.23 | |
| 1 | on | 104.0 | 106.9 | +0.07 | |
| 3 | off | 99.9 | 101.5 | +0.04 | |
| 3 | on | 97.8 | 99.6 | +0.05 |
Table 4. Dense map3 (game value 2.5 by symmetry): epoch-60 eval return vs. the training opponent as % of game value, mean over 3 seeds per cell. : paired OM–CLASSIC in goals.
The map4 replication turns this into a boundary condition. At thin fog the prior lifts the baseline (classic vs. the training opponent: 68% 84% of game value) while om gives up 0.3–0.6 goals. The paired advantage, pooled over the -split for this comparison, thus shrinks from +0.90/+0.96 to +0.60/+0.04 goals (thick/thin fog) and nearly vanishes against the tracker (from +0.51/+0.58 to +0.01/+0.24). Part of the prior-free edge was an information-starved baseline: a positional belief substitutes for subgoal inference at thin fog, but not at thick fog, where inference keeps a +0.6 goal edge over the baseline with the prior. The prior is a safe default for the baseline; the opponent model buys the thick-fog remainder.
Limitations
Three seeds per configuration. We report per-seed strip plots and never pool across -step configurations (except where stated, as in the belief-prior comparison), and several cells have seed-level standard deviations comparable to their means and should be read as non-significant. One classic seed on map4 collapsed during training and is excluded from paired statistics there, with the training curve cited as justification. Collapse frequency is itself reported. All results are best responses to a heuristic. In preliminary experiments, NFSP-style self-play [9] did not converge in the FOSG domain, so we make no MARL equilibrium claims. Published opponent-modeling methods assume different observation spaces (full state, action histories, or population priors). None infers spatial opponent subgoals from partial observations in this setting, so we compare against CLASSIC, whose -network matches the om -network on observation and belief channels and on capacity, differing only in the heatmap input, although that heatmap summarises an observation history CLASSIC does not see (see Conclusion). We fix the learner to value-based DQN methods because the claim concerns TD(0) stability under partial observability. Policy-gradient learners would change the failure mode rather than test it. Zeroing the heatmap is an input distribution shift. The drop measures information loss plus input corruption, not information loss alone. And lastly, this work focuses on grid foraging only, so scale is future work.
Conclusion and Future Work
Opponent-goal inference under partial observability is not a uniform advantage: its value is set by visibility (fog thickness), by whether the opponent’s intent is about the environment or about the learner, and by resource density. Its most robust benefit is making DQN training stable where plain TD(0) fails. We attribute the stabilisation to the module as a whole. Whether it stems from subgoal inference or from history-derived structured input is not isolated here. The blindfold ablation offers partial evidence: zeroing the heatmap, the only input beyond the channels shared with CLASSIC, costs the most deployment performance in the cells where the information argument says inference matters most (in distribution and at thick fog on the sparse map), consistent with the inference carrying information rather than acting as generic structured input. Future work scales these mechanisms to roadmap graphs of real-world maps, where foraging under fog becomes a multi-agent travelling-salesman problem under partial observability, in both competitive and cooperative settings, and replaces self-play with policy-space or population methods for equilibrium approximation.
Acknowledgements
I would like to thank my supervisor, Ing. Rostislav Horčík, Ph.D., for his invaluable guidance and support throughout this research. The authors acknowledge the support of the OP VVV “Research Center for Informatics”. The access to the computational infrastructure of the OP VVV “Research Center for Informatics” is also gratefully acknowledged.
References
References
- [1]Maruan Al-Shedivat, TrapIt Bansal, Yura Burda, Ilya Sutskever, Igor Mordatch, and Pieter Abbeel. 2018. Continuous Adaptation via Meta-Learning in Non-stationary and Competitive Environments. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net. https://openreview.net/forum?id=Sk2uIg-0-DOI
- [2]Stefano V. Albrecht and Peter Stone. 2018. Autonomous agents modelling other agents: A comprehensive survey and open problems. Artif. Intell. 258 (2018), 66–95. doi:10.1016/J.ARTINT.2018.01.002DOI
- [3]Marcin Andrychowicz, Dwight Crow, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, Pieter Abbeel, and Wojciech Zaremba. 2017. Hindsight Experience Replay. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett (Eds.). 5048–5058. https://proceedings.neurips.cc/paper/2017/hash/453fadbd8a1a3af50a9df4df899537b5-Abstract.htmlarxiv.org/abs/1707.01495
- [4]Sander C. J. Bakker, Pieter H. M. Spronck, and H. Jaap van den Herik. 2009. Opponent modelling for case-based adaptive game AI. Entertain. Comput. 1, 1 (2009), 27–37. doi:10.1016/J.ENTCOM.2009.09.001
- [5]Eugene Charniak and Robert P. Goldman. 1993. A Bayesian Model of Plan Recognition. Artif. Intell. 64, 1 (1993), 53–79. doi:10.1016/0004-3702(93)90060-ODOI
- [6]Filippos Christianos, Lukas Schäfer, and Stefano V. Albrecht. 2020. Shared Experience Actor-Critic for Multi-Agent Reinforcement Learning. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (Eds.). https://proceedings.neurips.cc/paper/2020/hash/7967cce8eab559e68cc944c44b1cf3e8-Abstract.htmlarxiv.org/abs/2006.07169
- [7]Heuer C. Hansen, Daniel S. Bernstein, and Shlomo Zilberstein. 2004. Dynamic Programming for Partially Observable Stochastic Games. In Proceedings of the Nineteenth National Conference on Artificial Intelligence, Sixteenth Conference on Innovative Applications of Artificial Intelligence, July 25-29, 2004, San Jose, California, USA, Deborah L. McGuinness and George Ferguson (Eds.). AAAI Press / The MIT Press, 709–715. http://www.aaai.org/Library/AAAI/aaai04-112.php
- [8]He He and Jordan L. Boyd-Graber. 2016. Opponent Modeling in Deep Reinforcement Learning. In Proceedings of the 33rd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016 (JMLR Workshop and Conference Proceedings, Vol. 48), Maria-Florina Balcan and Kilian Q. Weinberger (Eds.). JMLR.org, 1804–1813. http://proceedings.mlr.press/v48/he16.htmlarxiv.org/abs/1609.05559
- [9]Johannes Heinrich and David Silver. 2016. Deep Reinforcement Learning from Self-Play in Imperfect-Information Games. CoRR abs/1603.01121 (2016). arXiv:1603.01121 http://arxiv.org/abs/1603.01121
- [10]Zhang-Wei Hong, Shih-Yang Su, Tzu-Yun Shan, Yi-Hsiang Chang, and Chun-Yi Lee. 2017. A Deep Policy Inference Q-Network for Multi-Agent Systems. CoRR abs/1712.07893 (2017). arXiv:1712.07893 http://arxiv.org/abs/1712.07893
- [11]Peter J. Huber. 1964. Robust Estimation of a Location Parameter. The Annals of Mathematical Statistics 35, 1 (1964), 73 – 101. doi:10.1214/aoms/1177703732DOI
- [12]Michael L. Littman. 1994. Markov Games as a Framework for Multi-Agent Reinforcement Learning. In Machine Learning, Proceedings of the Eleventh International Conference, Rutgers University, New Brunswick, NJ, USA, July 10–13, 1994, William W. Cohen and Haym Hirsh (Eds.). Morgan Kaufmann, 157–163. doi:10.1016/B978-1-55860-335-6.50027-1DOI
- [13]Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin A. Riedmiller, Andreas Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. 2015. Human-level control through deep reinforcement learning. Nat. 518, 7540 (2015), 529–533. doi:10.1038/NATURE14236
- [14]Samer B. Nashed and Shlomo Zilberstein. 2022. A Survey of Opponent Modeling in Adversarial Domains. J. Artif. Intell. Res. 73 (2022), 277–327. doi:10.1613/JAIR.1.12889DOI
- [15]Georgios Papoudakis, Filippos Christianos, and Stefano V. Albrecht. 2021. Agent Modelling under Partial Observability for Deep Reinforcement Learning. In Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, Marc’Aurelio Ranzato, Alina Beygelzimer, Yann N. Dauphin, Percy Liang, and Jennifer Wortman Vaughan (Eds.). 19210–19222. https://proceedings.neurips.cc/paper/2021/hash/a03caec5c6dc82478fbf197475b48c05f9-Abstract.htmlarxiv.org/abs/2006.09447
- [16]Marcel Petran. 2026. Opponent Modeling in Zero-Sum Games. Master’s thesis, Faculty of Electrical Engineering, Czech Technical University in Prague, Prague, Czech Republic.
- [17]David Premack and Guy Woodruff. 1978. Does the chimpanzee have a theory of mind? Behavioral and Brain Sciences 1, 4 (1978), 515–526. doi:10.1017/S0140525X00076512
- [18]Neil C. Rabinowitz, Frank Perbet, H. Francis Song, Chiyuan Zhang, S. M. Ali Eslami, and Matthew M. Botvinick. 2018. Machine Theory of Mind. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholm, Sweden, July 10-15, 2018 (Proceedings of Machine Learning Research, Vol. 80), Jennifer G. Dy and Andreas Krause (Eds.). PMLR, 4215–4224. http://proceedings.mlr.press/v80/rabinowitz18a.htmlarxiv.org/abs/1802.07740
- [19]Roberta Raileanu, Emily Denton, Arthur Szlam, and Rob Fergus. 2018. Modelling Others using Oneself in Multi-Agent Reinforcement Learning. CoRR abs/1802.09640 (2018). arXiv:1802.09640 http://arxiv.org/abs/1802.09640
- [20]Richard S. Sutton and Andrew G. Barto. 2018. Reinforcement Learning - an Introduction, 2nd Edition. MIT Press. http://www.incompleteideas.net/book/the-book-2nd.html
- [21]Hado van Hasselt, Arthur Guez, and David Silver. 2016. Deep Reinforcement Learning with Double Q-Learning. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, February 12-17, 2016, Phoenix, Arizona, USA, Dale Schuurmans and Michael P. Wellman (Eds.). AAAI Press, 2094–2100. doi:10.1609/AAAI.V30I1.10295
- [22]Ziyu Wang, Tom Schaul, Matteo Hessel, Hado van Hasselt, Marc Lanctot, and Nando de Freitas. 2016. Dueling Network Architectures for Deep Reinforcement Learning. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016 (JMLR Workshop and Conference Proceedings, Vol. 48), Maria-Florina Balcan and Kilian Q. Weinberger (Eds.). JMLR.org, 1995–2003. http://proceedings.mlr.press/v48/wangf16.htmlarxiv.org/abs/1511.06581
- [23]Xiaopeng Yu, Jiechuan Jiang, and Zongqing Lu. 2024. Opponent Modeling based on Subgoal Inference. In Advances in Neural Information Processing Systems 38: Annual Conference on Neural Information Processing Systems 2024, NeurIPS 2024, Vancouver, BC, Canada, December 10 - 15, 2024, Amir Globerson, Lester Mackey, Danielle Belgrave, Angela Fan, Ulrich Paquet, Jakub M. Tomczak, and Cheng Zhang (Eds.). http://papers.nips.cc/paper_files/paper/2024/hash/6fb9ea5197c0b8ece8a64220fb82cdfe-Abstract-Conference.htmlDOI
- [24]Luisa M. Zintgraf, Kyriakos Shiarlis, Maximilian Igl, Sebastian Schulze, Yarin Gal, Katja Hofmann, and Shimon Whiteson. 2020. VariBAD: A Very Good Method for Bayes-Adaptive Deep RL via Meta-Learning. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net. https://openreview.net/forum?id=Hkl9JlBYvr





