Micromobility has transformed the way people move around cities. Bike-sharing systems, electric scooters and other light-vehicle solutions are now part of the urban transport ecosystem. For these services to be profitable and sustainable, operators need to anticipate station-level demand with a high degree of reliability. Knowing how many trips will take place tomorrow is not enough; it is essential to know which station will generate each flow and at what time. This predictive capacity determines fleet redistribution, preventive maintenance and user experience.
The challenge is enormously complex. Each station has its own dynamics, depending on its location, surrounding urban fabric, nearby public transport offer and local commercial or residential activity. Added to this is the influence of neighbouring stations, because users often pick up a bike in one place and return it in another. The temporal dimension adds further complexity: flows vary according to time of day, day of week, special events, weather conditions or season. Classical statistical methods fall short when faced with this combination of factors. Conventional machine learning models, while more powerful, also struggle to capture long-range dependencies efficiently in extensive urban networks.
In this context, the STAGformer architecture, a spatio-temporal graph transformer, proposes an innovative solution. Its main premise is that global attention can be structured through intermediate agents. Instead of calculating the relationship between every pair of stations and every pair of time instants, the model introduces a small set of learnable tokens that act as information aggregators. First, spatial and temporal agents traverse the graph to collect the global state of the network. Then, that condensed information is distributed back to all stations and time steps. This mechanism reduces the computational complexity of standard self-attention from quadratic to linear (O(NT)), making it possible to work with large cities without sacrificing the ability to model long-distance relationships.
The architecture combines four essential modules. The first is a spatio-temporal encoder that integrates the dynamic features of each station — number of free docks, available bikes, historical flow — with external contextual variables such as weather, time or nearby points of interest. The second module is graph propagation, which aggregates information from neighbouring stations and captures local spatial dependence. The third is a temporal convolution, which extracts short-term patterns from demand series. The fourth is the already mentioned agent attention mechanism, responsible for modelling global dependencies. The combination of these four modules allows the model to understand both the local behaviour of each station and the global dynamics of the entire network.
Agent attention deserves special attention. Spatial and temporal tokens are not graph nodes, but parameters learned during training. In the first phase, each spatial agent attends to all stations and condenses the most relevant regularities of the network into a latent vector. At the same time, temporal agents do the same with all time steps, identifying trends, seasonalities and anomalies. In the second phase, the information is broadcast back to the original nodes. This back-and-forth avoids the combinatorial explosion of comparing every station with all others at every instant, while preserving the expressive richness of a global attention mechanism.
Experiments on real-world datasets, such as Citi Bike records in New York and Divvy in Chicago, show that STAGformer outperforms existing alternatives across different prediction horizons, with significant improvements in metrics such as RMSE and MAE. Beyond the numbers, the relevant point is that the improvement holds when the horizon lengthens. For an operator, this means being able to plan not only the next hour, but the whole day with greater confidence.
From a business perspective, demand forecasting accuracy has a direct impact on the bottom line. A poorly distributed fleet creates empty or full stations, dissatisfied users and unnecessary operating costs. With models like STAGformer, an operator can optimise redistribution truck routes, prioritise maintenance interventions and dynamically adjust the capacity of each station. Predictive information is also a valuable source for urban planning: it allows municipalities to size infrastructure, locate new stations and design evidence-based mobility policies.
At Q2BSTUDIO, a software and technology development company, we have been applying these principles in real projects for years. Our specialty is custom software development for mobility and logistics, combining software engineering with artificial intelligence. We work with AWS/Azure cloud architectures to process large volumes of data in real time, and we use BI/Power BI tools to turn predictions into actionable dashboards. Cybersecurity is another essential layer: mobility systems handle personal and critical data, so we protect every integration with advanced security protocols and continuous audits.
The next qualitative leap lies in automation. Predictions generated by architectures like STAGformer do not have to stay in a report. They can feed AI agents that suggest or execute actions: reassigning a van to an area with high expected demand, freeing docks at certain stations or triggering alerts when a shortage is forecast. These agents act as an augmented operations team, freeing people for tasks of greater strategic value. At Q2BSTUDIO we design this kind of integrated solution, from the predictive model to the final interface used by the operations team.
In short, micromobility needs models that live up to its complexity. STAGformer offers a promising way to overcome the limitations of classical transformers in large-scale environments, and shows that it is possible to combine accuracy, efficiency and real applicability. The next step is not only to improve metrics, but to integrate these capabilities into platforms that make the city smarter and the shared transport business more sustainable. The technology is ready; now it is up to engineering teams and operators to turn that potential into daily decisions.



