HighJax: Highway Driving environment for Reinforcement Learning research
PPO agent learning to drive on a 4-lane highway
HighJax is an autonomous driving environment for Reinforcement Learning research. It's a JAX implementation of the HighwayEnv. HighJax provides a fully JIT-compilable and vectorizable highway driving simulation.
Besides being much faster than the original, it provides Octane, a Rust-based TUI for examining your experiment runs. Octane provides an interface for defining behaviors and then measuring how much each policy exhibits them.
HighJax was produced as part of our research project about BXRL: Behavior-Explainable Reinforcement Learning.
Installation
pip install highjax # Minimal installation
pip install "highjax[cuda12]" # Including GPU support
pip install "highjax[trainer]" # Including PPO implementation
pip install "highjax[cuda12,trainer]" # Including both
Quick Start
import jax
import highjax
env, params = highjax.make('highjax-v0')
key = jax.random.PRNGKey(0)
obs, state = env.reset(key, params)
obs, state, reward, done, info = env.step(key, state, 1, params) # IDLE
Using with JAX RL Libraries
HighJax follows the gymnax API, so it works with JAX RL frameworks that expect gymnax-style environments:
- PureJaxRL — drop-in gymnax replacement (no PureJaxRL install needed), see
examples/use_purejaxrl.py - Stoix — via
stoagymnax adapter, seeexamples/use_stoix.py - Rejax — pass env object directly, see
examples/use_rejax.py
Training
Train a PPO agent via the CLI:
highjax-trainer train
Key options:
| Flag | Default | Description |
|---|---|---|
--n-epochs / -e |
300 | Training epochs |
--n-es |
400 | Parallel episodes per epoch |
--n-ts |
40 | Timesteps per episode |
--seed / -s |
0 | Random seed |
--actor-lr |
3e-4 | Actor learning rate |
--critic-lr |
3e-3 | Critic learning rate |
--n-npcs |
50 | NPC vehicles |
--no-trek |
— | Disable trek recording |
--n-sample-es |
1 | Episodes to sample per epoch for trek |
--trek-path |
auto | Custom trek directory path |
--discount |
0.95 | Discount factor (gamma) |
--n-lanes |
4 | Number of highway lanes |
Training automatically records episode data to ~/.highjax/t/ for browsing with Octane (the TUI). Use --no-trek to disable.
Here's a snazzy one-liner that will let you explore the results of the current experiment run using VisiData:
pip install visidata
vd "$(ls -d ~/.highjax/t/2*/ | tail -1)"/epochia.pq
Use the following command line to produce similar results as seen in Figure 2 of the paper:
highjax-trainer train --n-es 128 --n-ts 400 --n-epochs 300 --target-kld 0.0005
Octane (Episode Browser)
This repo also includes Octane, which is a Rust-based TUI for browsing HighJax experiments.
Installation
sudo apt-get install build-essential # C toolchain (needed by Rust)
sudo apt-get install ffmpeg # Needed for `octane animate`
git clone https://github.com/HumanCompatibleAI/HighJax # Clone this repo
cd HighJax
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Install Rust
source "$HOME/.cargo/env"
cd octane && cargo build --release # Build Octane
alias octane="$(readlink -f octane/target/release/octane)"
The binary will be at octane/target/release/octane.
Usage
After training, launch Octane to see all the experiments you ran with highjax-trainer:
octane
Figures
Use Octane to make figures for your paper:
octane draw -t ~/.highjax/t/2026-03-15_20-02-25_101327 --epoch 300 -e 0 --timestep 19 --theme light \
--zoom 1.8 --png ~/figure.png
Behavior crafting
Octane includes a behavior explorer for defining measurable policy properties. While watching an episode, press b to capture a scenario — mark which actions you want (positive weight) or don't want (negative weight) at that traffic state. Name it, and Octane saves the behavior to ~/.highjax/behaviors/. The next time you run highjax-trainer train, all discovered behaviors are evaluated every epoch and their scores are recorded as behavior.{name} columns in epochia.parquet.
Defining a behavior scenario in Octane
Press B (Shift-B) to open the full Behavior Explorer tab.
See the Octane docs for full details.
Documentation
Full documentation is in the docs/ folder:
- HighJax environment docs — state, observations, reward, NPCs, physics
- Octane TUI docs — episode browser, configuration, key bindings
- Coding conventions — naming, array indices, style
Examples
examples/basic_usage.py— Create env, reset, step, print observationsexamples/train_ppo.py— Train a PPO agent and evaluate itexamples/use_purejaxrl.py— PureJaxRL integration (vectorized scan loop)examples/use_stoix.py— Stoix integration (via stoa gymnax adapter)examples/use_rejax.py— Rejax integration (JIT-compiled training, vmapped seeds)
Citation
If you use HighJax in your research, please cite:
@article{rachum2026bxrl,
title={BXRL: Behavior-Explainable Reinforcement Learning},
author={Ram Rachum and Yotam Amitai and Yonatan Nakar and Reuth Mirsky and Cameron Allen},
year={2026},
eprint={2603.23738},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2603.23738},
}
Metadata
Release files for highjax 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| highjax-0.1.0.tar.gz | 83.9 kB | Without provenance | Details for highjax-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| highjax-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for highjax-0.1.0-py3-none-any.whl |
Total release size: 186.4 kB
Release files / highjax-0.1.0.tar.gz
| Download URL | highjax-0.1.0.tar.gz |
|---|---|
| Size | 83.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77cf8acd1bc734021397a869b0304959fc44ab174ee1d1d1c54e5586e9d6af5e
|
|
BLAKE2b-256 checksum How to use checksums |
72a719d92900c3fee73cda27a5805577a2cb652e66f312fd16018d590140807b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / highjax-0.1.0-py3-none-any.whl
| Download URL | highjax-0.1.0-py3-none-any.whl |
|---|---|
| Size | 102.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47fd2774e01ab8900dc6710e433e527fb8ef07453a29d21ec5aa857cc5562380
|
|
BLAKE2b-256 checksum How to use checksums |
d0e9e8dc5ef81c70879ed19c15b46fb8df5bcb7a65515c1b28378f9d2c679595
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Security for highjax 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.