rust-env-hotpath
Rust + PyO3 hot-path primitives for reinforcement learning.
Rustopen source
Problem
In RL training the per-step Python overhead - computing returns, pushing and sampling from a replay buffer - can dominate runtime. The goal was to move just those hot paths into Rust without rewriting the whole stack.
Approach
- Implemented return and advantage computation in Rust for tight, allocation-light loops.
- Built a replay buffer in Rust with efficient insertion and sampling.
- Exposed both to Python through PyO3 so existing training code calls them like any other Python function.
- Kept the Python-facing API minimal so the Rust layer is a drop-in optimisation, not a new framework.
Tech
RustPyO3PythonReinforcement learning
Status
Shipped and open source. A focused performance project that pairs with the PPO implementations.