This repository contains the official implementation of:
MapAgent: An Industrial-Grade Agentic Framework for City-scale Lane-level Map Generation
MapAgent is an agentic refinement framework built on top of a frozen BEV (Bird's Eye View) vectorization backbone. It introduces a bounded JudgeβPlannerβWorker loop to verify mapping specifications and perform deterministic, tool-grounded edits for lane-level map refinement in autonomous driving systems.
- π― Vision-Language Judge Agent for automated quality assessment of lane predictions
- π Bounded Refinement Loop with deterministic worker tools
- π Industrial-Grade design for city-scale deployment
- π§ GRPO-based reinforcement learning for model optimization
- π Comprehensive error taxonomy and structured reasoning
./
βββ data_example/ # Training data and examples
β βββ dataset/
β β βββ map_agent_dataset.jsonl
β β βββ images/ # Lane prediction visualization
β βββ prompt/
β βββ train_example.txt
βββ EasyR1/ # GRPO reinforcement learning
β βββ generate_grpo_data.py
β βββ grpo_config.yaml
β βββ grpo.sh
β βββ format_prompt/
β β βββ map.jinja
β βββ reward/
β βββ map_reward.py
βββ LlamaFactory/ # Model training configurations
βββ inference/
β βββ infer_qwen_lora_sft.yaml
βββ merge/
β βββ merge_qwen_lora_sft.yaml
βββ train/
βββ train_qwen_lora_sft.yaml
Contains training datasets and prompt examples for the vision-language judge agent.
-
Dataset Structure:
map_agent_dataset.jsonl: Annotated lane prediction examples with error labelsimages/: Visualization of predicted lane lines overlaid on road imagesprompt/train_example.txt: Complete prompt template with reasoning examples
-
Error Taxonomy:
extra_lane_line: Predicted line on non-existent markingscategory_error: Incorrect lane category classificationgeometry_error: Local geometric defects (kinks, spikes)structure_error: Major structural failures (wrong direction, large deviations)no_error: Correct prediction
-
Ground Truth Categories:
1: Long dashed line 6: Short dashed line 2: Double solid line 7: Double dashed line 3: Single solid line 9: Virtual line 4: Dashed-solid line 10: Stop line 5: Solid-dashed line
Group Relative Policy Optimization (GRPO) for reinforcement learning-based model refinement.
-
Core Scripts:
generate_grpo_data.py: Generate training pairs for GRPOgrpo.sh: Training pipeline execution scriptgrpo_config.yaml: Hyperparameters and training configuration
-
Components:
format_prompt/map.jinja: Jinja2 template for prompt formattingreward/map_reward.py: Reward function for RL training
-
Purpose: Fine-tune the judge agent to improve error detection accuracy through reinforcement learning.
Configuration files for supervised fine-tuning (SFT) and model deployment using LLaMA-Factory.
-
Training (
train/):train_qwen_lora_sft.yaml: LoRA-based SFT configuration for Qwen models
-
Inference (
inference/):infer_qwen_lora_sft.yaml: Inference configuration with LoRA adapters
-
Merge (
merge/):merge_qwen_lora_sft.yaml: Configuration for merging LoRA weights into base model
-
Supported Models: Qwen-VL, Qwen2-VL with LoRA parameter-efficient fine-tuning
# Clone the repository
git clone https://github.com/eadst/KDD-2026-MapAgent.git
# Using LlamaFactory
cd LlamaFactory/train
llamafactory-cli train train_qwen_lora_sft.yaml# Generate GRPO training data
cd EasyR1
python generate_grpo_data.py
# Run GRPO training
bash grpo.sh# Inference with trained model
cd LlamaFactory/inference
llamafactory-cli chat infer_qwen_lora_sft.yaml# Merge LoRA weights into base model
cd LlamaFactory/merge
llamafactory-cli export merge_qwen_lora_sft.yamlThe training data follows a structured format:
{
"image": "path/to/image.png",
"predicted_category": "double_solid_line",
"bounding_box": [0.0, 1473.0, 1536.0, 11.0],
"reasoning": "<think>Analysis process...</think>",
"error_type": "no_error",
"gt_category_id": 2
}# Example: Evaluate a lane prediction
from mapagent import JudgeAgent
# Initialize judge agent
judge = JudgeAgent(model_path="path/to/model")
# Evaluate prediction
result = judge.evaluate(
image_path="data_example/dataset/images/557_5950_pred.png",
predicted_category="double_solid_line",
bounding_box=[0.0, 1473.0, 1536.0, 11.0]
)
print(f"Error Type: {result['error_type']}")
print(f"Reasoning: {result['reasoning']}")
print(f"GT Category: {result['gt_category_id']}")The judge agent follows a strict priority-based evaluation:
- Priority Order:
extra_lane_lineβcategory_errorβgeometry_errorβstructure_errorβno_error - Short-Circuit Logic: Stop evaluation once an error is confirmed
- Visual Decoding Strategy: Distinguish between prediction mask (hypothesis) and road texture (fact)
- Structured Reasoning: Output reasoning process within
<think>tags
# grpo_config.yaml
model_name: Qwen2-VL-7B-Instruct
learning_rate: 5.0e-6
num_train_epochs: 2
per_device_train_batch_size: 2
reward_model: map_reward# train_qwen_lora_sft.yaml
model_name_or_path: Qwen/Qwen2-VL-7B-Instruct
lora_rank: 8
lora_alpha: 16
lora_dropout: 0.05
learning_rate: 5.0e-5If you find this work useful, please cite our paper:
@article{mapagent2025,
title={MapAgent: An Industrial-Grade Agentic Framework for City-scale Lane-level Map Generation},
author={Author Names},
journal={Conference/Journal Name},
year={2026}
}This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- LLaMA-Factory for training infrastructure
- Qwen-VL for vision-language foundation models
- EasyR1 framework for GRPO implementation
For questions and discussions, please open an issue:
- Project Page: https://github.com/eadst/KDD-2026-MapAgent
Current Version: v0.1.0 (Initial Release)
- β Data examples and prompt templates
- β GRPO training pipeline
- β LlamaFactory configurations
- π§ Full pipeline integration (coming soon)
- π§ Pre-trained model weights (coming soon)
- π§ Evaluation scripts (coming soon)
- Release pre-trained judge agent weights
- Add full pipeline integration code
- Provide evaluation benchmarks
- Add worker tools implementation
- Release technical report
- Add interactive demo
Last Updated: February 17, 2026