# DispatchGym: Grab’s reinforcement learning research framework

[Grab](https://yomu.fyi/company/grab) · Tan Sien Yi · Jul 7, 2025

## Summary

Applying reinforcement learning to dispatch systems is often hindered when the chosen control levers exert weak influence over reward functions. To streamline research, Grab built DispatchGym, a framework that connects reinforcement learning algorithms to a dispatch process simulation via the Gymnasium API. The simulation emphasizes directional accuracy over absolute precision, allowing researchers to evaluate relative metric shifts across supply and demand scenarios. Built in modular Python and accelerated with Numba, the system allows data scientists to test code locally and launch distributed Spark executions with a single command-line call. The framework has been used to evaluate various contextual bandit models and action sampling strategies for tuning dispatch hyperparameters.

## Takeaways

- Reinforcement learning becomes ineffective when a manipulated lever exerts negligible influence on the reward function, making reward sensitivity and lever selection critical.
- DispatchGym's simulated environment prioritizes directional accuracy over absolute real-world metric matching, ensuring reliable sim-to-sim comparisons during research.
- To lower barriers while preserving efficiency, DispatchGym combines a modular Python codebase with Numba acceleration and runs distributed experiments as Spark jobs via a single CLI command.

**Tags:** [Architecture](https://yomu.fyi/topic/architecture), [Machine Learning](https://yomu.fyi/topic/machine-learning), [Python](https://yomu.fyi/topic/python)

[Read original post](https://engineering.grab.com/techblog_-dispatchgym)
