When Does Backpropagating Through Policy Memory Matter? Separating Representation Credit from Closed-Loop Credit
Organizations: School of Data Science, The Chinese University of Hong Kong, Shenzhen · School of Artificial Intelligence, The Chinese University of Hong Kong, Shenzhen · COSCO Shipping Technology Co., Ltd.
Abstract
When a policy with memory is trained through a differentiable simulator, credit can reach what it stores along two routes: representation credit teaches the network that writes the memory what to summarize, while closed-loop credit travels back through the physical states that earlier actions produced and that the memory later stored. Stopping gradients at stored history, as truncated backpropagation and Transformer-XL do, removes both routes at once. Keeping every forward computation identical and removing one route at a time, we trained Transformer policies for quadrotor tracking to determine when each route matters. Credit through memory improved learning only when velocity observations were noisy or hidden. When velocity was hidden, mildly decaying the gradient between consecutive physical states () eliminated the truncation cost of removing closed-loop credit while leaving representation credit essential, a separation that held in 14 of 16 new seeds. Two further systems bound this result: in a fixed-wing aircraft, representation credit could replace closed-loop credit on its own, leaving no cost to separate, and in a cart-pole, training with full state-edge credit was too unstable to compare the routes. In both the quadrotor and a fully observed vessel model, static gradient norms failed to predict which cut cost more, so memory truncation choices are best guided by short training runs.
Figures & tables
| Arm | Credit removed | Forward computation | Used in |
|---|---|---|---|
| full policy | none | reference | all sections |
| no representation credit | and | identical | 5.1 – 5.6 |
| no closed-loop credit | and | identical | 5.1 – 5.6 |
| no credit through memory | all paths through memory | identical | 5.1 , 5.5 , 5.6 |
| no observation gradient | every path through an observation | identical | 5.1 |
| short memory ( ) | none (memory restricted) | attention window | 5.1 |
| Credit removed | ||||
|---|---|---|---|---|
| System | Velocity | both routes | closed-loop only | representation only |
| Quadrotor, 16 seeds | hidden | 28% (16/16) | 13% (14/16) | 23% (16/16) |
| Fixed-wing, 16 seeds | hidden | 5.8% (11/16) | 0.3% (10/16) | 4.9% (11/16) |
| Vessel, 16 streams | observed | (6/16) | (6/16) | 1.0% (12/16) |
| Situation | What we observed | Suggested practice | Basis |
|---|---|---|---|
| State observed accurately | Cutting memory credit changed error by (quadrotor), (vessel) | Truncation is safe | Quadrotor, vessel |
| Velocity noisy or hidden, full physical credit | Cutting memory credit cost | Keep credit through memory | Quadrotor, 16 seeds |
| Velocity hidden, mild state-edge decay | Closed-loop truncation cost vanished; representation credit kept its value | If cutting, keep representation credit | Quadrotor, 16 new seeds |
| Closed-loop credit replaceable | Removing it alone cost almost nothing under every measure; removing both cost (median) | Cutting closed-loop credit may be harmless; check by training | Fixed-wing, 16 seeds |
| Unstable plant with full physical credit | Runs relapsed, and costs depended on when the error was measured | Stabilize training before comparing cuts | Cart-pole, 16 seeds |
| Detaching all observations | Error rose , even with exact velocity | Avoid with memory policies at | Quadrotor, 16 seeds |
Appendix figures & tables17 assets
Supplementary material from the paper’s appendix.
Appendix
| Quadrotor | Cart-pole | Fixed-wing | Vessel | |
| State, action dimensions | 12, 4 | 4, 1 | 12, 4 | 4, 2 |
| Control step, horizon | , 32 | , 32 | , 32 | , 288 |
| Policy | 2 layers, width 64, 4 heads | layers, 256, 8 heads | ||
| Parameters | 94,324 | 93,129 | 93,940 | 3,677,698 |
| Initialization | random | random | random | pretrained |
| Learning rate | ||||
| Prediction | Where | Outcome |
|---|---|---|
| Going from exact to noisy velocity raises the cost of removing representation credit more than that of removing closed-loop credit (quadrotor) | 5.2 | Not supported: |
| With velocity hidden, removing representation credit costs more than removing closed-loop credit | 5.2 | Supported in the original seeds: , 13 of 16; close in the new seeds ( and ) |
| Removing state-edge credit ( , noise ) lowers the closed-loop cost more than the representation cost | 5.3 | Not supported: ; training stalled |
| Mild decay ( ), new seeds, velocity hidden: lowers the closed-loop cost more than the representation cost | 5.3 | Supported: , 14 of 16 |
| Mild decay ( ), new seeds, noise : lowers the closed-loop cost more than the representation cost | 5.3 | Not established: |
| Keeping two recent steps recovers more of the representation cost than of the closed-loop cost | 5.4 | Reversed at noise (ratio difference ); not resolved with velocity hidden |
| Arm | exact | noise 0.05 | noise 0.20 | hidden |
|---|---|---|---|---|
| no representation credit | -0.2 [-0.4, 0.1] | -0.9 [-2.1, 0.2] | 12.6 [10.1, 15.2] | 26.1 [19.4, 33.9] |
| no closed-loop credit | 0.2 [-0.0, 0.4] | 6.3 [4.1, 8.4] | 16.0 [12.7, 19.9] | 14.9 [9.0, 22.2] |
| no credit through memory | -0.2 [-0.4, 0.0] | 3.3 [1.8, 4.8] | 26.9 [24.1, 29.8] | 33.9 [24.9, 43.5] |
| interaction | -0.2 [-0.5, 0.0] | -2.1 [-4.4, 0.3] | -1.8 [-5.5, 1.8] | -7.1 [-17.6, 3.7] |
| no observation gradient | 75.0 [44.6, 121.4] | 51.5 [41.2, 62.4] | 74.1 [66.1, 82.3] | 106.5 [90.4, 123.1] |
| memory of 1 step | -0.3 [-0.5, 0.0] | 2.7 [1.6, 3.6] | 38.4 [35.3, 41.4] | 106.8 [99.3, 113.8] |
| Velocity | Arm | Same- cost | Common-scale cost | |
|---|---|---|---|---|
| noise 0.20 | 0 | no rep. | 0.0 [-0.2, 0.3] | 0.5 [-3.8, 4.5] |
| no loop | 0.1 [-0.0, 0.2] | 1.4 [-0.6, 3.1] | ||
| no memory | 0.1 [-0.2, 0.4] | 1.6 [-2.9, 6.4] | ||
| 0.8 | no rep. | 7.6 [4.7, 10.6] | 13.0 [8.1, 18.2] | |
| no loop | 5.4 [3.0, 7.9] | 9.1 [5.1, 13.4] | ||
| no memory | 13.1 [10.1, 16.4] | 22.7 [17.5, 28.4] |
| Velocity | Arm | Same- cost | Common-scale cost | |
|---|---|---|---|---|
| hidden | 1 | no rep. | 20.2 [13.4, 27.5] | – |
| no loop | 18.5 [6.1, 39.7] | – | ||
| no memory | 37.3 [29.3, 46.1] | – | ||
| 0.8 | no rep. | 40.8 [24.0, 69.0] | 65.8 [39.4, 110.1] | |
| no loop | -0.4 [-2.1, 1.5] | -0.6 [-3.5, 2.5] | ||
| no memory | 24.8 [18.6, 30.9] | 40.1 [30.4, 49.3] |
| Velocity | Cost vs. full policy at | Common-scale cost | Full policy, / |
|---|---|---|---|
| exact | 0.0 [-0.1, 0.1] | 0.3 [-1.7, 2.3] | 20.3 |
| noise 0.05 | -0.0 [-0.1, 0.1] | -0.1 [-1.8, 1.5] | 18.7 |
| noise 0.20 | 0.1 [-0.0, 0.2] | 1.7 [-0.4, 3.6] | 16.1 |
| hidden | -0.0 [-0.1, 0.1] | -0.4 [-2.3, 1.6] | 18.5 |
| at | mean | median | mean | median | lowest | ||
| Velocity | Arm | 1000 | 800–1000 | 800–1000 | 600–1000 | 600–1000 | 500–1000 |
| Original 16 seeds, | |||||||
| hidden | no rep. | 26.1 (16) | 25.3 (16) | 25.3 (16) | 25.0 (16) | 25.4 (16) | 20.7 (16) |
| no loop | 14.9 (14) | 17.4 (16) | 13.9 (16) | 15.3 (16) | 10.9 (16) | 8.0 (16) | |
| no memory | 33.9 (16) | 38.8 (16) | 40.4 (16) | 39.1 (16) | 37.6 (16) | 28.2 (16) | |
| noise 0.20 | no rep. | 12.6 (16) | 11.3 (16) | 11.0 (15) | 9.0 (16) | 10.2 (16) | 12.1 (16) |
| Steps kept | No rep. | No loop | No memory |
|---|---|---|---|
| 0 (full cut) | 12.6 [10.1, 15.2] | 16.0 [12.6, 20.0] | 26.9 [24.1, 29.9] |
| 1 | 11.9 [9.8, 14.0] | 8.7 [6.5, 11.2] | 21.8 [18.3, 25.7] |
| 2 | 11.5 [9.3, 13.8] | 5.9 [4.0, 7.8] | 17.3 [14.5, 20.4] |
| 4 | 4.3 [2.5, 5.8] | 2.1 [0.8, 3.5] | 8.1 [6.5, 9.7] |
| 8 | 0.5 [-0.8, 1.8] | 0.5 [-0.4, 1.4] | 1.3 [0.4, 2.3] |
| 16 | -0.3 [-0.8, 0.1] | -0.1 [-0.4, 0.2] | -0.3 [-0.8, 0.1] |
| Arm | 1000 updates | 2000 updates | Change | Seeds with increase |
|---|---|---|---|---|
| no rep. | 13.9 [10.0, 18.0] | 22.0 [15.6, 28.8] | 8.1 [-1.4, 17.0] | 5/8 |
| no loop | 14.8 [10.4, 19.9] | 5.8 [3.5, 8.0] | -8.9 [-13.4, -4.4] | 2/8 |
| no memory | 27.8 [25.6, 30.3] | 21.3 [16.4, 25.8] | -6.5 [-11.9, -0.9] | 3/8 |
| Switch at | No rep., carried | No rep., reset | No loop, carried | No loop, reset | Reset only |
|---|---|---|---|---|---|
| 250 | 13.8 [11.7, 16.7] | 7.6 [4.0, 11.9] | 14.7 [11.6, 18.2] | 12.6 [9.4, 17.0] | -7.2 [-8.7, -5.8] |
| 500 | 9.8 [8.6, 11.2] | 8.1 [6.2, 10.3] | 9.6 [7.4, 11.8] | 8.2 [5.7, 11.0] | -5.5 [-6.9, -4.3] |
| 750 | 4.8 [2.9, 6.8] | 5.4 [3.7, 7.0] | 5.5 [3.5, 7.7] | 5.7 [4.9, 6.6] | 0.3 [-1.1, 1.6] |
| Switch at update 500 | Optimizer state carried | Optimizer state reset |
|---|---|---|
| no rep. full | -1.1 [-2.9, 0.6] | -4.9 [-6.7, -3.2] |
| no loop full | 6.3 [4.6, 7.9] | -4.0 [-5.5, -2.7] |
| Arm | Mean [95% interval] | Median (seeds with increase) | Runs that relapsed | |
|---|---|---|---|---|
| 1 | full policy | – | – | 3/16 |
| no rep. | 161.5 [-13.6, 494.3] | 2.9 (9/16) | 3/16 | |
| no loop | 860.4 [8.9, 2515.6] | 9.1 (9/16) | 9/16 | |
| no memory | 45.1 [-0.7, 100.7] | 9.3 (12/16) | 8/16 | |
| 0.9 | full policy | – | – | 2/16 |
| no rep. | 37.0 [6.2, 83.5] | 9.8 (13/16) | 4/16 |
| Arm | Mean [95% interval] | Median (seeds with increase) | |
|---|---|---|---|
| 1 | no rep. | 7.2 [1.5, 13.3] | 4.9 (11/16) |
| no loop | 3.7 [0.3, 8.0] | 0.3 (10/16) | |
| no memory | 8.7 [2.8, 15.3] | 5.8 (11/16) | |
| interaction | -2.2 [-5.8, 0.6] | 0.0 (8/16) | |
| 0.9 | no rep. | 18.1 [0.8, 39.0] | 12.3 (10/16) |
| no loop | 21.2 [-1.0, 52.8] | 6.1 (10/16) |
| at | mean | median | mean | median | lowest | ||
|---|---|---|---|---|---|---|---|
| System | Arm | 1000 | 800–1000 | 800–1000 | 600–1000 | 600–1000 | 500–1000 |
| fixed-wing | no rep. | 4.9 (11) | 1.4 (9) | 0.9 (10) | 1.1 (11) | 1.6 (12) | 2.0 (10) |
| no loop | 0.3 (10) | 0.1 (11) | -0.2 (6) | 0.2 (10) | 0.1 (9) | 0.2 (11) | |
| no memory | 5.8 (11) | 2.5 (10) | 2.2 (12) | 1.3 (12) | 3.0 (13) | 4.1 (12) | |
| difference of drops | -9.2 (7) | 2.2 (8) | 2.2 (9) | -0.2 (8) | 5.2 (10) | -7.1 (6) | |
| cart-pole | no rep. | 2.9 (9) | 9.1 (10) | 8.4 (10) | -0.6 (8) | 0.4 (8) | 3.8 (11) |
| Arm | Cost [95% interval] | Median | Increase | Clipped ( ) | Events, first six | Events, further ten |
|---|---|---|---|---|---|---|
| full policy | – | – | – | 11.4 (10.4–12.9) | 6 | 0 |
| no rep. | 0.7 [0.0, 1.2] | 1.0 | 12/16 | 10.2 (9.1–11.2) | 2 | 5 |
| no loop | -0.3 [-1.2, 0.7] | -0.4 | 6/16 | 12.5 (11.1–13.5) | 22 | 78 |
| no memory | 0.4 [-0.6, 1.5] | -0.5 | 6/16 | 11.0 (9.9–12.7) | 79 | 64 |
| no obs. gradient | -0.4 [-1.3, 0.4] | -0.3 | 7/16 | 13.9 (12.5–15.2) | 0 | 0 |
| Velocity | |||||
|---|---|---|---|---|---|
| 1 | exact | 0.21 | 0.11 | 0.02 | 0.94 |
| noise 0.05 | 1.74 | 0.81 | 1.11 | 1.27 | |
| noise 0.20 | 0.66 | 0.66 | 0.45 | 1.09 | |
| hidden | 0.68 | 1.52 | 1.19 | 0.93 | |
| 0 | exact | 0.21 | 0.04 | 0.01 | 1.02 |
| noise 0.05 | 0.21 | 0.05 | 0.01 | 1.04 |
| Checkpoint | , median [95% interval] | Windows | ||
|---|---|---|---|---|
| residual model, 200 updates | 0.022 | 0.012 | 0.018 [0.014, 0.025] | 46 |
| residual model, 500 updates | 0.069 | 0.039 | 0.031 [0.017, 0.040] | 46 |
| residual model, 2400 updates (main) | 0.376 | 0.120 | 0.025 [-0.000, 0.045] | 46 |
| direct-output model, pretrained | 0.003 | 0.902 | -0.146 [-0.260, -0.046] | 46 |
| direct-output model, fine-tuned A | 0.006 | 0.812 | -0.372 [-0.406, -0.290] | 46 |
| direct-output model, fine-tuned B | 0.006 | 0.840 | -0.337 [-0.396, -0.252] | 46 |
Policy Learning
Policy learning develops decision rules that choose actions or interventions to maximize outcomes from data, feedback, or interaction.
See all 479 papers