GeoLM: Empowering Language Models for Geospatially Grounded Language Understanding

Zekun Li, Wenxuan Zhou, Yao-Yi Chiang, Muhao Chen

Abstract

Large Language Models (LLMs) often lack a fundamental understanding of physical geography, leading to difficulties in disambiguating toponyms and reasoning about spatial relationships. We present GeoLM, a novel language model that bridges natural language processing and geospatial science. By pre-training on a combination of Wikipedia text and OpenStreetMap (OSM) coordinates, GeoLM learns to ground linguistic mentions of places in physical reality. Our evaluation shows that GeoLM significantly outperforms standard models like BERT in toponym recognition, linking, and geo-entity typing.

Introduction

Modern LLMs are proficient in linguistic context but remain effectively "placeless." For instance, a standard model may struggle to distinguish "Paris, Arkansas" from "Paris, France" without explicit textual cues. The core challenge is geospatial grounding: the ability to connect a toponym (place name mention) to its physical coordinates and spatial context.

GeoLM addresses this by treating geo-entities as "anchors" that link the world of words to the world of coordinates. It leverages massive, structured data from OpenStreetMap (OSM) to provide a sense of direction and proximity that text-only models lack.

Overview of the GeoLM pre-training framework, illustrating the integration of Wikipedia/Wikidata text with OpenStreetMap geospatial data.

Methodology

The GeoLM framework employs a multi-stage approach to integrate spatial awareness into the Transformer architecture:

1. Geospatial Input Representation

To help a language model process spatial data, geographical neighbors are converted into "pseudo-sentences." For a given city or entity, its nearest neighbors from OSM are listed in order of distance. This allows the model to process spatial proximity as a sequence, similar to how it processes a sequence of words.

2. Spatial Coordinate Embeddings

GeoLM utilizes a sinusoidal coordinate embedding mechanism (similar to positional encodings in Transformers) to capture latitude and longitude. This mathematical encoding enables the model to represent distance and direction between entities directly within the embedding space.

Detailed input representation of GeoLM, showing the concatenation of natural language tokens with geospatial tokens and their corresponding coordinate embeddings.

3. Pre-training Objectives

The model is trained using two primary losses to align different views of the same place:

  • Contrastive Learning (InfoNCE): This aligns the linguistic view (sentences from Wikipedia/Wikidata) with the geospatial view (OSM neighbors). It ensures the model learns that the "Paris" described in a history book and the "Paris" surrounded by specific Arkansas towns are the same physical anchor.
  • Masked Language Modeling (MLM): Like BERT, GeoLM is trained to predict missing words, but it does so across concatenated strings of text and geographical data, forcing it to use spatial clues to fill in linguistic gaps.

Datasets and Evaluation

GeoLM was pre-trained on a massive corpus including 693,308 geo-entities from OSM and approximately 1.45 million sentences from Wikipedia/Wikidata. Evaluation was conducted across several specialized benchmarks:

  • Toponym Recognition: GeoWebNews (identifying place names in text).
  • Toponym Linking: LGL and WikToR (disambiguating which specific place is being discussed).
  • Spatial Relation Extraction: SpatialML (e.g., "City A is inside County B").
  • Geo-entity Typing: OpenStreetMap subsets (categorizing places as hospitals, schools, etc.).

Key Results

GeoLM consistently outperformed baseline models like BERT, RoBERTa, and SpanBERT across all tested tasks:

  • Toponym Recognition: Achieved an 83.89 Entity-level F1 score on GeoWebNews, beating BERT’s 80.10.
  • Toponym Linking: On the highly ambiguous WikToR dataset, it outperformed the next best model (SapBERT) by over 6 points in distance-based accuracy (P@D20).
  • Geo-entity Typing: It reached a Micro F1 of 87.8, significantly higher than models that only look at text (BERT: 83.5) or only look at coordinates (SpaBERT: 85.2).

Discussion and Limitations

GeoLM demonstrates that geography serves as a vital context for language understanding. By linearizing the map into "pseudo-sentences," the authors found a way to feed a 2D map into a 1D language architecture without losing the essence of spatial proximity. However, some limitations remain:

  • Point Geometry: Currently, GeoLM treats every place as a single point, lacking an understanding of complex shapes like winding rivers or country borders.
  • Data Bias: Training data is heavily skewed toward Europe and North America, which could lead to performance drops in underrepresented regions.
  • Computational Intensity: Pre-training requires significant hardware (at least 24GB of VRAM).

Future work aims to extend GeoLM to handle more complex geometries and tasks like geospatial question answering.

Summary updated

BibTeX
@inproceedings{li2023geolm,
  author = {Zekun Li and Wenxuan Zhou and Yao-Yi Chiang and Muhao Chen},
  title = {{GeoLM: Empowering Language Models for Geospatially Grounded Language Understanding}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
  doi = {10.18653/v1/2023.emnlp-main.317},
}
Figure