Refresh Hopper-v5 with step 98,000 bundle
Browse filesMuJoCo 3.2.3 CUDA seeds 0..49 returns: KV16 3180.66±26.93, KV32 3178.60±28.23, KV64 3184.96±23.18, KV1000 3176.53±37.41.
- README.md +250 -250
- hopper-v5/model.safetensors +1 -1
README.md
CHANGED
|
@@ -1,250 +1,250 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: other
|
| 3 |
-
license_name: polyform-noncommercial-1.0.0
|
| 4 |
-
license_link: https://polyformproject.org/licenses/noncommercial/1.0.0
|
| 5 |
-
library_name: pytorch
|
| 6 |
-
tags:
|
| 7 |
-
- reinforcement-learning
|
| 8 |
-
- gymnasium
|
| 9 |
-
- mujoco
|
| 10 |
-
- causal-gpt-rl
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
# Causal GPT-RL
|
| 14 |
-
|
| 15 |
-
GPT-style transformers (GPT-2, Llama) running as RL policies in continuous-control environments.
|
| 16 |
-
|
| 17 |
-
Both LLM generation and RL interaction are autoregressive:
|
| 18 |
-
|
| 19 |
-
```text
|
| 20 |
-
token → next token (LLM generation)
|
| 21 |
-
(state, action) → (next state from env, next action) (RL rollout)
|
| 22 |
-
```
|
| 23 |
-
|
| 24 |
-

