Ben commited on
Commit ·
9e53521
1
Parent(s): 967bf28
Update v2 release assets
Browse files- README.md +24 -26
- requirements.txt +0 -5
README.md
CHANGED
|
@@ -12,36 +12,40 @@ license: cc-by-4.0
|
|
| 12 |
library_name: pytorch
|
| 13 |
---
|
| 14 |
|
| 15 |
-
# Representation over Routing:
|
| 16 |
|
| 17 |
[](https://arxiv.org/abs/2604.13517)
|
| 18 |
[](https://github.com/ben-dlwlrma/Representation-Over-Routing)
|
| 19 |
[](https://huggingface.co/spaces/ben-dlwlrma/Representation-Over-Routing-Demo)
|
| 20 |
|
| 21 |
-
This repository hosts
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
## Related Links
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
## Model Weights Overview
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
|
| 36 |
-
* **`2_surrogate_hacking_attention.pth` (Surrogate Hacking)**: Demonstrates multi-timescale collapse. The policy artificially minimizes the surrogate loss by manipulating attention weights instead of improving physical control.
|
| 37 |
-
* **`3_temporal_paradox_variance.pth` (Temporal Paradox)**: Exhibits aimless wandering caused by the inability to confidently attribute credit over long horizons.
|
| 38 |
-
* **`4_target_decoupling_final.pth` (Target Decoupling)**: **Our proposed solution.** The agent uncovers true intelligence, executing a highly fuel-efficient and safe landing by understanding the ultimate long-term goal ($\gamma = 0.999$).
|
| 39 |
|
| 40 |
-
## Usage
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
```python
|
| 47 |
import torch
|
|
@@ -50,13 +54,11 @@ import numpy as np
|
|
| 50 |
import gymnasium as gym
|
| 51 |
from huggingface_hub import hf_hub_download
|
| 52 |
|
| 53 |
-
# 1. Download a specific stage's weight from Hugging Face
|
| 54 |
weight_path = hf_hub_download(
|
| 55 |
-
repo_id="ben-dlwlrma/Representation-Over-Routing",
|
| 56 |
-
filename="4_target_decoupling_final.pth"
|
| 57 |
)
|
| 58 |
|
| 59 |
-
# 2. Define the exact Actor network architecture
|
| 60 |
def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
|
| 61 |
nn.init.orthogonal_(layer.weight, std)
|
| 62 |
nn.init.constant_(layer.bias, bias_const)
|
|
@@ -70,11 +72,9 @@ actor = nn.Sequential(
|
|
| 70 |
layer_init(nn.Linear(64, 4), std=0.01),
|
| 71 |
)
|
| 72 |
|
| 73 |
-
# 3. Load weights
|
| 74 |
actor.load_state_dict(torch.load(weight_path, weights_only=True))
|
| 75 |
actor.eval()
|
| 76 |
|
| 77 |
-
# 4. Run Inference in environment
|
| 78 |
env = gym.make("LunarLander-v2")
|
| 79 |
state, _ = env.reset()
|
| 80 |
done = False
|
|
@@ -84,20 +84,18 @@ while not done:
|
|
| 84 |
with torch.no_grad():
|
| 85 |
logits = actor(state_tensor)
|
| 86 |
action = torch.argmax(logits, dim=1).item()
|
| 87 |
-
|
| 88 |
state, reward, terminated, truncated, _ = env.step(action)
|
| 89 |
done = terminated or truncated
|
| 90 |
```
|
| 91 |
|
| 92 |
-
The paper experiments were conducted on `LunarLander-v2`. The hosted
|
| 93 |
|
| 94 |
## Citation
|
| 95 |
|
| 96 |
-
If you find this code or our insights useful in your research, please consider citing our work:
|
| 97 |
-
|
| 98 |
```bibtex
|
| 99 |
-
@misc{
|
| 100 |
-
title = {Representation over {{Routing}}: {{
|
| 101 |
shorttitle = {Representation over {{Routing}}},
|
| 102 |
author = {Sun, Jing},
|
| 103 |
year = 2026,
|
|
|
|
| 12 |
library_name: pytorch
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# Representation over Routing: Diagnosing Temporal Routing Pathologies in Multi-Timescale PPO
|
| 16 |
|
| 17 |
[](https://arxiv.org/abs/2604.13517)
|
| 18 |
[](https://github.com/ben-dlwlrma/Representation-Over-Routing)
|
| 19 |
[](https://huggingface.co/spaces/ben-dlwlrma/Representation-Over-Routing-Demo)
|
| 20 |
|
| 21 |
+
This model repository hosts pretrained PyTorch actor weights for the diagnostic study **"Representation over Routing: Diagnosing Temporal Routing Pathologies in Multi-Timescale PPO"**.
|
| 22 |
|
| 23 |
+
The weights correspond to controlled PPO experiments on `LunarLander-v2`. They are provided to reproduce the qualitative behaviors discussed in the paper: a single-horizon baseline, differentiable temporal routing, error-based temporal routing, and Target Decoupling.
|
| 24 |
+
|
| 25 |
+
This model repository is a weight distribution package. Training scripts and selected generated figures live in the GitHub code repository; paper text and source files are distributed through arXiv.
|
| 26 |
|
| 27 |
## Related Links
|
| 28 |
|
| 29 |
+
- **Paper:** https://arxiv.org/abs/2604.13517
|
| 30 |
+
- **Interactive Demo Space:** https://huggingface.co/spaces/ben-dlwlrma/Representation-Over-Routing-Demo
|
| 31 |
+
- **GitHub Repository:** https://github.com/ben-dlwlrma/Representation-Over-Routing
|
| 32 |
|
| 33 |
## Model Weights Overview
|
| 34 |
|
| 35 |
+
The repository provides four standalone `.pth` actor weight files:
|
| 36 |
+
|
| 37 |
+
- **`1_baseline.pth` (Baseline PPO):** single-horizon PPO reference policy.
|
| 38 |
+
- **`2_surrogate_hacking_attention.pth` (Differentiable Routing):** policy from the actor-side attention routing diagnostic.
|
| 39 |
+
- **`3_temporal_paradox_variance.pth` (Error-Based Routing):** policy from the gradient-free error-based routing diagnostic.
|
| 40 |
+
- **`4_target_decoupling_final.pth` (Target Decoupling):** policy trained with structural separation between the actor objective and temporal routing. The actor uses the long-horizon advantage, while auxiliary critic heads remain as regularizers during training.
|
| 41 |
|
| 42 |
+
Target Decoupling is described in the paper as a structural isolation principle in the `LunarLander-v2` PPO setting. The reported evidence concerns removal of the actor-side routing pathway and improved observed worst-seed return in the tested run set, not broad benchmark superiority.
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
## Usage
|
| 45 |
|
| 46 |
+
For training scripts and selected diagnostic plots, see the [GitHub repository](https://github.com/ben-dlwlrma/Representation-Over-Routing). The manuscript itself is distributed through arXiv rather than duplicated as source files in the code or model repositories.
|
| 47 |
|
| 48 |
+
The published weights contain actor parameters and can be loaded into the same MLP actor architecture used by the training scripts:
|
| 49 |
|
| 50 |
```python
|
| 51 |
import torch
|
|
|
|
| 54 |
import gymnasium as gym
|
| 55 |
from huggingface_hub import hf_hub_download
|
| 56 |
|
|
|
|
| 57 |
weight_path = hf_hub_download(
|
| 58 |
+
repo_id="ben-dlwlrma/Representation-Over-Routing",
|
| 59 |
+
filename="4_target_decoupling_final.pth",
|
| 60 |
)
|
| 61 |
|
|
|
|
| 62 |
def layer_init(layer, std=np.sqrt(2), bias_const=0.0):
|
| 63 |
nn.init.orthogonal_(layer.weight, std)
|
| 64 |
nn.init.constant_(layer.bias, bias_const)
|
|
|
|
| 72 |
layer_init(nn.Linear(64, 4), std=0.01),
|
| 73 |
)
|
| 74 |
|
|
|
|
| 75 |
actor.load_state_dict(torch.load(weight_path, weights_only=True))
|
| 76 |
actor.eval()
|
| 77 |
|
|
|
|
| 78 |
env = gym.make("LunarLander-v2")
|
| 79 |
state, _ = env.reset()
|
| 80 |
done = False
|
|
|
|
| 84 |
with torch.no_grad():
|
| 85 |
logits = actor(state_tensor)
|
| 86 |
action = torch.argmax(logits, dim=1).item()
|
| 87 |
+
|
| 88 |
state, reward, terminated, truncated, _ = env.step(action)
|
| 89 |
done = terminated or truncated
|
| 90 |
```
|
| 91 |
|
| 92 |
+
The paper experiments were conducted on `LunarLander-v2`. The hosted demo may use `LunarLander-v3` for compatibility with current Gymnasium releases while preserving the same actor architecture and weight format.
|
| 93 |
|
| 94 |
## Citation
|
| 95 |
|
|
|
|
|
|
|
| 96 |
```bibtex
|
| 97 |
+
@misc{sunRepresentationRoutingDiagnosing2026,
|
| 98 |
+
title = {Representation over {{Routing}}: {{Diagnosing Temporal Routing Pathologies}} in {{Multi-Timescale PPO}}},
|
| 99 |
shorttitle = {Representation over {{Routing}}},
|
| 100 |
author = {Sun, Jing},
|
| 101 |
year = 2026,
|
requirements.txt
DELETED
|
@@ -1,5 +0,0 @@
|
|
| 1 |
-
torch>=2.0.0
|
| 2 |
-
numpy
|
| 3 |
-
gymnasium[box2d]
|
| 4 |
-
imageio
|
| 5 |
-
tensorboard
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|