Abstract
We detail the motivation and design decisions underpinning Flow, a computational framework integrating SUMO with the deep reinforcement learning libraries rllab and RLlib, allowing researchers to apply deep reinforcement learning (RL) methods to traffic scenarios, and permitting vehicle and infrastructure control in highly varied traffic environments. Users of Flow can rapidly design a wide variety of traffic scenarios in SUMO, enabling the development of controllers for autonomous vehicles and intelligent infrastructure across a broad range of settings. Flow facilitates the use of policy optimization algorithms to train controllers that can optimize for highly customizable traffic metrics, such as traffic flow or system-wide average velocity. Training reinforcement learning agents using such methods requires a massive amount of data, thus simulator reliability and scalability were major challenges in the development of Flow. A contribution of this work is a variety of practical techniques for overcoming such challenges with SUMO, including parallelizing policy rollouts, smart exception and collision handling, and leveraging subscriptions to reduce computational overhead. To demonstrate the resulting performance and reliability of Flow, we introduce the canonical single-lane ring road benchmark and briefly discuss prior work regarding that task. We then pose a more complex and challenging multi-lane setting and present a trained controller for a single vehicle that stabilizes the system. Flow is an open-source tool and available online at https://github.com/cathywu/flow.
Introduction
Traffic congestion is a pervasive issue with significant economic and environmental consequences. Designing effective controllers for autonomous vehicles (AVs) and intelligent infrastructure is a complex task due to the non-linear and often unpredictable nature of human driving behavior. While Deep Reinforcement Learning (RL) offers a promising path toward learning optimal control policies through iterative interaction, it requires vast amounts of data. Existing high-fidelity traffic simulators, such as SUMO (Simulation of Urban MObility), were not originally built for the high-throughput demands of modern RL workflows. This paper presents Flow, an open-source framework that bridges this gap, providing a scalable and modular interface between SUMO and state-of-the-art RL libraries.
The Flow Framework
Flow is designed as a modular Python framework that integrates SUMO with RL libraries like rllab and RLlib. Its architecture addresses the "data hunger" of RL through several technical innovations:
- Modular Design: Flow separates the problem into
Scenarios(defining network geometry),Environments(defining MDP logic, states, and rewards), andGenerators(automating the creation of SUMO configuration files). - Scalable Parallelization: To accelerate training, Flow supports spawning multiple SUMO instances across CPU cores or cloud clusters (e.g., AWS), significantly reducing the time required for policy rollouts.
- Communication Efficiency: Rather than constant per-step polling, Flow utilizes TraCI "subscriptions" to fetch vehicle data in bulk, minimizing computational overhead.
- Safety Fail-safes: To prevent agents from learning suboptimal behaviors through constant collisions, Flow incorporates "fail-safe" rules. These rules override dangerous AI actions during training without biasing the learning process with sparse negative rewards.
Benchmark Scenarios
Flow enables the rapid creation of diverse traffic environments, ranging from simple synthetic tracks to complex urban layouts. Key benchmark scenarios include:
- Ring Roads: The canonical single-lane and multi-lane setups used for studying the stabilization of traffic waves (phantom jams).
- Figure-Eight Networks: Designed to evaluate complex intersection and merging dynamics.
- Intersection Grids: For the optimization of traffic light patterns and urban flow.
- Real-world Integration: Flow supports importing road networks directly from OpenStreetMap (OSM), allowing researchers to train policies on actual urban geometries.
Key Results and Insights
Experimental evaluations demonstrate that RL agents trained within Flow can effectively manage traffic flow. In a 22-vehicle ring road, a single RL-controlled vehicle successfully stabilized traffic, outperforming previous hand-designed controllers. In more challenging multi-lane scenarios, the RL agent discovered emergent strategies, such as rapid lane-changing to "block" shockwave propagation—a behavior similar to "traffic breaks" used by highway patrols.
Quantitatively, the RL agent improved system-wide average velocity in a two-lane ring road from 2.83 m/s (human-only baseline) to 3.11 m/s. Furthermore, Flow's scalability was demonstrated using RLlib on 128 CPUs, which achieved a 4.55x speedup relative to a 16-CPU baseline, confirming the framework's ability to handle massive data requirements.
Conclusion and Future Work
Flow provides a robust, open-source platform for applying deep RL to traffic control problems. While current results are promising, future work will focus on scaling to large-scale multi-agent cooperative fleets. Additionally, the authors plan to transition from socket-based communication (TraCI) to libsumo for direct C++ interfacing, which is expected to further accelerate simulation speeds and reduce latency.
Summary updated