Inspiration

Urban traffic is something almost everyone experiences, whether it's sitting at a red light when the crossing street is empty or watching an ambulance struggle through a congested intersection.

I started UrbanFlow AI with a simple question: What if traffic signals could anticipate traffic conditions instead of just reacting to them?

My original idea was to build an AI-powered traffic management system that could use intersection cameras and GPS telemetry to understand traffic flow, predict congestion, and coordinate upcoming signals. I was especially interested in how the same technology could help emergency responders, allowing an ambulance to communicate its destination so intersections along its route could prepare before it arrived.

The initial proposal explored several possibilities, including everyday traffic optimization, emergency medical response, and law enforcement coordination.

For the Nebius x NVIDIA Global AI Hackathon, I narrowed the scope to two problems: improving everyday traffic flow and reducing delays for ambulances.

The goal was to build more than an AI dashboard. I wanted a working simulation where decisions would have visible consequences for vehicles, intersections, and emergency response.

What It Does

UrbanFlow AI is an AI-assisted urban traffic orchestration system built around an interactive 3D digital twin of a city.

It combines NVIDIA Nemotron models, hosted through Nebius Token Factory, with custom traffic prediction and deterministic safety controls.

The system has several core components:

1. Adaptive Traffic Signal Optimization

NVIDIA Nemotron 3 Nano analyzes simulated traffic conditions, including vehicle queues and signal states, and recommends which intersections should adjust their signals.

A separate deterministic idle-green safeguard handles obvious wasted green phases, while a safety controller validates changes before they are applied.

2. AI-Assisted Emergency Route Planning

When an ambulance is dispatched, NVIDIA Nemotron 3 Super can evaluate multiple candidate routes using estimated travel time, congestion, distance, and turns.

This allows the system to consider more than simply choosing the geographically shortest route.

3. Predictive Green Corridor

This is the core emergency-response algorithm developed for UrbanFlow AI.

Instead of waiting for an ambulance to reach a red light, Predictive Green Corridor estimates its arrival at each upcoming intersection and determines how much time is needed to safely prepare the signal and clear queued vehicles.

Its activation window is calculated as:

$$ T_{\text{activation}} = T_{\text{switch}} + T_{\text{clear}} + T_{\text{margin}} $$

The algorithm uses the current signal state, estimated traffic clearance time, and a prediction margin to progressively prepare intersections ahead of the ambulance.

Rather than forcing an entire route green simultaneously, the system activates priority where and when it is needed, reducing unnecessary disruption to surrounding traffic.

4. Interactive 3D Traffic Digital Twin

The application features a nighttime 3D city with moving vehicles, multiple intersections, traffic signals, and hospitals.

Users can observe the system through Omniscient, Chase, and Intersection cameras, along with a live decision feed, traffic metrics, ambulance routing information, and signal-status visualizations.

5. Controlled Before-and-After Demonstration

UrbanFlow AI includes a reproducible Cross-Town Emergency scenario comparing conventional fixed-time signals against AI-assisted traffic management.

Both runs use the same traffic conditions, ambulance dispatch, and route, allowing us to compare how the signal-control strategies affect emergency travel time.

How I Built It

The project began with Eclipse SUMO and Python TraCI, where I experimented with traffic networks, collected intersection telemetry, and investigated AI-assisted signal control.

Those early experiments helped expose an important challenge: a model might generate a technically valid recommendation without necessarily making a useful or safe traffic decision.

I eventually transitioned to a custom browser-based JavaScript traffic simulation. This gave me greater control over vehicle behavior, intersection safety, visualization, and reproducible experiments.

The current system uses:

  • JavaScript: Custom traffic simulation, vehicle behavior, intersection control, emergency priority, and metrics.
  • Three.js: Interactive 3D city visualization and camera system.
  • Python: Lightweight local HTTP server for securely relaying model requests.
  • NVIDIA Nemotron 3 Nano: Ordinary traffic signal recommendations.
  • NVIDIA Nemotron 3 Super: Ambulance route selection.
  • Nebius Token Factory: Live inference infrastructure for the NVIDIA models.
  • HTML and CSS: Interactive dashboard, control panels, and analytics.

