Table of Contents
Fetching ...

OsmT: Bridging OpenStreetMap Queries and Natural Language with Open-source Tag-aware Language Models

Zhuoyue Wan, Wentao Hu, Chen Jason Zhang, Yuanfeng Song, Shuaimin Li, Ruiqiang Xiao, Xiao-Yong Wei, Raymond Chi-Wing Wong

TL;DR

OsmT addresses the challenge of bridging natural language with a complex geospatial query language (OverpassQL) for OpenStreetMap data by introducing a tag-aware open-source LM and a Tag Retrieval Augmentation (TRA) mechanism. The authors design a cross-modal pretraining regime that fuses natural language, OSM tag semantics, and OverpassQL, plus a bidirectional Text-to-OverpassQL and OverpassQL-to-Text setup. Key contributions include a comprehensive pre-training corpus, a hybrid MLM+Bidirectional Translation objective, a tag knowledge base with embedding-based retrieval, and thorough ablations demonstrating TRA and pretraining are essential for performance. Empirical results show OsmT achieves state-of-the-art or competitive performance on both forward and reverse tasks with a relatively small parameter footprint, and generalizes to other geo-datasets, highlighting practical impact for open, scalable geospatial querying tools.

Abstract

Bridging natural language and structured query languages is a long-standing challenge in the database community. While recent advances in language models have shown promise in this direction, existing solutions often rely on large-scale closed-source models that suffer from high inference costs, limited transparency, and lack of adaptability for lightweight deployment. In this paper, we present OsmT, an open-source tag-aware language model specifically designed to bridge natural language and Overpass Query Language (OverpassQL), a structured query language for accessing large-scale OpenStreetMap (OSM) data. To enhance the accuracy and structural validity of generated queries, we introduce a Tag Retrieval Augmentation (TRA) mechanism that incorporates contextually relevant tag knowledge into the generation process. This mechanism is designed to capture the hierarchical and relational dependencies present in the OSM database, addressing the topological complexity inherent in geospatial query formulation. In addition, we define a reverse task, OverpassQL-to-Text, which translates structured queries into natural language explanations to support query interpretation and improve user accessibility. We evaluate OsmT on a public benchmark against strong baselines and observe consistent improvements in both query generation and interpretation. Despite using significantly fewer parameters, our model achieves competitive accuracy, demonstrating the effectiveness of open-source pre-trained language models in bridging natural language and structured query languages within schema-rich geospatial environments.

OsmT: Bridging OpenStreetMap Queries and Natural Language with Open-source Tag-aware Language Models

TL;DR

OsmT addresses the challenge of bridging natural language with a complex geospatial query language (OverpassQL) for OpenStreetMap data by introducing a tag-aware open-source LM and a Tag Retrieval Augmentation (TRA) mechanism. The authors design a cross-modal pretraining regime that fuses natural language, OSM tag semantics, and OverpassQL, plus a bidirectional Text-to-OverpassQL and OverpassQL-to-Text setup. Key contributions include a comprehensive pre-training corpus, a hybrid MLM+Bidirectional Translation objective, a tag knowledge base with embedding-based retrieval, and thorough ablations demonstrating TRA and pretraining are essential for performance. Empirical results show OsmT achieves state-of-the-art or competitive performance on both forward and reverse tasks with a relatively small parameter footprint, and generalizes to other geo-datasets, highlighting practical impact for open, scalable geospatial querying tools.

Abstract

Bridging natural language and structured query languages is a long-standing challenge in the database community. While recent advances in language models have shown promise in this direction, existing solutions often rely on large-scale closed-source models that suffer from high inference costs, limited transparency, and lack of adaptability for lightweight deployment. In this paper, we present OsmT, an open-source tag-aware language model specifically designed to bridge natural language and Overpass Query Language (OverpassQL), a structured query language for accessing large-scale OpenStreetMap (OSM) data. To enhance the accuracy and structural validity of generated queries, we introduce a Tag Retrieval Augmentation (TRA) mechanism that incorporates contextually relevant tag knowledge into the generation process. This mechanism is designed to capture the hierarchical and relational dependencies present in the OSM database, addressing the topological complexity inherent in geospatial query formulation. In addition, we define a reverse task, OverpassQL-to-Text, which translates structured queries into natural language explanations to support query interpretation and improve user accessibility. We evaluate OsmT on a public benchmark against strong baselines and observe consistent improvements in both query generation and interpretation. Despite using significantly fewer parameters, our model achieves competitive accuracy, demonstrating the effectiveness of open-source pre-trained language models in bridging natural language and structured query languages within schema-rich geospatial environments.

Paper Structure

This paper contains 36 sections, 9 equations, 5 figures, 10 tables, 2 algorithms.

Figures (5)

  • Figure 1: Model performance vs. parameter size (log scale). Comparison of OsmT with state-of-the-art open-source and closed-source models on the Text-to-OverpassQL task. Average performance is over five metrics.
  • Figure 2: Overview of the Text-to-OverpassQL and OverpassQL-to-Text tasks. Illustration of the bidirectional translation between natural language and OverpassQL, along with the corresponding query execution output and the visualization of retrieved entities on the map.
  • Figure 3: Overview of the OsmT framework, which includes (I) pre-training corpus collection andconstruction, (II) hybrid pre-training with MLM and BT objectives, (III) supervised fine-tuning, and (IV) tag retrieval augmentation.
  • Figure 4: Model comparison and qualitative analysis. (a) Average metric improvements from TRA across baselines. (b) OQS scores under different difficulty levels. (c) Example case showing accurate OverpassQL generation by OsmT.
  • Figure 5: Ablation study on TRA: comparison of embedding models (sBERT vs. SimCSE-sBERT) across different Top-$k$ settings, evaluated by Exact Match Accuracy and F1 Score.