用开源模型把自然语言转成地图数据查询语句,更准更省资源。
OsmT: Bridging OpenStreetMap Queries and Natural Language with Open-source Tag-aware Language Models
- 引入标签增强机制,让生成的查询更符合地图数据结构。
- 在公开数据集上优于大模型,参数少却精度不降。
- 支持反向解释查询语句,方便用户理解地图数据结果。
连接自然语言与结构化查询语言是数据库领域长期挑战。现有方法多依赖大规模闭源模型,存在推理成本高、透明度低和部署难的问题。本文提出OsmT,一个开源的标签感知语言模型,专用于将自然语言转换为OverpassQL(OpenStreetMap数据的结构化查询语言)。为提升生成查询的准确性和结构合法性,我们设计了标签检索增强(TRA)机制,融入上下文相关的标签知识,捕捉OSM数据库中固有的层级与关系依赖,应对地理空间查询的拓扑复杂性。此外,我们定义了一个逆向任务:将OverpassQL转换为自然语言描述,以辅助查询理解并提升用户可访问性。在公开基准上的评估显示,尽管参数量显著减少,OsmT在查询生成与解释任务中均表现优异,证明了开源预训练模型在模式丰富的地理空间环境中有效衔接自然语言与结构化查询的潜力。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。