|
| 25 |
-
|
| 26 |
-
Causal GPT-RL policies act stably under their own rollouts — long-horizon control without the drift that has historically kept transformers from being usable as RL agents.
|
| 27 |
-
|
| 28 |
-
A single autoregressive model drives full-episode rollouts via KV cache — no separate critic, no auxiliary networks at inference. The model carries a value head and computes it on every forward pass, but a rollout does not read it: the action alone carries the loop.
|
| 29 |
-
|
| 30 |
-
This repository is the public inference runtime. It loads policy bundles, runs Gymnasium/MuJoCo rollouts, and provides small evaluation helpers.
|
| 31 |
-
|
| 32 |
-
- **Code (GitHub):** [ccnets-team/causal-gpt-rl](https://github.com/ccnets-team/causal-gpt-rl)
|
| 33 |
-
- **Hugging Face org:** https://huggingface.co/ccnets
|
| 34 |
-
- **MuJoCo runs (W&B):** https://wandb.ai/causal-gpt-rl/mujoco
|
| 35 |
-
- Website: https://ccnets.org
|
| 36 |
-
- LinkedIn: https://www.linkedin.com/company/ccnets
|
| 37 |
-
|
| 38 |
-
## Install
|
| 39 |
-
|
| 40 |
-
For Hub loading and MuJoCo environments:
|
| 41 |
-
|
| 42 |
-
```bash
|
| 43 |
-
pip install "causal-gpt-rl[hub,mujoco]"
|
| 44 |
-
```
|
| 45 |
-
|
| 46 |
-
For local development:
|
| 47 |
-
|
| 48 |
-
```bash
|
| 49 |
-
git clone https://github.com/ccnets-team/causal-gpt-rl.git
|
| 50 |
-
cd causal-gpt-rl
|
| 51 |
-
python -m pip install -e ".[hub,mujoco]"
|
| 52 |
-
```
|
| 53 |
-
|
| 54 |
-
For private bundles, authenticate first:
|
| 55 |
-
|
| 56 |
-
```bash
|
| 57 |
-
hf auth login
|
| 58 |
-
```
|
| 59 |
-
|
| 60 |
-
## Quick Start
|
| 61 |
-
|
| 62 |
-
```python
|
| 63 |
-
import gymnasium as gym
|
| 64 |
-
|
| 65 |
-
from causal_gpt_rl.inference import load_runner_from_hub, run_episodes
|
| 66 |
-
|
| 67 |
-
env = gym.make("Ant-v5")
|
| 68 |
-
runner = load_runner_from_hub(
|
| 69 |
-
repo_id="ccnets/causal-gpt-rl",
|
| 70 |
-
subfolder="ant-v5",
|
| 71 |
-
)
|
| 72 |
-
|
| 73 |
-
stats = run_episodes(env, runner, num_episodes=5, seed=0)
|
| 74 |
-
env.close()
|
| 75 |
-
print(stats["return_mean"], stats["return_std"])
|
| 76 |
-
```
|
| 77 |
-
|
| 78 |
-
Notebook version: [examples/hub_quickstart.ipynb](https://github.com/ccnets-team/causal-gpt-rl/blob/main/examples/hub_quickstart.ipynb)
|
| 79 |
-
|
| 80 |
-
## Supported Environments
|
| 81 |
-
|
| 82 |
-
| Bundle | Ctx | Return | Norm. | Simple Ref. | Medium Ref. |
|
| 83 |
-
|---|---:|---:|---:|---:|---:|
|
| 84 |
-
| `ant-v5` | 32 | 5208.80±1347.84 | 78.28±19.99 | 59.99 ✓ | 86.54 ✗ |
|
| 85 |
-
| `halfcheetah-v5` | 32 | 6312.03±2129.97 | 39.82±12.91 | 43.54 ✗ | 74.83 ✗ |
|
| 86 |
-
| `hopper-v5` | 32 |
|
| 87 |
-
| `walker2d-v5` | 32 | 4206.39±35.44 | 61.41±0.52 | 59.51 ✓ | 83.26 ✗ |
|
| 88 |
-
| `humanoid-v5` | 32 | 7892.65±1018.11 | 91.63±11.99 | 63.29 ✓ | 81.30 ✓ |
|
| 89 |
-
| `humanoidstandup-v5` | 32 | 227703.73±61036.30 | 72.21±23.15 | 48.39 ✓ | 89.86 ✗ |
|
| 90 |
-
| `pusher-v5` | 32 | -30.18±5.84 | 95.66±4.74 | — | 94.19 ✓ |
|
| 91 |
-
| `swimmer-v5` | 32 | 257.74±5.98 | 72.62±1.68 | — | 59.44 ✓ |
|
| 92 |
-
|
| 93 |
-
**Gymnasium environment IDs:** `Ant-v5`, `HalfCheetah-v5`, `Hopper-v5`, `Walker2d-v5`, `Humanoid-v5`, `HumanoidStandup-v5`, `Pusher-v5`, and `Swimmer-v5`.
|
| 94 |
-
HF bundle subfolders are lowercase and case-sensitive (e.g. `humanoidstandup-v5`).
|
| 95 |
-
|
| 96 |
-
Training data is expert-free: bundles are trained using Minari simple and medium datasets only; expert trajectories are not used for training.
|
| 97 |
-
|
| 98 |
-
`Pusher-v5` and `Swimmer-v5` are exceptions: Minari does not publish a
|
| 99 |
-
`simple-v0` dataset for either environment, so these bundles were trained on
|
| 100 |
-
`medium-v0` only.
|
| 101 |
-
|
| 102 |
-
`Return` and `Norm.` are mean±std over 50 episodes with seeds `0..49`. `Ctx` is context length. `max_steps=1000`, and KV cache max length is capped to `Ctx`.
|
| 103 |
-
|
| 104 |
-
To measure a bundle under that protocol, use
|
| 105 |
-
[`examples/deploy/reproduce.py`](https://github.com/ccnets-team/causal-gpt-rl/blob/main/examples/deploy/reproduce.py):
|
| 106 |
-
`python -m examples.deploy.reproduce --env-id Ant-v5`. The Quick Start's
|
| 107 |
-
`run_episodes` seeds only its first reset, so it cannot express `0..49`.
|
| 108 |
-
|
| 109 |
-
The runs behind these numbers are public at [wandb.ai/causal-gpt-rl/mujoco](https://wandb.ai/causal-gpt-rl/mujoco).
|
| 110 |
-
|
| 111 |
-
Normalized scores use random=0 and expert=100:
|
| 112 |
-
|
| 113 |
-
```text
|
| 114 |
-
100 * (return - random_ref) / (expert_ref - random_ref)
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
`Simple Ref.` and `Medium Ref.` are the normalized means of the Minari `simple-v0`
|
| 118 |
-
and `medium-v0` datasets. They are shown for context and are not the normalization
|
| 119 |
-
baseline. `✓` marks a reference the bundle's `Norm.` exceeds, `✗` one it does not.
|
| 120 |
-
|
| 121 |
-
### KV cache retention sweep
|
| 122 |
-
|
| 123 |
-

|
| 124 |
-
|
| 125 |
-
All bundles above share a `context_length` of **32** — the model's context
|
| 126 |
-
window, fixed in the bundle and not changeable at inference. `kv_cache_max_len`,
|
| 127 |
-
how much rollout history is retained, *is* a load-time knob; the headline scores
|
| 128 |
-
use `kv=32` (1×). Sweeping retention to 16 (0.5×), 32 (1×), and 64 (2×) tokens
|
| 129 |
-
under the same protocol — 50 episodes, seeds `0..49`, `max_steps=1000`:
|
| 130 |
-
|
| 131 |
-
| Bundle | `kv=16` (0.5×) | `kv=32` (1×) | `kv=64` (2×) | `kv=1000` (31.25×) |
|
| 132 |
-
| --- | ---: | ---: | ---: | ---: |
|
| 133 |
-
| `ant-v5` | 79.30±16.59 | 78.28±19.99 | **79.51±21.84** | 84.65±21.77 |
|
| 134 |
-
| `halfcheetah-v5` | 37.37±15.62 | **39.82±12.91** | 39.14±14.24 | 39.17±15.94 |
|
| 135 |
-
| `hopper-v5` |
|
| 136 |
-
| `walker2d-v5` | **61.74±0.73** | 61.41±0.52 | 61.40±0.69 | 60.73±3.73 |
|
| 137 |
-
| `humanoid-v5` | 86.20±23.84 | 91.63±11.99 | **93.37±0.45** | 86.25±20.91 |
|
| 138 |
-
| `humanoidstandup-v5` | **76.58±22.80** | 72.21±23.15 | 69.10±26.10 | — |
|
| 139 |
-
| `pusher-v5` | 95.65±4.72 | 95.66±4.74 | **95.69±4.72** | — |
|
| 140 |
-
| `swimmer-v5` | 79.19±1.54 | 72.62±1.68 | **79.24±3.84** | — |
|
| 141 |
-
|
| 142 |
-
KV1000 (31.25×) was measured only for Ant, HalfCheetah, Hopper, Walker2d, and Humanoid. It is a far-out-of-training-context extrapolation, not a recommended default serving setting. Unmeasured cells are shown as `—`.
|
| 143 |
-
|
| 144 |
-
Scores are normalized with random=0 and expert=100. Values are mean±std over 50 episodes.
|
| 145 |
-
|
| 146 |
-
The `kv=32` column matches the main table's `Norm.` column. Best retention is
|
| 147 |
-
**environment-dependent**, but the context window (1×) remains a safe default.
|
| 148 |
-
|
| 149 |
-
<details>
|
| 150 |
-
<summary><strong>KV retention interpretation</strong></summary>
|
| 151 |
-
|
| 152 |
-
At `kv=64` the rollout attends past the model's 32-token window, so every column
|
| 153 |
-
beyond `kv=32` extrapolates. That window is not a cap — the `kv=1000` column
|
| 154 |
-
sits far past it. What bounds retention is the episode: a cache only holds the
|
| 155 |
-
steps that have run, so with `max_steps=1000` any `kv` above 1000 behaves
|
| 156 |
-
exactly like `kv=1000`.
|
| 157 |
-
|
| 158 |
-
For most environments, differences across 0.5×/1×/2× are within run-to-run
|
| 159 |
-
noise (`Trend` marks these `≈`).
|
| 160 |
-
|
| 161 |
-
- **Ant-v5:** 2× has the highest mean; 0.5× is slightly steadier. **HalfCheetah-v5:** KV32 has the highest mean; KV64 and KV1000 remain close, with all 50 episodes reaching 1,000 steps.
|
| 162 |
-
- **Hopper-v5:** stable across retention lengths;
|
| 163 |
-
- **Walker2d-v5:** 0.5× has the highest mean; 1× and 2× are close, and all three complete 50/50 episodes. KV1000 completes 48/50 and is not the recommended default.
|
| 164 |
-
- **Humanoid-v5:** strongest and steadiest at 2×, scoring 93.37±0.45.
|
| 165 |
-
- **HumanoidStandup-v5:** highest and steadiest at 0.5×, scoring 76.58±22.80.
|
| 166 |
-
- **Pusher-v5:** flat across all three retention lengths at 95.65–95.69.
|
| 167 |
-
- **Swimmer-v5:** 0.5× and 2× tie on mean; 0.5× is substantially steadier.
|
| 168 |
-
|
| 169 |
-
</details>
|
| 170 |
-
|
| 171 |
-
All public bundles are trained only on Minari simple and medium trajectories;
|
| 172 |
-
expert trajectories are not used.
|
| 173 |
-
|
| 174 |
-
### Reproduction runtime
|
| 175 |
-
|
| 176 |
-
Every result above can be re-evaluated with the following reference stack:
|
| 177 |
-
|
| 178 |
-
```text
|
| 179 |
-
causal-gpt-rl 0.16.0
|
| 180 |
-
torch 2.8.0+cu129
|
| 181 |
-
gymnasium 1.2.3
|
| 182 |
-
mujoco 3.2.3
|
| 183 |
-
minari 0.5.3
|
| 184 |
-
```
|
| 185 |
-
|
| 186 |
-
`mujoco` is pinned to `3.2.3` because that is the version the Minari datasets
|
| 187 |
-
were recorded with (`requirements: ['mujoco==3.2.3', 'gymnasium>=1.0.0']`). The
|
| 188 |
-
`Norm.` and `Medium Ref.` columns are derived from those recorded trajectories,
|
| 189 |
-
so returns are only comparable to them when measured on the same physics.
|
| 190 |
-
|
| 191 |
-
## Bundle Format
|
| 192 |
-
|
| 193 |
-
Public bundles use `bundle_format_version=2`:
|
| 194 |
-
|
| 195 |
-
```text
|
| 196 |
-
bundle/
|
| 197 |
-
model.safetensors
|
| 198 |
-
config.json
|
| 199 |
-
```
|
| 200 |
-
|
| 201 |
-
- `model.safetensors` — model state dict for inference, with state
|
| 202 |
-
normalization statistics embedded in the weights.
|
| 203 |
-
- `config.json` — model config, observation specs, action specs, context length,
|
| 204 |
-
a `state_normalization` block, and optional `env_id`.
|
| 205 |
-
|
| 206 |
-
## Hugging Face Layout
|
| 207 |
-
|
| 208 |
-
Recommended layout:
|
| 209 |
-
|
| 210 |
-
```text
|
| 211 |
-
ccnets/causal-gpt-rl/
|
| 212 |
-
ant-v5/
|
| 213 |
-
model.safetensors
|
| 214 |
-
config.json
|
| 215 |
-
README.md
|
| 216 |
-
pusher-v5/
|
| 217 |
-
model.safetensors
|
| 218 |
-
config.json
|
| 219 |
-
swimmer-v5/
|
| 220 |
-
model.safetensors
|
| 221 |
-
config.json
|
| 222 |
-
```
|
| 223 |
-
|
| 224 |
-
For local bundles, use `load_runner("path/to/bundle")`.
|
| 225 |
-
|
| 226 |
-
## API
|
| 227 |
-
|
| 228 |
-
```python
|
| 229 |
-
from causal_gpt_rl.inference import (
|
| 230 |
-
PolicyRunner, # step-wise rollout policy with KV cache
|
| 231 |
-
load_runner, # load runner from a local bundle directory
|
| 232 |
-
load_runner_from_hub, # load runner from a Hugging Face Hub repo
|
| 233 |
-
run_episodes, # evaluate over N episodes; returns stats dict
|
| 234 |
-
export_bundle, # write a bundle directory from a runner
|
| 235 |
-
convert_legacy_bundle_to_safetensors, # migrate legacy bundles to the safetensors format
|
| 236 |
-
)
|
| 237 |
-
```
|
| 238 |
-
|
| 239 |
-
## Development Checks
|
| 240 |
-
|
| 241 |
-
```bash
|
| 242 |
-
python -m compileall -q causal_gpt_rl
|
| 243 |
-
python -m unittest discover -s tests
|
| 244 |
-
python -m build
|
| 245 |
-
python -m twine check dist/*
|
| 246 |
-
```
|
| 247 |
-
|
| 248 |
-
## License
|
| 249 |
-
|
| 250 |
-
Released under PolyForm Noncommercial License 1.0.0. See `LICENSE` for details. For commercial licensing, contact the maintainers via ccnets.org.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: polyform-noncommercial-1.0.0
|
| 4 |
+
license_link: https://polyformproject.org/licenses/noncommercial/1.0.0
|
| 5 |
+
library_name: pytorch
|
| 6 |
+
tags:
|
| 7 |
+
- reinforcement-learning
|
| 8 |
+
- gymnasium
|
| 9 |
+
- mujoco
|
| 10 |
+
- causal-gpt-rl
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Causal GPT-RL
|
| 14 |
+
|
| 15 |
+
GPT-style transformers (GPT-2, Llama) running as RL policies in continuous-control environments.
|
| 16 |
+
|
| 17 |
+
Both LLM generation and RL interaction are autoregressive:
|
| 18 |
+
|
| 19 |
+
```text
|
| 20 |
+
token → next token (LLM generation)
|
| 21 |
+
(state, action) → (next state from env, next action) (RL rollout)
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
|
| 26 |
+
Causal GPT-RL policies act stably under their own rollouts — long-horizon control without the drift that has historically kept transformers from being usable as RL agents.
|
| 27 |
+
|
| 28 |
+
A single autoregressive model drives full-episode rollouts via KV cache — no separate critic, no auxiliary networks at inference. The model carries a value head and computes it on every forward pass, but a rollout does not read it: the action alone carries the loop.
|
| 29 |
+
|
| 30 |
+
This repository is the public inference runtime. It loads policy bundles, runs Gymnasium/MuJoCo rollouts, and provides small evaluation helpers.
|
| 31 |
+
|
| 32 |
+
- **Code (GitHub):** [ccnets-team/causal-gpt-rl](https://github.com/ccnets-team/causal-gpt-rl)
|
| 33 |
+
- **Hugging Face org:** https://huggingface.co/ccnets
|
| 34 |
+
- **MuJoCo runs (W&B):** https://wandb.ai/causal-gpt-rl/mujoco
|
| 35 |
+
- Website: https://ccnets.org
|
| 36 |
+
- LinkedIn: https://www.linkedin.com/company/ccnets
|
| 37 |
+
|
| 38 |
+
## Install
|
| 39 |
+
|
| 40 |
+
For Hub loading and MuJoCo environments:
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
pip install "causal-gpt-rl[hub,mujoco]"
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
For local development:
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
git clone https://github.com/ccnets-team/causal-gpt-rl.git
|
| 50 |
+
cd causal-gpt-rl
|
| 51 |
+
python -m pip install -e ".[hub,mujoco]"
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
For private bundles, authenticate first:
|
| 55 |
+
|
| 56 |
+
```bash
|
| 57 |
+
hf auth login
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Quick Start
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
import gymnasium as gym
|
| 64 |
+
|
| 65 |
+
from causal_gpt_rl.inference import load_runner_from_hub, run_episodes
|
| 66 |
+
|
| 67 |
+
env = gym.make("Ant-v5")
|
| 68 |
+
runner = load_runner_from_hub(
|
| 69 |
+
repo_id="ccnets/causal-gpt-rl",
|
| 70 |
+
subfolder="ant-v5",
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
+
stats = run_episodes(env, runner, num_episodes=5, seed=0)
|
| 74 |
+
env.close()
|
| 75 |
+
print(stats["return_mean"], stats["return_std"])
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
Notebook version: [examples/hub_quickstart.ipynb](https://github.com/ccnets-team/causal-gpt-rl/blob/main/examples/hub_quickstart.ipynb)
|
| 79 |
+
|
| 80 |
+
## Supported Environments
|
| 81 |
+
|
| 82 |
+
| Bundle | Ctx | Return | Norm. | Simple Ref. | Medium Ref. |
|
| 83 |
+
|---|---:|---:|---:|---:|---:|
|
| 84 |
+
| `ant-v5` | 32 | 5208.80±1347.84 | 78.28±19.99 | 59.99 ✓ | 86.54 ✗ |
|
| 85 |
+
| `halfcheetah-v5` | 32 | 6312.03±2129.97 | 39.82±12.91 | 43.54 ✗ | 74.83 ✗ |
|
| 86 |
+
| `hopper-v5` | 32 | 3178.60±28.23 | 82.32±0.74 | 42.65 ✓ | 72.91 ✓ |
|
| 87 |
+
| `walker2d-v5` | 32 | 4206.39±35.44 | 61.41±0.52 | 59.51 ✓ | 83.26 ✗ |
|
| 88 |
+
| `humanoid-v5` | 32 | 7892.65±1018.11 | 91.63±11.99 | 63.29 ✓ | 81.30 ✓ |
|
| 89 |
+
| `humanoidstandup-v5` | 32 | 227703.73±61036.30 | 72.21±23.15 | 48.39 ✓ | 89.86 ✗ |
|
| 90 |
+
| `pusher-v5` | 32 | -30.18±5.84 | 95.66±4.74 | — | 94.19 ✓ |
|
| 91 |
+
| `swimmer-v5` | 32 | 257.74±5.98 | 72.62±1.68 | — | 59.44 ✓ |
|
| 92 |
+
|
| 93 |
+
**Gymnasium environment IDs:** `Ant-v5`, `HalfCheetah-v5`, `Hopper-v5`, `Walker2d-v5`, `Humanoid-v5`, `HumanoidStandup-v5`, `Pusher-v5`, and `Swimmer-v5`.
|
| 94 |
+
HF bundle subfolders are lowercase and case-sensitive (e.g. `humanoidstandup-v5`).
|
| 95 |
+
|
| 96 |
+
Training data is expert-free: bundles are trained using Minari simple and medium datasets only; expert trajectories are not used for training.
|
| 97 |
+
|
| 98 |
+
`Pusher-v5` and `Swimmer-v5` are exceptions: Minari does not publish a
|
| 99 |
+
`simple-v0` dataset for either environment, so these bundles were trained on
|
| 100 |
+
`medium-v0` only.
|
| 101 |
+
|
| 102 |
+
`Return` and `Norm.` are mean±std over 50 episodes with seeds `0..49`. `Ctx` is context length. `max_steps=1000`, and KV cache max length is capped to `Ctx`.
|
| 103 |
+
|
| 104 |
+
To measure a bundle under that protocol, use
|
| 105 |
+
[`examples/deploy/reproduce.py`](https://github.com/ccnets-team/causal-gpt-rl/blob/main/examples/deploy/reproduce.py):
|
| 106 |
+
`python -m examples.deploy.reproduce --env-id Ant-v5`. The Quick Start's
|
| 107 |
+
`run_episodes` seeds only its first reset, so it cannot express `0..49`.
|
| 108 |
+
|
| 109 |
+
The runs behind these numbers are public at [wandb.ai/causal-gpt-rl/mujoco](https://wandb.ai/causal-gpt-rl/mujoco).
|
| 110 |
+
|
| 111 |
+
Normalized scores use random=0 and expert=100:
|
| 112 |
+
|
| 113 |
+
```text
|
| 114 |
+
100 * (return - random_ref) / (expert_ref - random_ref)
|
| 115 |
+
```
|
| 116 |
+
|
| 117 |
+
`Simple Ref.` and `Medium Ref.` are the normalized means of the Minari `simple-v0`
|
| 118 |
+
and `medium-v0` datasets. They are shown for context and are not the normalization
|
| 119 |
+
baseline. `✓` marks a reference the bundle's `Norm.` exceeds, `✗` one it does not.
|
| 120 |
+
|
| 121 |
+
### KV cache retention sweep
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
|
| 125 |
+
All bundles above share a `context_length` of **32** — the model's context
|
| 126 |
+
window, fixed in the bundle and not changeable at inference. `kv_cache_max_len`,
|
| 127 |
+
how much rollout history is retained, *is* a load-time knob; the headline scores
|
| 128 |
+
use `kv=32` (1×). Sweeping retention to 16 (0.5×), 32 (1×), and 64 (2×) tokens
|
| 129 |
+
under the same protocol — 50 episodes, seeds `0..49`, `max_steps=1000`:
|
| 130 |
+
|
| 131 |
+
| Bundle | `kv=16` (0.5×) | `kv=32` (1×) | `kv=64` (2×) | `kv=1000` (31.25×) |
|
| 132 |
+
| --- | ---: | ---: | ---: | ---: |
|
| 133 |
+
| `ant-v5` | 79.30±16.59 | 78.28±19.99 | **79.51±21.84** | 84.65±21.77 |
|
| 134 |
+
| `halfcheetah-v5` | 37.37±15.62 | **39.82±12.91** | 39.14±14.24 | 39.17±15.94 |
|
| 135 |
+
| `hopper-v5` | 82.37±0.71 | 82.32±0.74 | **82.48±0.61** | 82.26±0.98 |
|
| 136 |
+
| `walker2d-v5` | **61.74±0.73** | 61.41±0.52 | 61.40±0.69 | 60.73±3.73 |
|
| 137 |
+
| `humanoid-v5` | 86.20±23.84 | 91.63±11.99 | **93.37±0.45** | 86.25±20.91 |
|
| 138 |
+
| `humanoidstandup-v5` | **76.58±22.80** | 72.21±23.15 | 69.10±26.10 | — |
|
| 139 |
+
| `pusher-v5` | 95.65±4.72 | 95.66±4.74 | **95.69±4.72** | — |
|
| 140 |
+
| `swimmer-v5` | 79.19±1.54 | 72.62±1.68 | **79.24±3.84** | — |
|
| 141 |
+
|
| 142 |
+
KV1000 (31.25×) was measured only for Ant, HalfCheetah, Hopper, Walker2d, and Humanoid. It is a far-out-of-training-context extrapolation, not a recommended default serving setting. Unmeasured cells are shown as `—`.
|
| 143 |
+
|
| 144 |
+
Scores are normalized with random=0 and expert=100. Values are mean±std over 50 episodes.
|
| 145 |
+
|
| 146 |
+
The `kv=32` column matches the main table's `Norm.` column. Best retention is
|
| 147 |
+
**environment-dependent**, but the context window (1×) remains a safe default.
|
| 148 |
+
|
| 149 |
+
<details>
|
| 150 |
+
<summary><strong>KV retention interpretation</strong></summary>
|
| 151 |
+
|
| 152 |
+
At `kv=64` the rollout attends past the model's 32-token window, so every column
|
| 153 |
+
beyond `kv=32` extrapolates. That window is not a cap — the `kv=1000` column
|
| 154 |
+
sits far past it. What bounds retention is the episode: a cache only holds the
|
| 155 |
+
steps that have run, so with `max_steps=1000` any `kv` above 1000 behaves
|
| 156 |
+
exactly like `kv=1000`.
|
| 157 |
+
|
| 158 |
+
For most environments, differences across 0.5×/1×/2× are within run-to-run
|
| 159 |
+
noise (`Trend` marks these `≈`).
|
| 160 |
+
|
| 161 |
+
- **Ant-v5:** 2× has the highest mean; 0.5× is slightly steadier. **HalfCheetah-v5:** KV32 has the highest mean; KV64 and KV1000 remain close, with all 50 episodes reaching 1,000 steps.
|
| 162 |
+
- **Hopper-v5:** stable across retention lengths; KV64 has the highest mean, while KV1000 completes 49/50 full episodes.
|
| 163 |
+
- **Walker2d-v5:** 0.5× has the highest mean; 1× and 2× are close, and all three complete 50/50 episodes. KV1000 completes 48/50 and is not the recommended default.
|
| 164 |
+
- **Humanoid-v5:** strongest and steadiest at 2×, scoring 93.37±0.45.
|
| 165 |
+
- **HumanoidStandup-v5:** highest and steadiest at 0.5×, scoring 76.58±22.80.
|
| 166 |
+
- **Pusher-v5:** flat across all three retention lengths at 95.65–95.69.
|
| 167 |
+
- **Swimmer-v5:** 0.5× and 2× tie on mean; 0.5× is substantially steadier.
|
| 168 |
+
|
| 169 |
+
</details>
|
| 170 |
+
|
| 171 |
+
All public bundles are trained only on Minari simple and medium trajectories;
|
| 172 |
+
expert trajectories are not used.
|
| 173 |
+
|
| 174 |
+
### Reproduction runtime
|
| 175 |
+
|
| 176 |
+
Every result above can be re-evaluated with the following reference stack:
|
| 177 |
+
|
| 178 |
+
```text
|
| 179 |
+
causal-gpt-rl 0.16.0
|
| 180 |
+
torch 2.8.0+cu129
|
| 181 |
+
gymnasium 1.2.3
|
| 182 |
+
mujoco 3.2.3
|
| 183 |
+
minari 0.5.3
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
`mujoco` is pinned to `3.2.3` because that is the version the Minari datasets
|
| 187 |
+
were recorded with (`requirements: ['mujoco==3.2.3', 'gymnasium>=1.0.0']`). The
|
| 188 |
+
`Norm.` and `Medium Ref.` columns are derived from those recorded trajectories,
|
| 189 |
+
so returns are only comparable to them when measured on the same physics.
|
| 190 |
+
|
| 191 |
+
## Bundle Format
|
| 192 |
+
|
| 193 |
+
Public bundles use `bundle_format_version=2`:
|
| 194 |
+
|
| 195 |
+
```text
|
| 196 |
+
bundle/
|
| 197 |
+
model.safetensors
|
| 198 |
+
config.json
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
- `model.safetensors` — model state dict for inference, with state
|
| 202 |
+
normalization statistics embedded in the weights.
|
| 203 |
+
- `config.json` — model config, observation specs, action specs, context length,
|
| 204 |
+
a `state_normalization` block, and optional `env_id`.
|
| 205 |
+
|
| 206 |
+
## Hugging Face Layout
|
| 207 |
+
|
| 208 |
+
Recommended layout:
|
| 209 |
+
|
| 210 |
+
```text
|
| 211 |
+
ccnets/causal-gpt-rl/
|
| 212 |
+
ant-v5/
|
| 213 |
+
model.safetensors
|
| 214 |
+
config.json
|
| 215 |
+
README.md
|
| 216 |
+
pusher-v5/
|
| 217 |
+
model.safetensors
|
| 218 |
+
config.json
|
| 219 |
+
swimmer-v5/
|
| 220 |
+
model.safetensors
|
| 221 |
+
config.json
|
| 222 |
+
```
|
| 223 |
+
|
| 224 |
+
For local bundles, use `load_runner("path/to/bundle")`.
|
| 225 |
+
|
| 226 |
+
## API
|
| 227 |
+
|
| 228 |
+
```python
|
| 229 |
+
from causal_gpt_rl.inference import (
|
| 230 |
+
PolicyRunner, # step-wise rollout policy with KV cache
|
| 231 |
+
load_runner, # load runner from a local bundle directory
|
| 232 |
+
load_runner_from_hub, # load runner from a Hugging Face Hub repo
|
| 233 |
+
run_episodes, # evaluate over N episodes; returns stats dict
|
| 234 |
+
export_bundle, # write a bundle directory from a runner
|
| 235 |
+
convert_legacy_bundle_to_safetensors, # migrate legacy bundles to the safetensors format
|
| 236 |
+
)
|
| 237 |
+
```
|
| 238 |
+
|
| 239 |
+
## Development Checks
|
| 240 |
+
|
| 241 |
+
```bash
|
| 242 |
+
python -m compileall -q causal_gpt_rl
|
| 243 |
+
python -m unittest discover -s tests
|
| 244 |
+
python -m build
|
| 245 |
+
python -m twine check dist/*
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
## License
|
| 249 |
+
|
| 250 |
+
Released under PolyForm Noncommercial License 1.0.0. See `LICENSE` for details. For commercial licensing, contact the maintainers via ccnets.org.
|
hopper-v5/model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 16818584
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:342016f5a64dbdec1636fb659df4cfe43820ac907bc095b0f8701e9cfddc02ee
|
| 3 |
size 16818584
|