Abstract
Accurate traffic accident classification is vital for urban safety planning, yet real-world police reports often suffer from misclassification and over-reliance on "miscellaneous" categories. This study investigates the application of Natural Language Processing (NLP) techniques to a dataset of over 100,000 traffic accidents in Munich, Germany. By employing semantic clustering (BERTopic), few-shot prompting with Large Language Models (Gemma-2-27B), and supervised transformer models (XLM-RoBERTa), we demonstrate that unstructured text descriptions are significantly more predictive of accident types than traditional tabular data. Our findings reveal that nearly half of the incidents labeled as "Other" were actually misclassified parking accidents. The best-performing multimodal model achieved 73% accuracy, highlighting the potential for NLP-driven tools to assist law enforcement in real-time data entry.
1. Introduction
In the domain of urban planning, data quality directly influences policy efficacy. To improve road safety, city officials rely on police-recorded accident data to identify high-risk areas and behavioral patterns. In Munich, police categorize accidents into seven distinct types (A1–A7). However, the utility of this data is frequently compromised by the "A7" category—a "catch-all" label for "Other Accidents." When a significant portion of data falls into a non-descriptive category, it provides zero actionable insight for safety improvements. This paper explores how advanced NLP techniques can be used to clean, re-classify, and extract value from these unstructured police reports.
2. The Data Challenge
The primary dataset consisted of 105,217 unique traffic accidents recorded in Munich between 2017 and 2022. Of these, 102,569 records included free-text descriptions written by officers at the scene. Historically, nearly 50% of these incidents were categorized as A7. To establish a ground truth for model evaluation, a "gold standard" test set of 236 accidents was manually labeled by domain specialists from the City of Munich.
3. Methodology
The research team implemented a three-pronged strategy to analyze and classify the data:
3.1 Semantic Clustering (BERTopic)
To investigate the contents of the "Other" category, the authors used BERTopic. This unsupervised approach involves converting text descriptions into dense vector embeddings, reducing dimensionality via UMAP, and clustering them using HDBSCAN. This allowed the researchers to identify latent themes within the miscellaneous data without prior labeling.
3.2 Few-Shot Prompting (Gemma-2-27B)
The researchers utilized a Large Language Model (LLM) as an automated annotator. By providing the Gemma-2-27B model with a few-shot prompt containing examples of correctly labeled accidents, they tasked the model with re-classifying the dataset. This served as a benchmark for how well a general-purpose model could interpret police narratives compared to human officers.
3.3 Supervised Predictive Modeling
Three distinct architectures were compared to determine the most effective classification method:
- Multi-Layer Perceptron (MLP): A standard neural network utilizing only tabular features (e.g., time, weather, location).
- Finetuned XLM-RoBERTa: An encoder-only transformer model trained specifically on the free-text accident descriptions.
- Multimodal Model: A fused system combining textual embeddings from XLM-RoBERTa with tabular features.
4. Key Insights and Results
4.1 Solving the "A7" Mystery
The semantic clustering revealed a significant finding: the "Other Accident" category was largely a mirror of the "Stationary/Parking" category. Approximately half of the miscellaneous accidents were minor parking-related incidents that officers likely placed in the fallback category for the sake of efficiency during field reporting.
4.2 The Superiority of Textual Data
A critical finding of this study is that narrative text is the primary driver of classification accuracy. While tabular data (weather, age, location) is traditionally prioritized in accident analysis, it proved to be a poor predictor on its own. The textual description of how the accident occurred contained the most useful signal for classification.
4.3 Model Performance
When evaluated against the expert-labeled ground truth, the performance differences were stark:
- Tabular Only (MLP): 53% accuracy.
- Few-Shot LLM (Gemma): 61% accuracy (acting as a strong zero-training baseline).
- Finetuned XLM-RoBERTa (Text Only): 72% accuracy.
- Multimodal (Text + Tabular): 73% accuracy.
While the multimodal approach yielded the highest accuracy, the marginal 1% gain over the text-only model underscores that the narrative description is the most vital component of the report.
5. Discussion and Future Work
Despite the success of the transformer models, several limitations remain. Running high-parameter models like Gemma-2-27B requires significant hardware resources, which may be a constraint for local governments. Furthermore, while LLMs are proficient at identifying simple categories like parking accidents, they occasionally struggle with complex temporal logic—such as distinguishing between an accident that happens during a turn versus one that happens immediately after a turn.
Future work should focus on "Human-in-the-Loop" systems. Rather than replacing human judgment, these models could be integrated into police reporting software to provide real-time category suggestions. Additionally, implementing active learning—where the model flags ambiguous cases for human review—could create a continuous feedback loop to improve data quality over time.
6. Conclusion
By leveraging NLP, urban planners can transform messy, unstructured police reports into high-quality data. This study demonstrates that transformer-based models can effectively resolve classification ambiguities, particularly the over-use of miscellaneous categories, providing a clearer picture of city safety and enabling more informed infrastructure decisions.
Summary updated