Inspiration
Urban traffic congestion costs global economies hundreds of billions of dollars annually in wasted fuel, lost productivity, and increased emissions. While modern generative AI has advanced rapidly, large language models (LLMs) notoriously struggle with spatial reasoning—they hallucinate non-existent highway links, fabricate impossible geographical coordinates, and invent travel times.
We asked ourselves: Can we combine the mathematical precision of classical search algorithms with the natural-language intelligence and tactical reasoning of NVIDIA Nemotron?
That vision led to TrafficMind AI: an autonomous, explainable traffic flow management system that unites classical state-space search algorithms (BFS, DFS, Dijkstra, and A*) with NVIDIA Nemotron via Nebius Token Factory to deliver zero-hallucination, real-time traffic decision support.
What it does
TrafficMind AI acts as an autonomous traffic control co-pilot for urban planners and traffic operators:
- Intelligent Traffic Assistant: Understands natural-language queries (e.g., "Which junction currently has the highest congestion?", "Find the optimal route from Chennai to Tirunelveli", or "What happens if Junction 5 becomes unavailable?").
- Zero-Hallucination Routing: Rather than guessing routes, the system runs classical graph algorithms (A* with Euclidean heuristics, Dijkstra, BFS, and DFS) to find verified optimal routes and combinatorial alternatives.
- NVIDIA Nemotron Tactical Synthesis: Takes verified mathematical calculations and feeds them to NVIDIA Nemotron hosted on Nebius Token Factory to generate actionable traffic engineering explanations, corridor delay diagnostics, and detour directives.
- AI-Based Incident Simulation & Diversion: Simulates real-time collisions, road closures, and junction breakdowns. It instantly computes optimal bypass trajectories and explains diversion plans with quantified delay impacts.
- Real-Time Digital Twin Maps: Integrates real-time satellite/traffic map layers (Leaflet) and SVG metropolitan topologies with vehicle particle flows and bottleneck KPIs.
How we built it
TrafficMind AI is designed with a strict separation of concerns across 4 architectural layers:
- Classical AI & Pathfinding Engine: Built in modern JavaScript, implementing:
- A* Search: Guided by the admissible Euclidean speed heuristic: $$f(n) = g(n) + h(n) \quad \text{where} \quad h(n) = \frac{\text{dist}(n, \text{goal})}{v_{\max}} \times 60$$
- Dijkstra's Algorithm: Min-Priority Queue optimizing dynamic congestion-weighted travel times.
- BFS & DFS: Baseline state-space frontier exploration.
- Combinatorial $K$-Paths Discovery: Enumerating alternative simple paths.
- Goal-Based Intelligent Agent (PEAS Architecture): Implements an autonomous 5-stage lifecycle: $$\text{Perceive} \longrightarrow \text{Analyze} \longrightarrow \text{Decide} \longrightarrow \text{Act} \longrightarrow \text{Explain}$$
- Dedicated Backend AI Service (Node.js & Express): Securely isolates credentials on the server side and proxies requests to Nebius Token Factory.
- NVIDIA Nemotron via Nebius Token Factory: Integrates
nvidia/llama-3.1-nemotron-70b-instructthrough Nebius's OpenAI-compatible inference endpoint for deep contextual traffic reasoning. - Frontend Dashboard (React 18 & Vite): Modern responsive interface featuring the AI Traffic Assistant chat, Traffic Intelligence KPIs, AI Recommendation Panel, and Incident Analysis modal.
Challenges we ran into
- Preventing LLM Hallucinations: Early iterations saw LLMs suggesting nonexistent roads or calculating incorrect travel times. We solved this by creating a Strict Grounding Pipeline: the reasoning engine runs the exact graph algorithms first and passes the ground-truth mathematical metrics into Nemotron's structured prompt.
- Server-Side Credential Security: Keeping the Nebius Token Factory API key strictly hidden from client-side browser code required implementing a dedicated backend proxy service with automatic fallback resilience.
- Dynamic Map Viewport Rendering: Overcoming Leaflet canvas resizing bugs inside CSS grid cards by engineering an automatic
MapInvalidatorhook to ensure 100% full-bleed tile rendering.
Accomplishments that we're proud of
- 100% Zero-Hallucination Verification: Verified across 9 classical search tests and 8 end-to-end AI reasoning scenarios with automated test runners (
testRunner.jsandtestAiRunner.js). - Sub-Second Heuristic Execution: Reachability across the entire 118-city Tamil Nadu highway graph computed in under 3 ms.
- Production-Grade Nebius Integration: Real-time communication with NVIDIA Nemotron on Nebius Token Factory with graceful offline fallback.
- One-Click Live Map Actionability: Users can ask the AI assistant for an optimal bypass and click "Apply to Live Map" to instantly synchronize the route and navigation telemetry.
What we learned
- How to combine foundational classical AI (search algorithms from Russell & Norvig) with cutting-edge open-weights LLMs like NVIDIA Nemotron.
- Leveraging Nebius Token Factory's low-latency inference for real-time agentic decision support.
- Designing multi-modal transportation dashboards combining spatial map tiles, SVG animations, and streaming AI explanations.
What's next for TrafficMind AI
- Connected Autonomous Vehicle (V2X) Telemetry: Ingesting live connected vehicle sensor feeds via MQTT/WebSockets.
- Reinforcement Learning Signal Control: Combining Nemotron macro-corridor diversion advice with micro-level adaptive traffic light timing.
- Multi-City Nationwide Expansion: Scaling graph networks to national highway systems with multi-modal rail and freight integration.
Built With
- a-star-algorithm
- artificial-intelligence
- autonomous-agents
- dijkstra-algorithm
- express.js
- google-maps
- graph-algorithms
- javascript
- leaflet.js
- nebius
- nebius-token-factory
- node.js
- nvidia
- nvidia-nemotron
- openstreetmap
- react
- recharts
- rest-api
- vite