UrbanRAG is a spatially-enhanced Retrieval-Augmented Generation (RAG) framework for recommending urban itineraries. It integrates Large Language Models (LLMs) with spatial reasoning and geographic data to support exploratory itinerary and urban discovery through a conversational interface.
This project is associated with the paper:
Spatial RAG for Big DataβDriven Urban Itinerary Recommendation
Maddalena Amendola*, Chiara Pugliese*, Raffaele Perego, Chiara Renso
*Both authors contributed equally to this research.
UrbanRAG helps users explore cities by generating personalized routes that prioritize:
- Domain-specific spatial indicators (e.g., sidewalks, air quality, greenery, accessibility)
- User preferences (e.g., types of POIs or route aesthetics)
- Contextual information (e.g., fun facts, history, or details about places encountered along the route)
The system combines three main components:
- QUAG: Query understanding and answer generation via an LLM (Llama 3.1 8B)
- Spatial Component: Computes routes and scores them based on domain-specific spatial indicators
- IR Component: Retrieves relevant context passages using a dense vector index (FAISS + Snowflake bi-encoder)
- Natural language queries for both routes and urban information
- Multi-criteria assessment using OpenStreetMap and environmental data
- Retrieval-augmented generation to mitigate hallucinations and improve accuracy
- Custom dataset for evaluating spatial and information-seeking queries
main.pyβ sets up and runs the interactive UrbanRAG systemQUAG.pyβ LLM-based query classification and generationsrc/spatial_component/β Route generation, itinerary scoring, and POI enrichmentsrc/RAG_system/β Dense passage indexing and neural searchdataset/β UrbanRAG evaluation dataset (10 route queries + 30 follow-ups)output/β UrbanRAG outputs
| Query Type | Metric | UrbanRAG | LLM-Only |
|---|---|---|---|
| Spatial Queries | Fully Correct | 4 / 10 | 0 / 10 |
| Partially Corr | 6 / 10 | 0 / 10 | |
| Info Queries | Fully Correct | 20 / 30 | 12 / 30 |
| Partially Corr | 5 / 30 | 11 / 30 |
UrbanRAG clearly outperforms closed-book LLMs in both spatial understanding and factual accuracy.