The proliferation of ride-sharing platforms in urban India has created a pressing need for intelligent, transparent, and cost-efficient dynamic pricing systems. This paper presents the design, implementation, and evaluation of a real-time dynamic pricing engine for ride-sharing services, built entirely on a serverless AWS architecture. The proposed system integrates an XGBoost machine learning model trained on 12,000 synthetically generated ride samples to predict optimal fares based on ten contextual features, including trip distance, estimated travel time, driver-rider demand ratio, weather conditions, and traffic congestion levels. Unlike conventional approaches that multiply a static base rate by a surge factor, the proposed additive pricing formula decomposes every rupee of the final fare into individually visible and traceable components: distance fee, time fee, weather surcharge, traffic surcharge, and demand-based surge fee. A React-based frontend hosted on Amazon S3 and powered by the TomTom Maps SDK delivers live visualisation of drivers, riders, routes, and pricing signals. AWS EventBridge schedules background city simulation via two Lambda functions that update driver positions and maintain a live rider request pool every minute. Generative AI-powered fare explanations are produced via the Groq API using the LLaMA 3.3 70B model, providing passengers with natural-language price transparency. Experimental results demonstrate that the XGBoost model achieves a Mean Absolute Error of Rs 4.23 and an R² score of 0.9982 on a held-out test set, while the entire system operates within the AWS Free Tier at near-zero cost.
Introduction
The text presents a serverless, AI-enhanced dynamic pricing system for ride-sharing services built for Puducherry, India. It focuses on improving transparency, scalability, and fairness in fare calculation for platforms like Uber and Ola, where pricing logic is usually opaque.
The study highlights that existing ride-hailing pricing models rely on hidden or fixed base-rate systems and lack transparency for users. Additionally, many academic models are either not cost-efficient or are difficult to deploy due to heavy infrastructure requirements. To address these issues, the proposed system introduces a fully additive pricing model, where every component of the fare (distance, time, weather, traffic, and demand surge) is explicitly calculated and visible to users.
A machine learning model using XGBoost regression is trained on a synthetic dataset generated from this pricing formula. This ensures the model learns directly from the same logic used in production. The system achieves high performance with strong accuracy (low error and high R² score), showing reliable fare prediction.
The architecture is built on AWS serverless services including Lambda, API Gateway, DynamoDB, and S3, enabling low-cost, scalable deployment without traditional server management. Background services simulate real-time driver movement and rider demand to mimic live ride-hailing conditions.
A key innovation is the integration of Generative AI (LLaMA 3 via Groq API), which explains fare calculations in natural language, improving transparency for passengers and providing earnings insights for drivers.
Overall, the system combines an additive pricing formula, machine learning prediction, serverless cloud architecture, and generative AI explanations to create a transparent, scalable, and intelligent ride-sharing pricing platform that addresses both technical and user trust challenges.
Conclusion
This paper presented a real-time dynamic pricing engine for ride-sharing applications that combines serverless AWS infrastructure, XGBoost machine learning, live weather and traffic signal integration, and Generative AI-powered fare explanations. The system achieves an MAE of Rs 4.23 and R² of 0.9982, operates at near-zero cost within the AWS Free Tier, and provides full fare transparency through both structured itemised breakdowns and LLaMA 3.3 70B-generated natural language explanations. The additive pricing formula is a meaningful departure from conventional base-rate models, enabling passengers to verify every rupee of their fare.
The work demonstrates that production-grade, AI-powered pricing systems can be developed and deployed for regional markets without large-scale operational data, proprietary datasets, or significant cloud expenditure. The architecture is directly extensible to other cities and transport modalities. Three directions for future work are identified: (i) retraining the XGBoost model on real trip data from local operators; (ii) incorporating reinforcement learning for adaptive pricing policy optimisation; and (iii) extending the system with a complete booking, driver-matching, and payment flow to achieve end-to-end ride-hailing functionality.
References
[1] Uber Technologies Inc., \"How surge pricing works,\" Uber Newsroom, 2023. [Online]. Available: https://www.uber.com/en-IN/blog/how-surge-pricing-works/
[2] K. Chen and M. Sheldon, \"Dynamic pricing in a labor market: Surge pricing and flexible work on the Uber platform,\" in Proc. ACM Conf. Economics and Computation, 2016, pp. 455-455.
[3] J. C. Castillo, D. Knoepfle, and G. Weyl, \"Surge pricing solves the wild goose chase,\" in Proc. ACM Conf. Economics and Computation, 2017, pp. 241-242.
[4] M. Neun, C. Eickhoff, and M. Raubal, \"Taxi fare prediction using gradient boosting and GPS trip data,\" in Proc. IEEE Int. Conf. Mobile Data Management, 2019, pp. 241-246.
[5] D. Wang, J. Zhang, W. Cao, J. Li, and Y. Zheng, \"When will you arrive? Estimating travel time based on deep neural networks,\" in Proc. AAAI Conf. Artificial Intelligence, 2018, pp. 2500-2507.
[6] P. Koonce and L. Rodgers, \"Urban mobility demand prediction using gradient boosted trees,\" J. Transportation Engineering, vol. 148, no. 4, pp. 1-12, 2022.
[7] L. Zhang, Y. Wu, and H. Chen, \"Serverless computing for real-time mobility services on AWS Lambda,\" IEEE Trans. Cloud Computing, vol. 10, no. 3, pp. 1812-1825, 2022.
[8] J. M. Hellerstein et al., \"Serverless computing: One step forward, two steps back,\" in Proc. CIDR, 2019.
[9] T. Brown et al., \"Language models are few-shot learners,\" in Advances in Neural Information Processing Systems, vol. 33, pp. 1877-1901, 2020.
[10] L. Zhao, X. Wang, and Y. Liu, \"Explaining financial decisions with large language models,\" IEEE Access, vol. 11, pp. 45231-45244, 2023.
[11] T. Chen and C. Guestrin, \"XGBoost: A scalable tree boosting system,\" in Proc. 22nd ACM SIGKDD Int. Conf. Knowledge Discovery and Data Mining, 2016, pp. 785-794.
[12] F. Pedregosa et al., \"Scikit-learn: Machine learning in Python,\" J. Machine Learning Research, vol. 12, pp. 2825-2830, 2011.