MobQA: A Benchmark Dataset for Semantic Understanding of Human Mobility Data through Question Answering
Hikaru Asano1 ย Hiroki Ouchi2,3 ย Akira Kasuga3 ย Ryo Yonetani3
1The University of Tokyo ย 2Nara Institute of Science and Technology ย 3CyberAgent
This repository provides tools and data for building a mobility question answering dataset. The dataset combines trajectory data with question-answer pairs covering factual retrieval, multiple choice, and free-form questions about mobility patterns and behaviors.
- macOS: This project has been tested and confirmed to work on macOS
- uv: Required for Python package management and environment setup
- OpenAI API: Required when using OpenAI models
- Google Cloud Platform (GCP): Required when using Gemini models
First, install dependencies and set up your environment:
# Install dependencies
uv syncConfigure your environment by creating a .env file with your API keys and project settings.
-
Copy the example file:
cp .env.example .env
-
Open
.envin your editor and replace the placeholder values with your actual credentials. Example.envcontent:OPENAI_API_KEY=sk-your_actual_api_key_here # The following GCP settings are only required if you plan to use Google Gemini models. GCP_PROJECT=your-gcp-project-id GCP_LOCATION=your-gcp-region
Required Environment Variables:
OPENAI_API_KEY: Your OpenAI API keyGCP_PROJECT: Google Cloud Platform project IDGCP_LOCATION: GCP region (e.g.,us-central1,asia-northeast1)
Before building the dataset, you need to download the GeoLife dataset:
- ๐ฅ Download: Visit Microsoft Research GeoLife and download the GPS trajectory dataset
- ๐ Extract and Place: Extract the downloaded archive and place the contents in
data/geolife/ - โ Verify: Ensure the directory structure matches the expected format below
Expected directory structure after setup:
data/
โโโ geolife/
โโโ Data/
โโโ 000/
โ โโโ Trajectory/
โ โโโ 20081023025304.plt
โ โโโ ...
โโโ 001/
โโโ 002/
โโโ ... (up to 181)
To build the complete dataset, run the following command:
# Build the complete Mobility QA dataset
bash scripts/build_dataset.shThe script will automatically execute the preprocessing pipeline and generate the final dataset in the mobility_qa_dataset/ directory.
For detailed information about each preprocessing step, see src/mobility_qa/preprocess/README.md.
The final dataset is organized as follows:
mobility_qa_dataset/
โโโ factual_retrieval/
โ โโโ one_day/ # ๐
Single-day factual retrieval questions
โ โ โโโ place_to_time/ # ๐ "When was the person at location X?"
โ โ โ โโโ 1/qa.json
โ โ โ โโโ 2/qa.json
โ โ โ โโโ ...
โ โ โโโ ... (other question types)
โ โโโ weekly/ # ๐ Weekly pattern questions
โโโ free_form/
โ โโโ one_day/ # ๐ญ Single-day open-ended questions
โ โโโ weekly/ # ๐ Weekly analysis questions
โโโ multiple_choice/
โโโ one_day/ # โ
Single-day multiple choice questions
โโโ weekly/ # ๐ Weekly multiple choice questions
Each QA file contains:
- โ Question text
- ๐ท๏ธ Question type and metadata
- โ Ground truth answers
- ๐ฃ๏ธ Integrated trajectory data (filtered and normalized)
- ๐ค User ID and original day information
The repository includes three completion scripts for generating answers using large language models.
- ๐ Factual Retrieval:
scripts/fact_retrieval.py- Extract specific facts from trajectory data - โ
Multiple Choice:
scripts/multi_choice.py- Answer multiple-choice questions about mobility patterns - ๐ญ Free Form:
scripts/free_form.py- Generate open-ended responses with automatic evaluation
Run each script with default settings (no annotations, 10 questions per script):
# Run factual retrieval (extracts specific facts)
uv run scripts/fact_retrieval.py
# Run multiple choice (selects from given options)
uv run scripts/multi_choice.py
# Run free form (generates open-ended answers)
uv run scripts/free_form.py# Specify model and parameters
uv run scripts/fact_retrieval.py \
--model_name gpt-4o \
--temperature 0.5 \
--num_questions 20
# Include all annotation types (mobility_mode, poi, reason)
uv run scripts/multi_choice.py \
--with_annotation
# Run free form with evaluation model
uv run scripts/free_form.py \
--model_name gpt-4o-mini \
--evaluation_model_name gpt-4o \
--with_annotation| Parameter | Type | Default | Description |
|---|---|---|---|
--model_name |
str | gpt-4o-mini |
๐ค LLM model name to use |
--temperature |
float | 0.0 |
๐ก๏ธ Temperature for generation (0.0-1.0) |
--num_questions |
int | 10 |
๐ข Number of questions to process |
--with_annotation |
flag | False |
๐ Include all annotation types (mobility_mode, poi, reason) |
--evaluation_model_name |
str | gpt-4o |
๐ฏ Model for evaluation (free_form only) |
--max_retries |
int | 5 |
๐ Maximum number of retries for failed requests |
--initial_wait_time |
int | 30 |
โฐ Initial wait time for retries (seconds) |
--seed |
int | 42 |
๐ฒ Random seed for reproducibility |
| Mode | Description | Trajectory Format | Use Case |
|---|---|---|---|
| Default (no flag) | ๐ถ Basic trajectory only | [day, time, x, y] |
Quick testing, basic analysis |
--with_annotation |
๐ All annotations included | [day, time, x, y, mobility_mode, poi, reason] |
Comprehensive analysis, research |
# Basic usage with default settings (no annotations, 10 questions)
uv run scripts/fact_retrieval.py
# Process more questions with a different model
uv run scripts/multi_choice.py \
--model_name gpt-4 \
--num_questions 50
# Include all annotations for comprehensive analysis
uv run scripts/free_form.py \
--with_annotation \
--temperature 0.3
# Large-scale evaluation with custom retry settings
uv run scripts/fact_retrieval.py \
--with_annotation \
--model_name gpt-4 \
--num_questions 100 \
--max_retries 10 \
--initial_wait_time 60 \
--seed 123
# Reproducible experiments with specific seed
uv run scripts/multi_choice.py \
--model_name gpt-4 \
--seed 12345{
"question": "When was the person at (10.54, 3.78)?",
"question_type": "place_to_time",
"original_days": [6],
"user_id": 115,
"answer": ["01:30"],
"trajectory": [
["day", "time", "x", "y"],
[1, "02:19:16", -0.15, 0.4],
[1, "02:20:01", -0.17, 0.33],
...
]
}The trajectory data in each QA file follows a consistent format with different annotation levels:
Used in factual_retrieval and multiple_choice datasets:
[
["day", "time", "x", "y"],
[1, "00:00:00", -0.05, -3.52],
[1, "00:01:00", -0.04, -3.78],
...
]- day: Normalized day number (starts from 1)
- time: Time in HH:MM:SS format
- x, y: Normalized spatial coordinates in kilometers, relative to a reference point, with precision up to two decimal places.
Used in free_form dataset with additional annotations in Japanese:
[
["day", "time", "x", "y", "mobility_mode", "reason", "poi"],
[1, "00:00:00", -0.05, -3.52, "ใใน", "่ทๅ ดใธใฎ็งปๅ", "้ๅค้ไธญใฎใในๅ"],
[1, "00:01:00", -0.04, -3.78, "ใใน", "่ทๅ ดใธใฎ็งปๅ", NaN],
...
]- mobility_mode: Transportation mode (e.g., "ใใน", "ๅพๆญฉ", "่ป")
- reason: Purpose of movement (e.g., "่ทๅ ดใธใฎ็งปๅ", "ไฝๆ", "่ฒทใ็ฉ")
- poi: Point of interest category (e.g., "่ชๅฎ ", "ใชใใฃใน", "ใฌในใใฉใณ")
- Day numbers are normalized to start from 1 based on
original_daysfield - Spatial coordinates (x, y) are normalized and may not represent actual GPS coordinates
- Time format is consistent across all trajectory points
This dataset is built upon the GeoLife GPS Trajectory Dataset. We have processed and transformed the original GeoLife data to create question-answer pairs for mobility analysis tasks, including additional semantic annotations.
If you use this dataset, please cite the original GeoLife papers
@inproceedings{zheng2010geolife,
title={GeoLife: A collaborative social networking service among user, location and trajectory},
author={Zheng, Yu and Xie, Xing and Ma, Wei-Ying},
booktitle={IEEE Data Eng. Bull.},
volume={33},
number={2},
pages={32--39},
year={2010}
}This project is licensed under the MIT License.
@article{asano2025mobqa,
title = "{MobQA}: A benchmark dataset for semantic understanding of
human mobility data through question answering",
author = "Hikaru, Asano and Hiroki, Ouchi and Akira, Kasuga and Ryo,
Yonetani",
journal = "arXiv preprint arXiv:2508.11163",
year = 2025,
}