LAMP: A Language Model on the Map

Pasquale Balsebre, Weiming Huang, Gao Cong

TL;DR

LAMP (Language Model on the Map) is a novel framework that fine-tunes Large Language Models (LLMs) on city-specific data to transform them into expert local assistants. By internalizing the "map" of a city into its weights, LAMP significantly outperforms general-purpose models like GPT-4 in retrieving local Points of Interest (POIs) and understanding spatial proximity without needing real-time web browsing.

What Problem Does This Paper Address?

While LLMs like ChatGPT are excellent at answering generic geographic questions (e.g., "What is the capital of France?"), they struggle with fine-grained, local queries (e.g., "Find a nearby Starbucks with wheelchair access").

The authors identify two main hurdles:

  1. Data Gap: Detailed city-specific information—like the exact address, opening hours, and features of every local shop—is often missing or sparse in the massive, general-purpose datasets used to train LLMs.
  2. Hallucinations: When asked for local recommendations, models often "hallucinate" non-existent businesses or provide locations that are miles away from the user, simply because they lack a granular understanding of urban spatial relationships.

Methods

The researchers propose a two-stage workflow to "inject" a city's geography into an LLM, specifically using LLaMa-2-7B-Chat as a base.

  1. Automated Data Generation: Using a Retrieval-Augmented Generation (RAG) approach, they use a "teacher" model to generate synthetic conversational data. They provide the teacher with structured ground-truth POI data (from Yelp) and a synthetic user query. The teacher generates a high-quality response.
  2. Fine-Tuning for Memorization: The LAMP model is then fine-tuned to predict these responses. Crucially, during training, LAMP is not given the structured POI data—only the user's position (converted to an address via reverse geocoding) and the query. This forces the model to memorize the POIs and their spatial relationships within its internal parameters.
  3. Mitigating Hallucinations: To prevent the model from always assuming a POI exists nearby, the authors included "negative" samples in the training set—queries from random positions about random categories—teaching the model to admit when a nearby option isn't available.

The training utilized 4-bit quantization and Low-Rank Adaptation (LoRA) to keep the process computationally efficient, requiring about 78 hours on a single A100 GPU.

Figure 1: The proposed framework: left hand side shows the Data Generation process, while the right hand side illustrates the strategy adopted to train LAMP.

Datasets

  • POI Data: 18,390 Points of Interest collected from Yelp Singapore, including names, addresses, opening hours, price ranges, and ratings.
  • Training Set: A newly generated dataset of 113,000 conversational interactions based on the Singapore POI data.
  • Evaluation Set: 50 complex queries designed by GIS (Geographic Information Systems) experts to test truthfulness, spatial awareness, and semantic relevance.

Key Insights and Ideas

  • Internalizing the Map: Unlike standard RAG systems that query a database at runtime, LAMP shows that an LLM can effectively "memorize" a city's layout. This results in faster responses and potentially better privacy, as the model doesn't need to send coordinates to an external search engine.
  • Spatial Awareness vs. Coordinates: By training on thousands of different user positions, the model learns the "feel" of a city—which streets are near which districts—rather than just treating locations as abstract latitude/longitude points.
  • The Importance of "No": The authors found that if a model is only trained on successful searches, it becomes "over-eager" and hallucinates. Including queries that cannot be satisfied is essential for a reliable AI assistant.

Key Results

LAMP was compared against heavyweights like GPT-4 (with browsing) and Claude-3.

  • Spatial Awareness: LAMP achieved a score of 92%, significantly higher than GPT-4o (84%) and ChatGPT-3.5 (60%). This indicates LAMP is much better at suggesting the closest relevant POI.
  • Truthfulness: LAMP scored 86%. While GPT-4 with browsing scored slightly higher (94%), LAMP achieved its score entirely through internal knowledge, whereas GPT-4 relied on live web searches.
  • Complex Planning: In a case study for "day planning" (e.g., gym -> store -> bar), LAMP suggested a realistic walking route. In contrast, GPT-4o suggested a non-existent convenience store and a bar nearly 5km away.
Figure 3: The POIs recommended by LAMP, in response to the query in Listing 2.

Limitations and Future Work

  • Dynamic Data: Because the knowledge is baked into the model's weights, LAMP may become outdated as businesses open or close. The authors suggest that future work could explore hybrid models that combine this internalized knowledge with periodic updates.
  • Scalability: While the framework is general, fine-tuning a separate model (or adapter) for every major city in the world would be a significant undertaking.
  • Geographic Scope: The current study is limited to Singapore. Testing the model's performance in cities with very different layouts (e.g., sprawling suburban areas vs. dense European old towns) remains an open question.

Summary updated

BibTeX
@misc{balsebre2024lamp,
  author = {Pasquale Balsebre and Weiming Huang and Gao Cong},
  title = {{LAMP: A Language Model on the Map}},
  year = {2024},
  eprint = {2403.09059},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.09059},
}
Figure