Abstract
Bus bunching remains a significant challenge in urban transit, leading to inefficient service and increased passenger wait times. While Reinforcement Learning (RL) offers a promising data-driven approach to bus holding control, the manual engineering of reward functions often limits its effectiveness and generalizability. This paper presents an automated framework that leverages Large Language Models (LLMs) to iteratively design and refine reward functions. By acting as a "meta-engineer," the LLM-enhanced RL paradigm outperforms traditional methods in both synthetic and real-world scenarios, demonstrating robust zero-shot generalization across complex transit networks.
Introduction
"Bus bunching" occurs when delays cause buses on the same route to cluster, resulting in irregular headways and poor service quality. Traditional bus holding control strategies—intentionally delaying buses at stops—often rely on precise mathematical models that struggle with real-world data noise and passenger demand variability. While Reinforcement Learning (RL) can learn optimal policies from data, it faces a "reward engineering" bottleneck: translating high-level objectives like "minimizing wait time" into precise mathematical signals is a labor-intensive process prone to human error.
The LLM-Enhanced RL Framework
To address the reward engineering bottleneck, this research introduces a closed-loop system where an LLM (e.g., GPT-4) automates the design of reward functions for a Deep Q-Network (DQN) agent.
The framework is composed of four specialized modules:
- Reward Initializer: Generates executable Python code for the initial reward function based on natural language descriptions.
- Performance Analyzer: Evaluates training logs and trajectories to diagnose strategy failures (e.g., excessive holding times).
- Reward Modifier: Iteratively rewrites the reward code based on the analyzer's feedback.
- Reward Refiner: A critical safety mechanism that compares new reward functions against historical benchmarks, rejecting "hallucinated" or sub-optimal code.
Experimental Evaluation
The framework was tested across three scenarios of increasing complexity:
- Synthetic Circular Route: A controlled environment with 8 stops and 6 buses to establish baseline performance.
- Beijing Two-Line System: A real-world application using IC card data from Lines 1 and 52 in Beijing, featuring a shared corridor.
- Large-Scale Beijing Network: A six-line system used to test the "zero-shot" capability of reward functions designed for smaller networks.
Key Results and Insights
The LLM-enhanced RL approach demonstrated significant improvements over traditional baselines:
- Efficiency: In synthetic tests, the framework reduced average travel time by 3.73% and waiting time by 12.29% compared to standard RL strategies.
- Operational Quality: In the Beijing case study, the agent achieved superior service quality with 43% fewer holding interventions than traditional feedback controllers, minimizing unnecessary passenger delays.
- Generalization: A pivotal finding was the framework's zero-shot capability; reward functions evolved on a two-line system remained highly effective when applied to a six-line network without retraining. This suggests that LLMs can capture fundamental principles of transit dynamics.
- LLM as Meta-Engineer: The study found that while LLMs may not be suitable for real-time control due to latency, they excel at offline logic design. Furthermore, the LLM discovered nuances in shared-corridor dynamics that human-designed formulas often overlook.
Conclusion
The integration of LLMs into the RL pipeline effectively automates the most difficult aspect of agent design: reward engineering. By treating RL training results as ground-truth feedback, the framework mitigates LLM hallucinations and produces robust, generalizable control strategies. Future work will explore fine-tuning LLMs on specialized transportation datasets and extending this paradigm to other urban infrastructure challenges like traffic signal control.
Summary updated