Semantic Routing via Autoregressive Modeling

Eric Zhao, Pranjal Awasthi, Zhengdao Chen, Sreenivas Gollapudi, Daniel DellingNeurIPS 2024

Modern navigation requires more than just finding the shortest path between point A and point B. Users increasingly rely on complex "semantic routing"—requests like "find a coffee shop on my way to work and avoid highways." While traditional shortest-path algorithms struggle with these multi-objective queries, this paper introduces a massive new open-source benchmark for the problem and demonstrates a novel solution. By treating routing like language generation—using an autoregressive transformer to predict the "next edge" of a journey—graph learning can successfully scale to massive, real-world city networks.

The Challenge of Semantic Routing

Classically, route planning is treated as a straightforward graph theory problem: minimize travel time or distance using algorithms like Dijkstra's. However, modern navigation systems like Google Maps must handle context-heavy requests expressed in natural language, such as "plan a kid-friendly day trip under 20 minutes away" or "stop at a bakery, but avoid highways."

Currently, industry routing systems handle these requests using ad-hoc, handcrafted combinatorial algorithms. For example, they might use "cost modifiers" that artificially inflate the mathematical "length" of a highway if a user wants to avoid them. This approach is unscalable, difficult to maintain, and fails to fully utilize the rich metadata embedded in modern maps, such as live road conditions or specific store inventories. While machine learning on graphs seems like a natural fix, real-world road networks are simply too massive (often containing tens of thousands of nodes) for standard Graph Neural Networks (GNNs) to process efficiently.

A Language-Inspired Methodology

To overcome these limitations, the authors propose a learning-based approach that reframes semantic routing as a sequence generation problem, drawing heavy inspiration from Large Language Models (LLMs).

Instead of trying to predict an entire route at once or feeding a massive city graph into a neural network, they utilize an autoregressive transformer. Just as an LLM unrolls a sentence by predicting the next word, this model unrolls a route by predicting the next edge (road segment).

To solve the scaling problem inherent in massive city graphs, they introduce the concept of a receptive field. At each step, the model is only fed a small local neighborhood of the road network (e.g., 500 edges around the current location) rather than the entire city graph. The model generates multiple candidate paths using beam search, and a secondary scoring model selects the final optimal route. This reduces the memory footprint by a factor of over 2,000, making graph learning computationally viable on city-scale maps.

A Massive New Benchmark

To spur research in this area, the authors are releasing a large-scale, publicly licensed benchmark specifically designed for semantic routing:

  • Real-World Maps: Built on OpenStreetMap data for 23 US cities, comprising 375,000 miles of roads and 1.3 million Points of Interest (POIs).
  • Query Dataset: Over 1 million natural language queries generated via human labeling and LLM augmentation.
  • Training Data: 3 million problem-route pairs, where the ground-truth routes were solved using expensive, brute-force classical algorithms.
  • Grid-World Test Bed: A synthetic 30x30 grid environment with artificial POIs used for ablation studies and fast testing.

Key Results and Insights

The sequence-generation paradigm of autoregressive models maps surprisingly well to navigating a physical graph. The results highlight a stark contrast between classical methods and the proposed learning-based approach:

  • Classical Algorithms Hit a Wall: When tested on complex waypoint routing tasks, traditional methods (like cost modifiers or electrical flow algorithms) completely failed, achieving a near 0% to 1.3% success rate.
  • Transformer Success: The proof-of-concept autoregressive model achieved a 92% success rate on errand-based waypoint routing (e.g., "buy a water bottle"), 68% on trip planning, and 34% on highly complex mixed-constraint tasks.
  • High Efficiency: For successfully completed tasks, the model's routes were nearly perfect, incurring a median excess travel time penalty of just 0.8 seconds compared to the absolute optimal route.
  • Zero-Shot Generalization: Impressively, the model achieved these results on a completely held-out city (Berkeley, CA) and on natural language queries it had never seen during training.

Limitations and Future Work

While promising, the autoregressive approach has room for improvement:

  • Long Trips: The current model struggles with very long routes (the benchmark caps tasks at 600 road segments). Because highway driving creates long sequences of "uninteresting" go-straight steps, the training signal becomes sparse. Integrating hierarchical methods (like contraction hierarchies) could help abstract long stretches of road.
  • Architecture Enhancements: The proof-of-concept model uses a standard transformer that simply concatenates edge data. Future iterations could utilize Graph Neural Networks (GNNs) or Graph Transformers to better encode the actual topology of the receptive field and integrate richer metadata.
  • Inference Speed: While memory-efficient, autoregressive decoding is computationally heavy, with cubic time complexity relative to path length. Adopting modern, efficient attention mechanisms like FlashAttention will be necessary to achieve production-level latency.

Summary updated

BibTeX
@inproceedings{zhao2024semantic,
  author = {Eric Zhao and Pranjal Awasthi and Zhengdao Chen and Sreenivas Gollapudi and Daniel Delling},
  title = {{Semantic Routing via Autoregressive Modeling}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=JvlrUFJMbI},
}
Figure