The system separates AI recommendations from safety-critical operations. Models can recommend actions, but deterministic controllers enforce safe signal transitions, intersection reservations, ambulance priority, and fallback behavior.

Challenges I Ran Into

Building realistic and safe traffic behavior

One of the biggest challenges was making the simulation behave like an interconnected traffic system rather than a set of independently moving cars.

Early versions had issues with vehicles colliding during turns, left-turn yielding, lane changes, and ambulances navigating congestion.

I addressed these through intersection reservations, vehicle-path conflict checks, improved yielding behavior, and an automated collision-testing tool.

Integrating live AI without sacrificing reliability

Early Nemotron tests exposed issues such as malformed JSON responses, recommendations that did not accurately reflect traffic conditions, and delayed model replies.

I refined the model inputs, introduced response validation, added safety checks, and implemented automatic fallback to local rules when inference becomes unavailable or too slow.

Optimizing emergency priority without unnecessarily disrupting other traffic

The original emergency corridor used a queue-adjusted activation window that often turned signals green much earlier than necessary.

Although it helped ambulances, it sometimes held several intersections under emergency priority simultaneously, creating unnecessary delays for cross traffic.

This led to the development of Predictive Green Corridor, which estimates signal-switching time, queue discharge time, and uncertainty separately.

In controlled simulations, the refined algorithm reduced emergency priority occupation while preserving comparable ambulance travel times. The experiments also demonstrated that optimizing emergency response involves tradeoffs with surrounding traffic.

Eliminating wasted green-light time

During live testing, I noticed intersections where vehicles waited at red while another road had green despite little or no traffic.

Investigation revealed that the number of intersections needing attention could exceed the number of decisions requested from Nemotron in a single response.

I introduced a deterministic idle-green safeguard to handle these clear-cut situations without depending on additional model calls.

Accomplishments I'm Proud Of

The biggest accomplishment is taking an initial idea and developing it into a working traffic-control prototype with real NVIDIA model inference, emergency priority logic, a custom simulation, and measurable results.

In our final Cross-Town Emergency comparison:

Metric Conventional Traffic UrbanFlow AI
Ambulance travel time 77 seconds 55 seconds
Time improvement Baseline 22 seconds sooner
Safety violations recorded 0 0
Vehicle throughput 139 trips/min 131 trips/min

The UrbanFlow AI run used live Nemotron 3 Nano through Nebius Token Factory, with 16 out of 16 model calls answered successfully and no fallback to local rules.

This represents approximately a 28% reduction in ambulance travel time in our simulated scenario.

Importantly, the results also show a tradeoff: vehicle throughput was slightly lower during the AI-assisted run. The project is not about claiming every metric always improves, but investigating how traffic can be coordinated around different priorities.

These results are from our custom simulation, not real-world traffic measurements.

What I Learned

This project taught me that AI reasoning alone is not enough for a system that interacts with physical infrastructure.

A model can make a recommendation, but the surrounding system must determine whether that recommendation is valid, timely, and safe.

I also learned the importance of experimental design. Comparing algorithms under identical starting conditions, retaining unsuccessful results, and distinguishing model decisions from deterministic control made it possible to understand what actually contributed to improvements.

Perhaps the most interesting lesson was that optimizing ambulance movement is not simply about giving an ambulance as many green lights as possible.

It is about predicting precisely when each intersection needs to be ready while minimizing the impact on everyone else.

That insight became the foundation of Predictive Green Corridor.

What's Next for UrbanFlow AI?

The hackathon version is a proof of concept. My longer-term goal is to explore how this approach could evolve into a more realistic and research-driven traffic management system.

Future directions include integrating real intersection camera perception, GPS-based emergency vehicle telemetry, larger traffic networks, stronger optimization baselines, and testing against independent traffic simulators or real-world datasets.

In the future, UrbanFlow AI could expand beyond ambulance response to support police vehicles, fire trucks, and other emergency services through coordinated traffic signal management, helping first responders navigate congested cities more safely and efficiently.

UrbanFlow AI began with a simple idea: traffic signals should understand what is happening around them and prepare for what comes next.

This prototype is my first step toward exploring that possibility.

Smarter traffic. Faster emergency response. Every second matters.

Built With

Share this project:

Updates

Submission history