WorksComputer Science
Policy Invariance Is Not Learning Invariance: Potential-Based Reward Shaping for Navigation with a Limited View
Abstract
Potential-based reward shaping (PBRS) does not change the optimal policy, but how much it speeds up learning depends on the potential and on effects outside this guarantee. We analyse how PBRS changes the one-step reward while it preserves the discounted return: a per-step term, the terminal-state rule, a constant shift of the potential, and positive cycles in a bonus that is not potential-based. We then measure these consequences in pre-registered experiments with a PPO agent. The agent has a limited egocentric view and is tested on two MiniGrid navigation tasks (160 runs, 10 seeds per condition). On LavaCrossing, a geodesic (BFS) potential learned faster than both the sparse baseline and a Euclidean potential with a 7x7 and a 5x5 view (AUC difference +0.27 to +0.39, Holm p between 0.007 and 0.0499). The Euclidean potential did not differ from the baseline. In 20 runs with a non-potential bonus, none of the agents learned the task. The Euclidean potential caused more than twice as many deaths in lava during early training. View size did not detectably change the benefit of shaping. With a 5x5 view on SimpleCrossing, some BFS runs got stuck in loops and never learned; shifting the potential did not remove this, so the per-step term alone does not explain it.
Introduction
In recent years, reinforcement learning (RL) has been widely used in robot navigation, computer games, and autonomous systems ([28, 12, 9, 19]). This is because RL allows an agent to learn complex behaviours on its own by interacting with the environment. In many navigation tasks, agents get rewards only when they reach the goal. Also, agents cannot always see the whole environment. They can only see a small area around them and must find the right path while avoiding obstacles and dangerous areas. This creates a basic issue: to speed up learning, an additional guiding signal is needed, but the agent can be distracted from the original task if the signal is chosen badly (Ng, Harada, and Russell 1999).
A simple way to address the sparse-reward problem is to give the agent an extra bonus for every step towards the goal. But such a bonus can change the original task. As a result, the agent may learn to circle in place and collect the bonus instead of reaching the goal. Ng, Harada, and Russell (1999) described this with the bicycle-riding example.
Some methods use special rules for each task to control extra rewards ([27]). This makes them difficult to use in different environments. Potential-based reward shaping (PBRS) was introduced as another option. It gives extra rewards based on the difference between the potential values of two states. It has been proven that PBRS does not change the optimal policy ([24] (Ng, Harada, and Russell 1999)). It has also helped reduce the negative effects of extra rewards in environments such as MiniGrid ([5, 7]). Still, PBRS only keeps the optimal policy unchanged; it does not always help the agent learn faster, because the learning speed depends on how the potential function is chosen.
In navigation tasks, the potential is usually defined by the straight-line distance to the goal (Euclidean distance) or another type of distance that does not consider walls. This is because these distances are easy to calculate and do not require a map of the walls [e.g. 10]. In the early experiments on PBRS, the Manhattan distance to the goal was also used. These experiments were carried out in grid environments without walls. In such environments, the Manhattan distance is equal to the shortest-path distance (Ng, Harada, and Russell 1999). However, in environments with obstacles, this distance may lead the agent towards a wall. As a result, the agent may get stuck in front of the wall and fail to find the correct open path ([21]). These problems depend on the structure of the environment. They can significantly slow down the agent’s learning process ([21] (Vevurkio, Böхmer, and de Weerdt 2024)). To address this problem, recent studies have proposed distances that take obstacles into account and are based on the shortest path ([23, 26]). This type of distance guides the agent along the actual path and has achieved a much higher success rate than the Euclidean distance ([26]). Most of these studies, however, did not use the exact PBRS formula, and their agents could observe the full state of the environment. It is therefore still unclear how well these results apply to environments where agents can only observe their surroundings and where dangerous areas are present.
To address this research gap, we study how the choice of potential affects the learning process of PPO in a controlled experiment. The benefits or drawbacks of reward shaping depend on several factors that may change at the same time, so these factors need to be studied separately. In all experiments, the PPO settings, environments, and evaluation methods remain the same. Only the reward signal is changed. The potentials are applied using the exact PBRS formula, with a potential of zero at terminal states. This allows us to directly link the differences in results to the potential itself. The conditions, evaluation metrics, and statistical tests for each experiment were registered before the experiments began. The results are evaluated not only by the final success rate but also by the types of mistakes the agent makes. Our main contributions are:
We compare Euclidean and BFS (shortest-path) potentials, a lava-proximity term, and a non-potential bonus as a control, using the same PPO settings. All methods are tested using the exact PBRS formula with an agent that has a limited field of view. The main finding is that the BFS potential speeds up learning in the LavaCrossing environment with both and fields of view, whereas the Euclidean potential does not provide any clear benefit (§ 5).
We analyse how the zero potential at terminal states affects the shaped rewards when the agent reaches lava or the goal (§ 3). We measure this effect by looking at the agent’s death rate during learning.
In a pre-registered test, we study how and fields of view affect the effectiveness of PBRS. The results show that the size of the field of view does not significantly change the benefits of reward shaping.
We show that some runs using the BFS potential with a field of view can get stuck in loops and fail to learn at all. We investigate whether this is caused by the negative potential term at each step and run an experiment with shifted potential values. Shifting the potential does not solve the problem, so the failure cannot be explained by this term alone.
Related Work
Potential-based reward shaping. In reinforcement learning, an agent learns only through rewards. Therefore, in tasks where the agent receives a reward only after reaching the goal, the learning process can be very slow. Reward shaping tries to solve this problem by adding an extra guiding signal to the original reward. Ng, Harada, and Russell (1999) proved that the optimal policy remains unchanged if the additional reward has the following form:
Here, is a potential function that shows how close a state is to the goal. Furthermore, without extra information about how the environment works and gives rewards, no other form of reward shaping can guarantee that the optimal policy stays the same. Wiewiora [24] showed that PBRS is equivalent to using to set up the initial value function. This explains why PBRS can speed up learning: the agent does not start learning from zero but starts with an initial estimate provided by . How much learning is improved therefore depends on how is chosen. Ng, Harada, and Russell (1999) pointed out that choosing is especially good, because in this case the optimal value function after reward shaping becomes zero, but that reward shaping can still be useful even when the potential function is very different from . For episodic tasks, the potential must be zero at terminal states to keep this guarantee (Grześ [8]). This condition can also have a negative effect: if has a negative value, moving to a bad terminal state, such as a dangerous state, may also give the agent an extra positive reward (Toro Icarte et al. [20]). It is important to note that keeping the optimal policy unchanged does not guarantee safety: it does not mean that the agent will avoid dangerous states during learning. According to Müller and Kudenko [13], adding a constant value to the potential function does not change the optimal policy, but it does affect the learning process. This effect has not been tested with the PPO algorithm or in situations involving terminal states. PBRS does not always help in practice. For example, Adamczyk et al. [1] found that using the agent’s own value estimates as a potential helped in some environments but made learning worse in others. Laidlaw, Russell, and Dragan [10] also showed that the effect of reward shaping depends on the structure of the task.
Distance potentials: Euclidean and shortest path. As discussed above, the effectiveness of PBRS mainly depends on how the potential function is chosen. In navigation tasks, the most natural choice is the distance to the goal, but how this distance is calculated can greatly affect the results. If the goal is behind a wall, the straight-line (Euclidean) distance may guide the agent towards the wall. As a result, the agent may fail to find the correct open path and get stuck in front of the wall. In particular, Trott et al. [21] showed that in continuous mazes, a reward based on the distance to the goal can lead the agent to local optima. In such tasks, the main benefit of reward shaping may not be faster learning. Instead, it may help the agent find the only available path (bottleneck) by making exploration easier. This is in line with the idea of Ng, Harada, and Russell (1999) that reward shaping can help with exploration. Wang et al. [23] found that in MiniGrid mazes, a special learned representation that takes obstacles into account (the reachability-aware Laplacian) gave better reward shaping results than the standard Laplacian representation. It is important to note that this was not a BFS distance but a distance learned through experience. In their experiments with PPO in mazes, Vevurko, Böhmer, and Weerdt (2024) showed that a reward based on the shortest-path distance worked better than a reward based on simple distance. Zhang et al. [26] used the Dijkstra distance for drone navigation. At the highest speed (9 m/s), the success rate was 0% with the Euclidean distance, while it reached 43.75% with the Dijkstra distance. However, these studies did not use the exact PBRS formula. In the study by Trott et al. [21], the reward was mainly based on the negative distance value given at the end of each episode. For this reason, it is difficult to say whether the failure of the Euclidean distance was caused by the way distance was calculated or by the way rewards were given. The comparison in Appendix § 11 leads to two main conclusions. First, most evidence showing that obstacle-aware distances are more useful comes from studies that did not use the exact PBRS formula. Studies that used the exact PBRS formula either used distances that did not consider walls (Laidlaw, Russell, and Dragan [10]) or studied tasks that were very different from ours [25 multi-agent search, preprint]. Second, none of these studies directly compared Euclidean and shortest-path potentials for agents with limited vision using the same algorithm and evaluation method. In an unweighted grid environment where every step has the same cost, BFS, Dijkstra, and A* all give the same shortest-path distances, so the difference between these studies is not in the distance itself, but in the reward structure, environment, and observation conditions.
Partial observability and hazardous states. In the studies mentioned above, agents could mostly observe the full state of the environment. In practice, however, an agent’s field of view is often limited. An agent in MiniGrid cannot see the entire map. It can only see a small area around itself. In our study, both the actor and the critic use only this local observation. The global map is used only during learning to calculate the potential function . The potential function thus adds extra information through the reward, even though the agent cannot see this information itself. The Euclidean potential is also calculated using global coordinates, so the main difference between the BFS and Euclidean potentials is whether they take obstacles into account. In this way, PBRS is similar to asymmetric actor-critic methods, where the critic receives extra information, but it is not exactly the same (§ 3, Remark 1). There are different views on how effective these methods are. Lambrechts, Ernst, and Mahajan [11], as well as Ebi et al. [6], showed that giving extra information to the critic can be useful. In contrast, Baisero and Amato [3] showed that under partial observability, such a critic may give incorrect or biased estimates. The important difference is that in these studies, the extra information is given directly to the critic, not through the reward. In their study on safe reinforcement learning (safe RL) and shielding, Carr et al. [4] compared learning with and without a distance-based dense reward under both partial and full observability. They pointed out that reward shaping can have additional negative effects, especially under partial observability. Their reward, however, was not based on a potential function; they compared only two observation settings (partial and full observability) and did not separately study how reward shaping and observation conditions affect each other. In our literature review, we found no study that measured the effectiveness of PBRS by changing the size of the agent’s field of view. In addition to partial observability, LavaCrossing raises another important question: dangerous terminal states. Since PBRS is based on a potential function, a negative potential near lava does not change the optimal policy or guarantee safety. Also, because is required at terminal states, it is not possible to directly punish the agent for the step in which it enters the lava. At the same time, since the opening is located in the same row as the lava, this potential may also punish the only available path. This effect has not yet been studied experimentally in MiniGrid.
Previous studies have shown that obstacle-aware distances work better than the Euclidean distance, but most of these studies used simple rewards and agents that could observe the full environment. In our study, we compare both potentials using the exact PBRS formula, the same PPO settings, and an agent that can only see its surroundings. We use two field-of-view sizes: and . This approach helps us better understand when and why reward shaping is useful.
Analysis: What PBRS Changes in One Step
PBRS turns the discounted shaping sum of an episode into a number that hardly depends on the path, so the optimal policy does not change. PPO, however, sees not the return of the whole episode but the reward of each step, short-horizon sums through GAE, and a normalised reward. The propositions below make this gap precise, and § 5 measures the consequence of each. Proofs are in Appendix § 8.
Notation. Episodic MDP with state (grid and agent pose), , time limit ; the policy sees only an egocentric view of . We set at terminal states (goal or lava); at the time limit the last state is not terminal and is computed as usual. The shaping reward is
Potentials: Euclidean and BFS , where and are the Euclidean and BFS distances from the agent to the goal and and are their values at the start, so at the start.
Proposition 1 (Telescoping). For any path ,
If the episode ends in a terminal state, the sum equals and does not depend on the path. At the time limit it differs from by at most , with . This is the episodic form of the guarantee of Ng, Harada, and Russell (1999) ([8]): it concerns the whole episode and says nothing about a single step. That theorem is stated for policies over states, while our policy acts on egocentric observations. Proposition 1 carries the guarantee over, because it holds for every trajectory: the expected shaped return of any policy equals its unshaped return minus , up to the time-limit term. The difference between the returns of any two policies, including memoryless observation-based ones, therefore changes by at most .
Proposition 2 (Per-step term). For a non-terminal the bonus splits into two parts:
For the BFS potential the second term is . So the agent receives a positive bonus at every step even if it does not move (turning or bumping into a wall), and the further it is from the goal, the larger the bonus. For the undiscounted sum,
so for the last term grows linearly with episode length. Over a 324-step timeout it reaches , in a 20-step
successful episode about 0.1. This does not change the discounted objective (Proposition 1), but it changes the scale of the rewards seen in training and their order by episode outcome; VecNormalize normalises the reward by exactly this scale. Whether this term leads to loops is an empirical question (§ 5.6).
Proposition 3 (Shifted potential). Let at non-terminal states and at terminal states. Then on a non-terminal step and on a terminal step. The discounted shaping sum of every episode that ends in a terminal state decreases by exactly , and that of an episode that ends at the time limit by .
The ranking of policies therefore changes by at most , consistent with [13]. The progress part is unchanged, but for (the shifted potential ) the per-step term becomes : standing still becomes a cost, not a bonus. The price is that the last step into the goal also gets , so the goal signal is weakened.
Proposition 4 (Terminal rule). If and at terminal states, a step into any terminal state, lava included, receives . In a cell next to lava this exceeds the best step towards the goal: for the BFS potential the gap is at least when .
For the Euclidean potential, halfway along the path a step into lava receives about and the best step towards the goal about (). By Proposition 1, however, the shaping sum of a death episode equals that of an episode that reaches the goal, so lava is never the optimal choice. Prediction: early in training, while the policy is still close to random, shaping increases deaths (§ 5.3).
Proposition 5 (Cycles in a non-potential bonus). Let the naive bonus be . For any closed cycle on which is not constant,
Under PBRS the discounted sum over a cycle equals , which is almost zero. With the naive bonus, reward therefore accumulates as the cycle repeats: the undiscounted sum grows linearly with the number of cycles, and the discounted sum grows up to . Moving back and forth between two neighbouring cells ( actions with turns) under the Euclidean potential gives about , the same order as the discounted return of reaching the goal. The optimal policy can therefore change (Ng, Harada, and Russell 1999).
Remark 1 (PBRS and the critic). If the critic is , the shaped TD error equals the unshaped one, so GAE ([17]) is also the same:
This is the actor-critic form of the identity (Ng, Harada, and Russell 1999, Corollary 2, Remark 1) and of the equivalence of [24]. It holds exactly only with at terminal states, correct bootstrapping at the time limit and an unnormalised reward; with VecNormalize it is approximate in our setting. The consequence is that the critic has to learn from the egocentric observation alone, while depends on the global position. A smaller view makes supply information the critic lacks, but it also makes harder to learn. Which effect dominates is the question of RQ4 (§ 5.5).
Experimental Setup
Across all conditions only the reward signal changes; the environment, the PPO configuration, the seeds and the evaluation protocol are the same. The conditions, metrics and tests of each experiment were committed before the runs (pre-registration); code, configurations and pre-registration documents are public at github.com/Nodirjin/RL-Research.
Questions. RQ1: Does a geodesic (BFS) potential learn faster than a Euclidean potential? RQ2: Does a Euclidean potential learn faster than the sparse baseline? RQ3: Does the form of the potential matter, i.e. what happens when the same distance signal is given as a bonus without telescoping? RQ4: Does the benefit of shaping grow when the view shrinks?
Environments. MiniGrid SimpleCrossingS9N1 (one wall line with a single opening) and LavaCrossingS9N1 (one lava line with a single opening; a step into lava ends the episode with reward 0) ([5]). The grid is , the start is , the goal is and the time limit is 324 steps. The map is regenerated at every reset. The task reward is on reaching the goal and 0 otherwise.
Agent. Stable-Baselines3 ([16]) PPO ([18]) with the MiniGrid hyperparameters of RL Zoo ([15]), unchanged: 8 environments, n_steps 128, batch 64, 10 epochs, learning rate , , , clip 0.2, entropy coefficient 0, observation and reward normalisation (VecNormalize). The observation is an egocentric or view (FlatObsWrapper); the policy has no memory. Each run lasts 3M steps.
Conditions. Table 1 lists the conditions; is the length of the shortest 4-neighbour path around walls and lava (BFS). Shaping is applied only during training; evaluation uses the task reward. Each condition and task has 10 seeds, 160 runs in total. Shifted BFS runs reuse the seeds (0–9) of the plain BFS runs.
| Condition | Bonus or potential | Tasks | View |
| Sparse (baseline) | none | both | , |
| Euclidean | both | , | |
| BFS (geodesic) | both | , | |
| Euclidean + lava | on cells next to lava, | Lava | |
| Naive control | , Euclidean | both | |
| Shifted BFS | (exploratory) | Simple |
Table 1. Conditions. Every cell of the design has 10 seeds.
Evaluation. Every 20k steps on 20 held-out maps with the stochastic policy; at the end on 100 held-out maps with the stochastic and the greedy policy.
Metrics. Primary: area under the success curve (AUC, in ), final success, and steps to 50% and 80% success. Behaviour: greedy loop rate (share of episodes in which some state repeats), revisit ratio (share of steps that return to an already visited state), timeouts that end without crossing the line, death rate in the first 500k training steps, and the shaping sum by episode outcome. Statistics. Pre-registered comparisons are tested on AUC with an exact two-sided permutation test (10 vs. 10 runs, 184,756 splits) and Holm correction (9 comparisons at , 6 at ). Effect sizes are the difference of means with a 95% bootstrap interval (10,000 resamples) and [2]. RQ4 is tested with the shaping view interaction contrast and a Bonferroni-corrected 98.75% bootstrap interval. All other results are exploratory: they are reported with intervals and are not claims.
Results
On LavaCrossing the BFS potential learned faster than both the sparse baseline and the Euclidean potential with both views, while the Euclidean potential did not differ from the baseline. None of 20 runs with the naive bonus learned. View size did not detectably change the benefit of shaping, but on SimpleCrossing with a view some BFS runs got stuck in loops, and shifting the potential did not fix this.
Why the Baseline Fails
On LavaCrossing with a view, the final stochastic episodes of sparse PPO have a death rate of 0.018 and a timeout rate of 0.222; the greedy policy never dies and times out in 0.380 of episodes (5 seeds). Deaths are frequent only early in training (61% of episodes in the first 50k steps); after about 100k steps failures are mostly timeouts (Figure 2). Of the timeouts, 88% end without crossing the lava line, and every greedy timeout is a loop. The agent fails not because it dies but because it cannot find the opening: this is an exploration problem.
Figure 2. LavaCrossing: death rate (left) and success rate (right) of training episodes by training phase; 7×7 view at the top, 5×5 view at the bottom. Each line is the mean of 10 runs; the remaining share is timeouts.
Geodesic versus Euclidean Potential (RQ1, RQ2)
Table 2 shows the pre-registered comparisons and Figure 1 shows every run. The advantage of BFS is linked to passing through the opening. On LavaCrossing at , timeouts without crossing the line make up 0.231 (Euclidean) and 0.061 (BFS) of all stochastic episodes, and the revisit ratio is 0.299 and 0.093. At the same share among greedy episodes is 0.386 and 0.166 (exploratory). The BFS − sparse result at () is borderline; at it replicated more clearly. On SimpleCrossing at the baseline reaches an AUC of 0.89, so the potential has almost no room to gain.
| Comparison | Task | 7×7 view | 5×5 view |
| BFS − Euclidean | Lava | +0.39 [+0.18, +0.60], | +0.34 [+0.15, +0.54], |
| BFS − sparse | Lava | +0.27 [+0.09, +0.48], | +0.35 [+0.18, +0.54], |
| Euclidean − sparse | Lava | −0.12 [−0.39, +0.16], | +0.02 [−0.23, +0.26], |
| Euclidean − sparse | Simple | +0.02 [−0.06, +0.09], | −0.12 [−0.16, −0.07], |
| BFS − sparse | Simple | −0.01 [−0.11, +0.09], | −0.29 [−0.57, −0.02], |
| BFS − Euclidean | Simple | −0.02 [−0.12, +0.06], | −0.17 [−0.46, +0.09], |
| Naive − Euclidean | Simple | −0.90 [−0.94, −0.86], | — |
| Naive − Euclidean | Lava | −0.45 [−0.65, −0.24], | — |
| Lava term − Euclidean | Lava | +0.02 [−0.29, +0.32], | — |
Table 2. Pre-registered comparisons: AUC difference [95% bootstrap interval] and Holm-corrected (10 vs. 10 runs).
Figure 1. AUC of every run (points) and the condition mean (bar); panels are task × view (Simple: SimpleCrossing, Lava: LavaCrossing). Each condition has 10 runs.
Terminal Rule and Lava
As Proposition 4 predicts, shaping increased deaths in lava early in training. In training episodes of the first 500k steps, the death rate was 0.225 with sparse, 0.289 with BFS and 0.533 with Euclidean at , and 0.187, 0.430 and 0.582 at (Euclidean − sparse at : +0.39 [−0.30, +0.48]; exploratory). The lava-proximity term did not change the AUC (+0.02, ).
Form of the Potential (RQ3)
None of 20 runs with the naive bonus learned (AUC 0.00). The greedy policy loops in almost every episode (loop rate 1.0 and 0.997). The undiscounted shaping sum of a time-out episode is 11.0–11.5, against 2.05–2.50 with Euclidean PBRS. The distance signal is the same as in Euclidean PBRS; the only difference is the form of the bonus: no telescoping, and positive cycles (Proposition 5).
View Size (RQ4)
The pre-registered metric is the number of steps from crossing the line to the goal (successful episodes, stochastic policy). The interaction contrast is for a shaped condition , and the H-view prediction is . The 98.75% intervals of all four contrasts contain 0: SimpleCrossing Euclidean −2.2 [−5.5, +0.9], SimpleCrossing BFS −1.7 [−7.4, +3.1], LavaCrossing Euclidean −4.5 [−17.7, +6.6] and LavaCrossing BFS +2.7 [−2.5, +8.2] steps. We therefore found no evidence that shaping helps more with a smaller view. The AUC interaction is reported only as an estimate: it is negative on SimpleCrossing (Euclidean −0.13 [−0.22, −0.04], BFS −0.28 [−0.57, −0.01]) and close to 0 on LavaCrossing.
Loops with BFS at (Exploratory)
On SimpleCrossing at , 3 of 10 BFS runs (seeds 4, 5 and 8) never learned: their AUC is 0.00, almost every training episode timed out at 324 steps, and the greedy loop rate is 1.0. The other 7 runs reached 0.94–1.00; all 10 BFS runs at learned. In the failed runs, a timeout episode collected more total reward than an episode that reached the goal (undiscounted 2.57–2.71 against 2.11–2.14), which is consistent with Proposition 2. To test this explanation we ran 10 runs with the shifted BFS potential (Proposition 3, ). The shifted potential did not remove the failure: 2 of 10 runs (seeds 4 and 6) never learned, against none with the sparse baseline (Figure 3). The per-step term now worked in reverse: in the 8 runs that learned, timeout episodes received −0.61 to −0.85 and goal episodes −0.10 to −0.16 of undiscounted shaping. Still, the greedy loop rate did not decrease (0.47 against 0.41 with plain BFS; difference +0.06 [−0.27, +0.37]), and the AUC did not differ from plain BFS (−0.04 [−0.38, +0.31]), and it was below the sparse baseline (−0.32 [−0.55, −0.12]). The price predicted by Proposition 3 was visible: at 500k steps the training success of 5 of 10 runs was still below 0.05 (3 with plain BFS). So the per-step term alone does not explain the loops, and the cause of this failure remains open. With this few runs the result only indicates a direction.
Figure 3. SimpleCrossing, 5×5 view: greedy loop rate (share of evaluation episodes with a loop) and final success of the stochastic policy for every run (sparse, BFS and shifted BFS; 10 runs each). Points in the lower right corner are runs that never learned: 3 with BFS and 2 with shifted BFS.
Discussion and Limitations
Policy invariance does not imply invariance of the learning dynamics: bonuses with the same discounted objective gave very different results in training. Trott et al. [21] observed the same for a distance reward that keeps the global optimum: learning settled in local optima, even in a bitflipping task without walls. The geodesic potential helped where the failure of the baseline was an exploration problem: on LavaCrossing the agent cannot find the opening, and BFS points exactly along the path through it. On SimpleCrossing the baseline already reaches almost 100%, so the potential has no room to gain.
Three mechanisms outside the PBRS guarantee appeared in the experiments. The terminal rule increased deaths early in training (Proposition 4, § 5.3). The bonus without telescoping broke learning entirely (Proposition 5, § 5.4). The third, the loop runs at 5×5, looked consistent with the per-step term of Proposition 2, but the shifted potential, which reverses this term, did not remove the loops either (§ 5.6). The cause therefore lies elsewhere. Plausible candidates are that with a small view the critic cannot learn (Remark 1), or the scale of shaping under VecNormalize; we did not test these here. The result for RQ4 is that no difference was found. Possible reasons are that the path after the line is short (6–14 steps), that the intervals are wide, and that the two effects in Remark 1 ( supplies extra information, but the critic finds harder to learn) may cancel. The negative AUC interaction estimate on SimpleCrossing points towards the second effect, but this is not a claim.
Limitations. We used one PPO configuration (RL Zoo defaults) without per-condition hyperparameter tuning. Reward normalisation (VecNormalize) changes the scale of the shaping signal and makes the identity in Remark 1 approximate. There are two small tasks (9×9), 10 seeds per condition, and a memoryless policy. is computed from the global map and used only in training; the effects of information and of shaping are not separated by an ablation (for example, giving the BFS distance to the critic directly). Map-free alternatives that address the local optima of a distance reward, such as Sibling Rivalry (Trott et al. [21]), were not compared. The shifted-potential experiment was chosen after seeing the results, so it is exploratory.
Conclusion
We compared Euclidean and geodesic potentials in the exact PBRS form, a bonus that is not potential-based, and two view sizes in one pre-registered protocol. The geodesic potential sped up learning on LavaCrossing with both views, while the Euclidean potential did not. The non-potential bonus broke learning entirely, and effects outside the policy-invariance guarantee were measured as deaths and loops. View size did not detectably change the benefit of shaping. With a 5×5 view, some BFS runs got stuck in loops and never learned, and shifting the potential did not fix this; the cause of this failure is an open question for future work.
Proofs
Proposition 1. Shift the index by one and subtract the two sums:
At a terminal state . At the time limit and .
Proposition 2. Add and subtract : . At a terminal step , so the split holds there as well. Summing over steps, the first part telescopes to and the second gives . If and on all steps, the second part is at most , i.e. for .
Proposition 3. For a non-terminal , ; for a terminal , . Applying Proposition 1 to gives the sum . At a terminal state , so the change is . At the time limit the sum , so the change is . The two changes differ by , so the ranking of policies changes by at most this amount. For shifted BFS, , and the step into the goal from moves .
Proposition 4. At a terminal step because . Under the BFS potential one step decreases by at most , so the best forward step has . The difference is
. In the same way, under the Euclidean potential ; for and this is 0.12, while the step into lava gives . By Proposition 1, death and goal episodes have the same discounted shaping sum (), so only the task reward separates them.
Proposition 5. On a cycle , so the sum of the positive parts equals the sum of the negative parts, and each equals . If the cycle is repeated, the discounted sum is times the value of one cycle, which is at most . For a cycle between two neighbouring cells, and (forward, two turns, forward, two turns), which gives . Under PBRS the cycle sum is by Proposition 1; this is the small per-step term of Proposition 2, at most about 0.06 for .
Settings and Pre-Registration
| Parameter | Value |
| Algorithm | PPO (Stable-Baselines3) |
| Hyperparameters | RL Zoo, MiniGrid |
| Parallel environments | 8 |
| , batch, epochs | 128, 64, 10 |
| Learning rate | |
| , , clip | 0.99, 0.95, 0.2 |
| Entropy coefficient | 0 |
| Normalisation | VecNormalize (obs. and reward) |
| Observation | FlatObsWrapper; or view |
| Steps | 3M per run |
| Evaluation, training | 20 maps every 20k steps |
| Evaluation, final | 100 maps, stochastic and greedy |
Table 3. PPO and evaluation settings, identical in all conditions.
The pre-registration documents are in documentation/stages/ of the repository: 08_shaping_experiment.md ( view), 10_view_shaping_experiment.md ( view) and 12_shifted_potential_experiment.md (shifted BFS). The baseline behaviour analysis is in 05_behavior_analysis.md.
Full Results
Work on Distance-Based Shaping
| Task, view | Condition | AUC mean ± SD | Final success | Never learn | Death 500k |
| Simple 7×7 | Sparse | 0.89 ± 0.10 | 1.00 | 0 | — |
| Simple 7×7 | Euclidean | 0.90 ± 0.08 | 0.97 | 0 | — |
| Simple 7×7 | BFS | 0.88 ± 0.13 | 0.98 | 0 | — |
| Simple 7×7 | Naive | 0.00 ± 0.00 | 0.00 | 10 | — |
| Lava 7×7 | Sparse | 0.56 ± 0.32 | 0.76 | 1 | 0.225 |
| Lava 7×7 | Euclidean | 0.45 ± 0.35 | 0.61 | 3 | 0.533 |
| Lava 7×7 | Eucl. + lava | 0.47 ± 0.39 | 0.64 | 1 | 0.563 |
| Lava 7×7 | BFS | 0.84 ± 0.09 | 0.93 | 0 | 0.289 |
| Lava 7×7 | Naive | 0.00 ± 0.00 | 0.00 | 10 | 0.077 |
| Simple 5×5 | Sparse | 0.94 ± 0.05 | 0.96 | 0 | — |
| Simple 5×5 | Euclidean | 0.82 ± 0.06 | 0.93 | 0 | — |
| Simple 5×5 | BFS | 0.65 ± 0.45 | 0.68 | 3 | — |
| Simple 5×5 | Shifted BFS | 0.61 ± 0.37 | 0.76 | 2 | — |
| Lava 5×5 | Sparse | 0.44 ± 0.29 | 0.71 | 2 | 0.187 |
| Lava 5×5 | Euclidean | 0.45 ± 0.31 | 0.71 | 1 | 0.582 |
| Lava 5×5 | BFS | 0.79 ± 0.12 | 0.89 | 0 | 0.430 |
Table 4. Every cell has 10 runs. “Never learn”: final success below 0.1. “Death 500k”: share of training episodes that end in lava during the first 500k steps. Source: results/tables/exp020_runs.csv and exp022_runs.csv (the latter also contains the EXP-012 and EXP-021 runs).
| Work | Environment | Distance or potential | Exact PBRS? | Observation | Algorithm | Limitation |
| Trott et al. [21] | Continuous 2D point maze, Ant U-maze | Distance to goal, mostly at episode end (ignores walls) | No | Full state (agent and goal coordinates) | PPO | Agent falls into local optima |
| Laidlaw, Russell, and Dragan [10] | MiniGrid and other environments | Distance that ignores walls (fewest steps without obstacles) | Yes () | Not stated | PPO, DQN | Distance ignores obstacles |
| Wang et al. [23] | Discrete gridworlds and continuous mazes | Learned representation distance | No | Agent (, ) position | DQN (discrete) | Distance is learned, not BFS |
| Veviurko, Böhmer, and de Weerdt [22] | Gymnasium-Robotics Maze (continuous) | Shortest-path distance (discretised) | No (max-reward RL) | State vector (position, velocity) | PPO, TD3 | Result depends on maze layout |
| Zhang et al. [26] | Drone, continuous 3D | Dijkstra distance | No (progress reward) | Actor: depth image + proprioception; critic: exact state | PPO (asymmetric actor-critic) | Reward form and distance effect not separated |
| Ying et al. [25] | Multi-agent search, cluttered | distance (on agent’s internal map) | Yes () | Partial: limited field of view, LiDAR, local map | MAPPO | Preprint, different task |
| This work | MiniGrid SimpleCrossing, LavaCrossing | Euclidean and BFS, lava term | Yes (terminal ) | Egocentric 7×7 and 5×5 | PPO | from global map; no information ablation |
Table 5. Work on distance-based shaping compared with this study.
References
- [1]Adamczyk, J.; Makarenko, V.; Tiomkin, S.; and Kulkarni, R. V. 2025. Bootstrapped Reward Shaping. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, 15302–15310.arxiv.org/abs/2501.00989
- [2]Agarwal, R.; Schwarzer, M.; Castro, P. S.; Courville, A.; and Bellemare, M. G. 2021. Deep Reinforcement Learning at the Edge of the Statistical Precipice. In Advances in Neural Information Processing Systems, volume 34.
- [3]Baisero, A.; and Amato, C. 2022. Unbiased Asymmetric Reinforcement Learning under Partial Observability. In Proceedings of the International Conference on Autonomous Agents and Multiagent Systems (AAMAS).
- [4]Carr, S.; Jansen, N.; Junges, S.; and Topcu, U. 2023. Safe Reinforcement Learning via Shielding under Partial Observability. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 37.
- [5]Chevalier-Boisvert, M.; Dai, B.; Towers, M.; de Lazcano, R.; Willems, L.; Lahou, S.; Pal, S.; Castro, P. S.; and Terry, J. 2023. Minigrid & Miniworld: Modular & Customizable Reinforcement Learning Environments for Goal-Oriented Tasks. In Advances in Neural Information Processing Systems, Datasets and Benchmarks Track.
- [6]Ebi, D.; Ernst, D.; Böhm, K.; and Lambrechts, G. 2026. Informed Asymmetric Actor-Critic: Leveraging Privileged Signals beyond Full-State Access. In Proceedings of the 43rd International Conference on Machine Learning, volume 306 of PMLR, 27521–27549.
- [7]Forbes, G. C.; Gupta, N.; Villalobos-Arias, L.; Potts, C. M.; Jhala, A. H.; and Roberts, D. L. 2024. Potential-Based Reward Shaping for Intrinsic Motivation. In Proceedings of the International Conference on Autonomous Agents and Multi-agent Systems (AAMAS), 589–597.arxiv.org/abs/2402.07411
- [8]Grześ, M. 2017. Reward Shaping in Episodic Reinforcement Learning. In Proceedings of the International Conference on Autonomous Agents and Multiagent Systems (AAMAS).DOI
- [9]Kiran, B. R.; Sobh, I.; Talpaert, V.; Mannion, R.; Al Sallab, A. A.; Yogamani, S.; and Pérez, P. 2021. Deep Reinforcement Learning for Autonomous Driving: A Survey. IEEE Transactions on Intelligent Transportation Systems.arxiv.org/abs/2002.00444
- [10]Laidlaw, C.; Russell, S.; and Dragan, A. 2023. Bridging RL Theory and Practice with the Effective Horizon. In Advances in Neural Information Processing Systems, volume 36.arxiv.org/abs/2304.09853
- [11]Lambrechts, G.; Ernst, D.; and Mahajan, A. 2025. A Theoretical Justification for Asymmetric Actor-Critic Algorithms. In Proceedings of the International Conference on Machine Learning (ICML).arxiv.org/abs/2501.19116
- [12]Mnih, V.; Kavukcuoglu, K.; Silver, D.; et al. 2015. Human-Level Control through Deep Reinforcement Learning. Nature, 518: 529–533.
- [13]Müller, H.; and Kudenko, D. 2025. Improving the Effectiveness of Potential-Based Reward Shaping in Reinforcement Learning. In Proceedings of the International Conference on Autonomous Agents and Multiagent Systems (AAMAS), Extended Abstract.arxiv.org/abs/2502.01307
- [15]Raffin, A. 2020. RL Baselines3 Zoo. GitHub repository, https://github.com/DLR-RM/rl-baselines3-zoo.
- [16]Raffin, A.; Hill, A.; Gleave, A.; Kanervisto, A.; Ernestus, M.; and Dormann, N. 2021. Stable Baselines3: Reliable Reinforcement Learning Implementations. Journal of Machine Learning Research, 22(268): 1–8.
- [17]Schulman, J.; Moritz, P.; Levine, S.; Jordan, M. I.; and Abbeel, P. 2016. High-Dimensional Continuous Control Using Generalized Advantage Estimation. In International Conference on Learning Representations (ICLR).arxiv.org/abs/1506.02438
- [18]Schulman, J.; Wolski, F.; Dhariwal, P.; Radford, A.; and Klimov, O. 2017. Proximal Policy Optimization Algorithms. arXiv:1707.06347.arxiv.org/abs/1707.06347
- [19]Tang, C.; Abbate-Matteo, B.; Hu, J.; Chandra, R.; Martín-Martín, R.; and Stone, P. 2024. Deep Reinforcement Learning for Robotics: A Survey of Real-World Successes. Annual Review of Control, Robotics, and Autonomous Systems.
- [20]Toro Icarte, R.; Klassen, T. Q.; Valenzano, R.; and McIlraith, S. A. 2022. Reward Machines: Exploiting Reward Function Structure in Reinforcement Learning. Journal of Artificial Intelligence Research, 73: 173–208.DOI
- [21]Trott, A.; Zheng, S.; Xiong, C.; and Socher, R. 2019. Keeping Your Distance: Solving Sparse Reward Tasks Using Self-Balancing Shaped Rewards. In Advances in Neural Information Processing Systems, volume 32.arxiv.org/abs/1911.01417
- [22]Veviurko, G.; Böhmer, W.; and de Weerdt, M. 2024. To the Max: Reinventing Reward in Reinforcement Learning. In Proceedings of the International Conference on Machine Learning (ICML).arxiv.org/abs/2402.01361
- [23]Wang, K.; Zhou, K.; Feng, J.; Hooi, B.; and Wang, X. 2023. Reachability-Aware Laplacian Representation in Reinforcement Learning. In Proceedings of the International Conference on Machine Learning (ICML).arxiv.org/abs/2210.13153
- [24]Wiewiora, E. 2003. Potential-Based Shaping and Q-Value Initialization Are Equivalent. Journal of Artificial Intelligence Research, 19: 205–208.DOI
- [25]Ying, J.; Li, Z.; Dong, Z.; Wu, G.; and Liao, Y. 2025. Generalizable Collaborative Search-and-Capture in Cluttered Environments via Path-Guided MAPPO and Directional Frontier Allocation. arXiv:2512.09410.arxiv.org/abs/2512.09410
- [26]Zhang, J.; Lei, C.; Dai, C.; Hoi, K.; Wang, L.; Han, Z.; and Gao, F. 2026. High-Speed Vision-Based Flight in Clutter with Safety-Shielded Reinforcement Learning. IEEE Robotics and Automation Letters, 11(8).DOI
- [27]Zhang, T.; Xu, H.; Wang, X.; Wu, Y.; Keutzer, K.; Gonzalez, J. E.; and Tian, Y. 2020. BelBold: Exploration beyond the Boundary of Explored Regions. arXiv:2012.08621.arxiv.org/abs/2012.08621
- [28]Zhu, K.; and Zhang, T. 2021. Deep Reinforcement Learning Based Mobile Robot Navigation: A Review. Tsinghua Science and Technology.DOI


