xiecouldvehiclesanalyzedriving2025.md 137 KB


category: literaturenote citekey: xiecouldvehiclesanalyzedriving2025 title: Could vehicles analyze driving risks using human fuzzy semantic logic? A data-knowledge-driven new perspective authors: "Xie, Jiming; Qin, Yaqin; Zhang, Yan; Li, Jianhua; Chen, Tianshun; Zhao, Xiaohua; Xia, Yulan" year: 2025 date: 2025-00-00 2025 doi: 10.1016/j.aap.2025.108037 publication: "Accident Analysis & Prevention" url: "https://doi.org/10.1016/j.aap.2025.108037" zotero_key: IRU5DKB3 zotero_storage: 9DCXMPMM collections: transpordi_planeerimine folder: 001_artiklid firstAuthor: "Xie, Jiming"

status: converted

Contents lists available at ScienceDirect

Accident Analysis and Prevention

journal homepage: www.elsevier.com/locate/aap

Could vehicles analyze driving risks using human fuzzy semantic logic? A data-knowledge-driven new perspective

Jiming Xie a,1 , Yaqin Qin a,* , Yan Zhang a,1 , Jianhua Li a , Tianshun Chen a , Xiaohua Zhao b,* , Yulan Xia c,*

  • a Faculty of Transportation Engineering, Kunming University of Science and Technology, Kunming 650500, China
  • b Beijing Key Laboratory of Traffic Engineering, College of Metropolitan Transportation, Beijing University of Technology, Beijing 100124, China
  • c Department of Traffic Engineering, University of Shanghai for Science and Technology, Shanghai 200093, China

ARTICLE INFO

Keywords:

Driving risk analysis Data-knowledge-driven Natural driving dataset Traffic semantic rules Fuzzy data processing

ABSTRACT

Accurate risk identification is crucial for ensuring the safe operation of Host vehicles (HoVs) in environments shared with Neighboring vehicles (NeVs). Traditional risk identification mechanisms typically rely on large amounts of precise numerical data, making it difficult to comprehensively and accurately identify traffic crash risks under conditions of imperfect data associated with fuzzy information. However, human drivers rely on knowledge-driven, subjective assessments using fuzzy descriptors like distance and speed semantics to evaluate driving risk. These insights provide significant value for addressing the limitations of precise data-driven methods. This study proposes a novel traffic crash risk analysis framework called Token Tree Generation and Parsing (TTGP). It integrates knowledge-driven insights from human drivers with data-driven methods. TTGP includes the Token Tree Generation Module (Module 1) and the Token Tree Parsing Module (Module 2). In Module 1, we apply the token-tree-of-thoughts method to transform natural language traffic regulations and vehicles' traffic behaviors and attribute parameters into token tree based on semantic rules. This module simulates the generation of human fuzzy semantics in traffic scenarios. In Module 2, we integrate three encoders and decoders to extract traffic crash risk semantic features and identify traffic crash risk level from the digitized token tree. Experiments in the highway and urban expressway interweaving areas demonstrate that TTGP can accurately analyze risk using imprecise data. The TTGP performs better than traditional methods such as Tree, Naïve Bayes, RUSBoost and Efficient Logistic Regression models. This study significantly enhances the flexibility, generalization, and reliability of risk assessment. It bridges the gap in how HoVs handle fuzzy information in risk analysis.

1. Introduction

With the increasing number of vehicles on the road, traffic injuries have become a major global public health and socio-economic issue. According to statistics, more than 1.18 million people worldwide lose their lives in road traffic accidents each year (World health statistics, 2024). Accurately identifying and analyzing potential crash risks can help vehicles take appropriate evasive measures before an accident occurs, thereby preventing crashes or mitigating their consequences (Xie et al., 2024; Hou et al., 2024).

Currently, the most commonly used traffic crash risk identification mechanisms for vehicles are primarily AI-based (Duch et al., 2004). This

fundamentally differs from human drivers' risk analysis mechanisms, as shown in Fig. 1. vehicles obtain large volumes of precise numerical data, such as vehicle position, speed, acceleration, and distance, and employ AI techniques such as Convolutional Neural Networks (CNN), Long Short-Term Memory (LSTM) networks, and Deep Neural Networks (DNN) to process this structured data to identify risk states (Niu et al., 2024; Shangguan et al., 2021). While this AI-based crash risk identification mechanism offers controllability and quantifiability, it is often highly scenario-specific, lacks interpretability, and struggles to adapt to complex dynamic environments (Nauta et al., 2023). Moreover, in cases of imperfect real-world data, such as inaccuracies caused by sensor errors (Zheng et al., 2022), data loss (Zhao et al., 2023), communication

* Corresponding authors.

E-mail addresses: qinyaqin@kust.edu.cn (Y. Qin), zhaoxiaohua@bjut.edu.cn (X. Zhao), yulan_xia@163.com (Y. Xia). 1 These authors contributed equally.

delays (Zhao et al., 2020; Zhao et al., 2023), or environmental interference (Zheng et al., 2021), imperfect data often results in fuzzy information (Tian et al., 2023; Cheng et al., 2024). AI-based risk identification mechanisms are often unable to comprehensively and accurately identify traffic crash risk (Grosse and Alahi, 2024). These challenges highlight the need for more efficient and cost-effective methods to address the traffic crash risk identification task.

In contrast, human drivers typically do not have access to precise traffic data but instead rely on fuzzy natural language expressions to identify traffic crash risk during driving (Yu et al., 2024; Wan et al., 2024), such as perceiving the insufficient following distance, excessive speed, or inadequate speed. In other words, human drivers can leverage road traffic regulations, their own knowledge, and experience to extract key features from incomplete, imprecise, or even fuzzy semantic, enabling them to make traffic crash risk identification. The interpretation of fuzzy semantics reflects the unique abstract thinking process of humans (Courellis et al., 2024; Lindgren et al., 2020; Szangolies, 2020; Abstraction, in: C. Wang, G.D. Hachtel, F. Somenzi, 2006), wherein complex and abstract fuzzy semantics are transformed into understandable traffic crash risk identification tasks through unstructured information perception and traffic regulations. This knowledge-driven traffic crash risk identification mechanism offers high flexibility, simplicity, interpretability, and transferability (Hocquette et al., 2308).

Therefore, it is worth exploring whether vehicles can draw inspiration from human knowledge-driven mechanisms for traffic crash risk identification (Wei et al., 2022). This exploration may enable vehicles to interpret road traffic regulations articulated in natural language. Additionally, it could facilitate the assessment of crash risk from fuzzy semantic information, thereby overcoming the limitations of AI-based methods in scenarios characterized by insufficient or fuzzy data.

The continuous advancement of LLMs (Suzuki and Arita, 2024) has provided a potential approach for identifying traffic crash risk characterized by imperfect or highly fuzzy data. Studies have shown that LLMs are capable of simulating human language understanding and generation processes (Zhu et al., 2408). LLMs transform language strings into token sequences based on semantic rules. These tokens are the basic units of language. It can be words, characters, or other grammatical elements. Tokens carry critical information within language. By analyzing and combining these tokens, LLMs can effectively understand key semantic information in context and perform reasoning and generation according to the situation (Lee and Toutanova, 1810; Hadi et al., 2024). Meanwhile, Zhang et al. (Zhang et al., 2024) used LLMs and prompt engineering to achieve large-scale traffic data imputation without the need for expert knowledge or complex mathematical models. Pang et al. (Pang et al., 2024) proposed an LLM-guided deep reinforcement learning (DRL) framework for solving autonomous driving decision-making problems. These findings suggest that LLMs can address complex road traffic issues and are promising in identifying potential traffic crash risk from fragmented, fuzzy, and coarse-grained data in traffic scenarios.

This study uses LLMs, which align more closely with human cognitive processes (Wu et al., 2410), to propose a novel traffic crash risk identification framework called Token Tree Generation and Parsing (TTGP). This framework integrates knowledge-driven and data-driven approaches to analyze risk semantics in the driving, as shown in Fig. 2. The proposed TTGP more closely resembles human fuzzy semantic reasoning, reducing dependence on large volumes of precise numerical data, and enhancing the adaptability and safety of driving systems in complex traffic scenarios. Specifically, TTGP consists of two modules.

  • Token tree generation module (Module 1). This module aims to simulate the generation of human fuzzy semantics in traffic scenarios, similar to human perception. First, we use symbolic and mathematical logic to transform natural language traffic regulations with fuzzy semantics into logical, digitized semantic rules for driving control system. Then, inspired by human-like logical reasoning models, we apply the token-tree-of-thoughts method (Yao et al., 2024) to process HoV and NeV traffic behaviors and attribute parameters with semantic characteristics. We transform them into unstructured token representations, thereby constructing a logical, digital, and semantic token tree consistent with human reasoning.
  • Token tree parsing module (Module 2). This module aims to parse human fuzzy semantics and identify traffic crash risk. Based on a pretraining and re-training approach, we integrate three encoders and decoders: the Token Tree Decoder for semantic understanding, the Feature Encoder for feature extraction, and the Label Decoder for crash risk identification. These components extract crash risk semantic features from the digitized token tree, enabling HoV making human-like, accurate identification of traffic crash risks in complex scenarios.

This study makes three contributions:

  • 1. We propose the TTGP traffic crash risk identification framework. This framework combines data-driven strategies with human knowledge-driven mechanisms. It efficiently identifies traffic crash risk from unstructured and fuzzy data text, thereby reducing the reliance on precise, structured data to some extent.
  • 2. We propose advanced LLM technology to transform traffic regulations and driving behavior parameters into logical, rule-based token sequences, extracting risk semantic features from a digital token tree. This simulates human thought processes.

Fig. 1. Analysis of AI and human characteristics.

Fig. 2. Overview of the TTGP framework for risk analysis.

  1. We applied the TTGP framework to real-world interweaving area and conducted extensive risk identification experiments and analyses. Compared to traditional methods such as Tree, Naïve Bayes, RUS-Boost and Efficient Logistic Regression models, our framework demonstrates higher accuracy. This confirms its ability to capture complex linguistic structures and semantic relationships related to driving risks from fuzzy data.

2. Related work

This study utilized the core database of Web of Science to extensively analyze the development trajectory and research prospects of risk analysis, as illustrated in Fig. 3. The search term traffic crash risk analysis was employed to select traffic-related articles, covering publications from 2000 to the present. Among the 2790 retrieved articles, titles and abstracts were meticulously reviewed, excluding studies unrelated to traffic crash risk analysis, resulting in 436 highly relevant papers.

To better understand the technological advancements in traffic crash risk analysis, the related research work is divided into two key areas: traffic semantic analysis and traffic crash risk identification. Overall, the flowchart of the specific related work review is shown in Fig. 4.

2.1. Traffic semantic analysis

Traffic semantic analysis is the process by which drivers interpret driving tasks and traffic scenarios in real time. By accurately understanding and analyzing traffic semantics, vehicles can swiftly identify potential hazards, comprehend traffic rules and contexts, and make timely, appropriate decisions. Traffic semantic analysis mainly includes data-based and text-based methods.

Data-based traffic semantic analysis focuses on mining and modeling the spatial, temporal, and behavioral interactions between various semantic entities in traffic scenes, rather than merely performing static identification of individual entities. Zhang et al. (Zhang and Wang, 2019) combined Bayesian nonparametric learning with clustering algorithms to decompose the interaction behaviors of vehicles at intersections into interpretable driving primitives, enabling semantic analysis of vehicle interactions at signalized intersections. Tian et al. (Tian et al., 2023) proposed a Road Scene Graphs-Graph Convolutional Network to automatically identify the semantic interactions between traffic participants and surrounding objects, such as a vehicle approaching a pedestrian. Lateef et al. (Lateef et al., 2023) used camera sensor data to detect behavioral semantic information related to the motion, position, speed, and distance of traffic participants, aiding in better collision assessment and threat warning during driving. Sun et al. (Sun et al., 2404) modeled the semantic relationships between traffic participants, road topology, traffic signs, and their interactions based on the nuScenes dataset to predict multimodal vehicle trajectories. However, data-based traffic semantic analysis primarily relies on perception data and algorithmic models, making it difficult to comprehensively understand and express the underlying intentions and abstract semantics involved in traffic behavior and driving decisions.

Text-based traffic semantic analysis addresses this limitation by delving into and understanding traffic-related textual data to reveal semantic information such as rules, behavioral motives, and accidents in traffic scenes (Aryffin et al., 2021; Janstrup et al., 2023), thereby providing higher-level knowledge and decision-making support for intelligent transportation systems. Huo et al. (Huo et al., 2021) collected traffic-related textual data from social media and proposed a traffic situation generation method based on Generative Adversarial Networks (GANs). Additionally, supervised Natural Language Processing (NLP) techniques for extracting insights from accident reports have been widely studied. Ahadh et al. (Ahadh et al., 2021) proposed a semisupervised accident report analysis method using NLP, which can identify pipeline accidents from unstructured text with an accuracy rate of over 80 %. Yan et al. (Yan et al., 2023) applied NLP to quickly and accurately extract hazards, causes, and scenarios from marine accident reports.

Although significant progress has been made in text-based traffic semantic analysis techniques, there are still some limitations. On one hand, the complexity and variability of traffic texts, along with their

Fig. 3. The systematic review framework, content, and results.

intricate knowledge structures and lack of specialized topic classification, lead to insufficient depth in knowledge extraction (Hughes et al., 2018). This results in weak contextual dependence, fluctuating accuracy, and poor robustness during traffic text semantic extraction task. On the other hand, current studies mainly focus on directly classifying traffic accident reports with varying severity (Qi et al., 2024; Yuan and Wang, 2022). Research on mining potential risks from general traffic text semantics is still in its early stages.

2.2. Traffic crash risk identification

Traffic crash risk identification refers to the process of identifying and classifying potential risk in the current traffic environment. The goal is to detect potential risks before accidents occur and take corresponding measures to prevent them. With sufficient data, traffic crash risk identification typically involves three main methods (Yang, 2022): first, using surrogate measures to directly identify traffic crash risks based on road environment and vehicle interaction information; second, using mathematical statistical models to identify traffic crash risks; and third,

Fig. 4. The flowchart of the related works.

employing AI models for crash risk classification tasks.

In the use of surrogate measures for direct traffic crash risk identification, time-based and acceleration-based indicators are widely used. Time-based indicators include Time-to-Collision (TTC) (Das and Maurya, 2019), Time Exposed Time to Collision (TETC) (Wen and Lee, 2022), Anticipated Collision Time (ACT) (Venthuruthiyil and Chunchu, 2022), Modified Time to Collision (MTC) (Wu et al., 2018), Time Headway (TH) (Abolfazli et al., 2021), and Post-Encroachment Time (PET) (Peesapati et al., 2018). Acceleration-based indicators include Deceleration Rate to Avoid a Crash (DRAC) (Fu and Sayed, 2021), Crash Potential Index (CPI) (Jang et al., 2020), and Criticality Index Function (CIF) (Almotahari and Yazici, 2019). However, most of these risk indicators are scenario-specific, particularly in one-dimensional scenarios, which leads to discontinuities in risk quantification or inconsistencies with real-world conditions when vehicles are in continuous dynamic motion.

Traditional mathematical statistical methods primarily use logistic regression models. They are advantageous in revealing the factors influencing high-risk events or accidents and their extent. Xing et al. (Xing et al., 2020) developed time-varying logit models for crash risk identification of unconstrained vehicle movements at upstream toll plaza ramps. Zhang et al. (Zhang and Sze, 2024) established a random logit model with mean and variance heterogeneity to find that longitudinal and lateral speeds and acceleration of cars and motorcycles are closely related to traffic crash risks. Additionally, probabilistic models are often used for traffic crash risk assessment and identification. Hacohen et al. (Hacohen et al., 2018) used probability density maps to describe the risks of pedestrian-vehicle interactions, while Li et al. (Li et al., 2023) used Gaussian process regression to develop a traffic crash risk assessment framework for vehicles and pedestrians at intersections, demonstrating that the proposed model provides more stable risk estimates compared to TTC. Despite the advantages of mathematical statistics in traffic crash risk identification and modeling, most models lack sufficient adaptability to address real-time environmental changes, which may lead to lag and accuracy issues in applications such as realtime traffic crash risk identification and crash warnings.

To address these issues, many scholars have applied AI methods to traffic crash risk identification with promising results. Niu et al. (Niu et al., 2024) utilized fuzzy C-means clustering and optimized decision tree models to assess dynamic traffic crash risks at tunnel entrances. Li et al. (Li et al., 2023) developed a traffic crash risk identification model using support vector machines and decision tree classifiers. Zhang et al. (Zhang et al., 2025) proposed a crash risk identification model based on encoder-decoder deep learning to assist autonomous vehicles in decision-making when encountering jaywalking pedestrians. Yang et al. (Yang et al., 2025) combined CNN and LSTM to identify potential crash risk levels during lane-changing, using the HighD dataset for testing, demonstrating the method's applicability in advanced driver assistance systems. Most AI-based risk identification methods face the black-box problem (Chang et al., 2025).

However, it is undeniable that both surrogate indicators and the

application of statistical or AI models for crash risk identification require sufficient, clear, and structured data as their foundation (Arun et al., 2021; Wu et al., 2017). In the real traffic environments, the traffic data received by Host vehicles (HoVs) equipped with Advanced Driver Assistance System (ADAS) features such as radar detection, sensors and GPS, often suffer from issues such as sparsity, low completeness, and fuzzy, posing significant challenges for risk identification tasks.

3. Research framework

Owing to their robust capability for processing and understanding fuzzy data, LLMs hold significant promise. This is particularly true for applications in risk semantic analysis in complex traffic scenarios such as interweaving area. To address the precise handling of fuzzy semantics in traffic crash risk analysis, the complexity of interweaving area scenarios, and the challenges of high-dimensional data, this study constructs a comprehensive risk analysis framework. This framework, TTGP, is based on NLP technology with LLMs at its core. To illustrate the framework's feasibility, Fig. 5 shows the research logic.

The remainder of this paper is organized as follows:

Section 4 introduces the data sources and processing methods. Notably, all data available in Section 4 serve two purposes: supporting the generation of fuzzy semantics required for the TTGP framework and acting as data sources for risk level determination standards. For risk level classification, it combines expected time to collision (ETTC) with cumulative frequency distribution curves from traffic engineering to quantify and determine thresholds for various risk levels. Risks are categorized into four main levels: Level I (high risk), Level II (medium risk), Level III (low risk), and Level IV (minimal risk). The results are used for subsequent validation of the TTGP risk analysis framework.

Section 5 explains the dual-module structure of TTGP. On one hand, token-tree-of-thoughts are utilized to generate logical and regulated unstructured fuzzy semantics from the data in Section 4, based on traffic regulations as semantic rules. The objective is to enable HoVs equipped with ADAS features such as radar detection, sensors and GPS to respond flexibly to various uncertainties in dynamically complex interaction driving scenarios. On the other hand, LLMs that closely align with human cognitive processes are employed to extract potential semantic features, facilitating in-depth risk identification and analysis, which subsequently leads to risk level classification.

Section 6 verifies the accuracy and generalization of the TTGP framework. A comprehensive evaluation system is constructed using data from interweaving area on urban expressways and highways to analyze the performance of the TTGP risk analysis framework.

Among them, the TTGP model is the focus of this paper and contains two modules, which are:

Token tree generation module (Module 1). To reflect the process by which humans generate complex risk semantics, this module uses semantic rules based on traffic regulations. It tokenizes fuzzy data and optimizes token hierarchies to generate a risk semantic token tree, laying the foundation for subsequent tree parsing.

Fig. 5. Overview of research logic.

Token tree parsing module (Module 2). To describe the human process of parsing complex risk semantics, this module employs a pretraining-retraining approach to enhance model generalization. It uses a token tree decoder, feature encoder, and label decoder for token tree risk analysis.

4. Data

To date, a complex area for risk analysis is the interweaving area, where high driving risk arises because of interwoven traffic, frequent lane-changing, and unpredictable interactions. These areas are critical nodes in the transportation network, encompassing dynamic and complex environments such as ramps, entrances, and exits. Individually, the diversity in vehicle speeds and directions, along with variations in driver decisions, significantly increases the complexity of risk analysis. Collectively, interactions among vehicles and fluctuating traffic conditions further complicate risk evaluation. Therefore, we choose the interweaving area as a scenario case to demonstrate the reliability of our model.

4.1. Data extraction

Sufficient risk samples are collected under low testing costs and minimal experimental risk to ensure model effectiveness and reliability. High-definition video data is recorded using drone equipment, and advanced computer vision techniques are applied. A self-developed multi-scale kernelized correlation filters (KCF) vehicle tracking optimization algorithm automatically identifies and tracks moving vehicles from an aerial perspective. To ensure the framework's generalization across various risk scenarios, datasets from two different road types are extracted: the Jiangnan Expressway interweaving area in Nan'an District, Chongqing, China, and the Gaoyao Highway interweaving area in Xishan District, Kunming, Yunnan, China. Jiangnan Expressway interweaving area features a lane width of 3.5 m, a weaving area width of 17.5 m, and a weaving area length of 70 m, with a design speed of 60 km/h. Characterized by its larger number of lanes and shorter weaving distances, this results in a complex traffic scenario marked by varying speeds, unpredictable vehicle behaviors, and frequent conflicts, thereby underscoring its unique traffic characteristics. Gaoyao Highway interweaving area has the same lane width of 3.5 m but a narrower weaving area width of 15 m and a significantly longer weaving area of 300 m, designed for higher-speed traffic at 100 km/h. The traffic dynamics within the Gaoyao Highway interweaving area are characterized by complexity, with prevalent lane-changing activities, hundreds of annual traffic accidents, a peak traffic volume reaching 100,000 vehicles during holidays, and routine congestion during weekday peak periods, presents a highly disordered state.

Considering the fundamental spatial interaction relationship between vehicles, the vehicles' relationships are defined as follows: ① Host Vehicle (HoV), a vehicle equipped with an ADAS that includes an artificial intelligence system and appropriate sensors; ② Neighboring Vehicle (NeV), a vehicle that is either in front of or behind the HoV in the current lane or in target lanes, which requires risk identification. As shown in Fig. 6. It is worth noting that the ADAS is a system that collects environmental data from both inside and outside the vehicle through various sensors installed on the vehicle. It detects, identifies, and tracks dynamic and static objects, providing the driver with active safety technologies such as safety warnings, braking assistance, and steering assistance. This system is currently widely applied in many vehicles.

4.2. Data summary

Coordinate transformation, data validation, and error elimination yield dynamic vehicle attributes such as frame ID, time ID, vehicle ID and vehicle centroid coordinates. These form the foundational database of HoV–NeV natural driving behaviors. The data, once collected and processed, exhibits fine granularity and high detection accuracy, meeting the requirements for information collection in HoV–NeV traffic flows (Xie et al., 2023, 2024; Zhu et al., 2023). The final dataset includes 1,123 urban expressway vehicle samples (44,806 trajectory sequences) and 704 highway vehicle samples (75,122 trajectory sequences). The movement features of traffic participants and their interaction parameters are shown in Table 1.

It is important to note that risk is the central objective of this research. To validate the effectiveness of subsequent models, it is necessary to use the dependent variable ETTC as a reference for accurately assessing actual operational risks. We first classify risk levels based on ETTC. The conventional binary TTC* threshold (6 s) (Li et al., 2020) is insufficient for capturing actual operational risks. Therefore, we refine the classification using the cumulative frequency distribution method (Li et al., 2017), widely applied in traffic engineering. Specifically, when TTC* < 6 s (Li et al., 2020), we determine risk level thresholds using the 15 % and 85 % cumulative frequency ETTC values. This categorization defines four risk levels: Level I (high risk, accounting for 5–7 %), Level II (medium risk, accounting for 23–33 %), Level III (low risk, accounting for 5–7 %), and Level IV (minimal risk, accounting for 53–65 %). The predominance of Level IV highlights a long-tail distribution issue, leading to biased risk analysis and low accuracy in identifying minority classes. To mitigate this, we apply data balancing techniques, including loss re-weighting, re-sampling, and undersampling for majority classes, a common practice in deep learning. Ultimately, under-sampling is used to equalize the dataset, ensuring each risk level constitutes approximately 25 %. As shown in Table 2.

5. Methods

Our framework employs two main modules: the token tree generation module and the token tree parsing module, for semantic risk identification in interweaving area. The methodology uses tokens as the foundation for representing fuzzy semantics and token trees as the medium for semantic analysis, allowing HoVs to perform accurate humanlike risk analysis and achieve precise risk categorization in complex environments.

5.1. Module 1: Token tree generation module

Module 1 serves as generating token trees through semantic rules. To ensure logical, human-like fuzzy semantics in token trees, traffic regulations are integrated into the semantic rules.

To ensure that traffic rules expressed in natural language can be understood and executed by the system, existing natural language traffic rules can be transformed into digital traffic regulations, as suggested by Wan's (Wan et al., 2024) method. This digitization process can be achieved through symbolic and mathematical logical languages. Additionally, to enhance the efficiency of traffic regulation digitization and prevent rule entanglement, as shown in Fig. 7, we define each HoV trajectory paragraph P can be categorized into three types—basic attributes *A*1, motion states *A*2, and environmental interactions *A*3—based on heuristic semantic rules inspired by traffic regulations (Yu et al., 2024). Among them, the definition of the HoV trajectory paragraph P is as follows: each trajectory sequence is processed by NLP into a trajectory language description paragraph containing traffic characteristics and numerical information. *A*1 involves regulations on the vehicle's inherent properties. It describes the HoV's physical dimensions, location, and

Fig. 6. Spatial interaction relationship between HoV and NeV.

Table 1 HoV–NeV individual features and interaction characterization parameters.

Serial Study Traffic Parameter Categories
Number
(i)
Object Characteristics Variables/
Units
1 HoV Length w/m Basic attributes
2 Geometric center zx/m A1
coordinate in x
direction
3 Cautious, ∂/-
aggressive,
normal driving
style
4 Displacement of sx/m Motion states
the HoV in x A2
direction (unit
time)
5 Displacement of sy/m
the HoV in y
direction (unit
time)
6 Displacement s/m
(unit time)
7 Gap distance with r/m
interweaving
zone diverter
nose
8 Velocity in x − 1
vx/m⋅s
direction
9 Acceleration in x − 2
ax/m⋅s
direction
10 Velocity in y − 1
vy/m⋅s
direction
11 Acceleration in y − 2
ay/m⋅s
direction
12 Velocity − 1
v/m⋅s
13 Angle of velocity θ/rad
for HoV
14 Acceleration − 2
a/m⋅s
15 Jerk − 3
j/m⋅s
16 HoV with Gap distance in x dcur,F x /m Environmental
front of the direction of NeV interactions
17 current Velocity − 1
Δvcur,F x /m⋅s
A3
lane NeV difference in x
direction of NeV
18 Gap distance in y dcur,F y /m
direction of NeV
19 Velocity − 1
Δvcur,F y /m⋅s
difference in y
direction of NeV
20 Gap distance of dcur,F/m
NeV
21 Velocity − 1
Δvcur,F/m⋅s
difference of NeV
22 HoV with Gap distance in x dtar,F x /m
front of the direction of NeV
23 target lane Velocity − 1
Δvtar,F x /m⋅s
NeV difference in x
direction of NeV
24 Gap distance in y dtar,F y /m
direction of NeV
25 Velocity − 1
Δvtar,F y /m⋅s
difference in y
direction of NeV
26 Gap distance of dtar,F/m
NeV
27 Velocity − 1
Δvtar,F/m⋅s
difference of NeV
28 HoV with Gap distance in x dtar,B x /m
behind of direction of NeV
29 the target Velocity − 1
Δvtar,B x /m⋅s
lane NeV difference in x
direction of NeV
30 Gap distance in y dtar,B y /m
direction of NeV
Velocity − 1
Δvtar,B y /m⋅s
31
difference in y
direction of NeV

Table 1 (continued )

Serial
Number
(i)
Study
Object
Traffic
Characteristics
Parameter
Variables/
Units
Categories
32 Gap distance of
NeV
dtar,B/m
33 Velocity
difference of NeV
− 1
Δvtar,B/m⋅s
34 HoV with
behind of
Gap distance in x
direction of NeV
dcur,B x /m
35 the current
lane NeV
Velocity
difference in x
direction of NeV
− 1
Δvcur,B x /m⋅s
36 Gap distance in y
direction of NeV
dcur,B y /m
37 Velocity
difference in y
direction of NeV
− 1
Δvcur,B y /m⋅s
38 Gap distance of
NeV
dcur,B/m
39 Velocity
difference of NeV
− 1
Δvcur,B/m⋅s

Table 2 Identification of Risk Level (After Processing).

| Risk level | Highway interweaving area | | Urban expressway
interweaving area | | | |-------------------------------|---------------------------|---------------------|---------------------------------------|---------------------|--| | | Samples
(Percent/%) | ETTC/s | Samples
(Percent/%) | ETTC/s | | | Level I (high
risk) | 3846 (25.00) | (0, 0.5818] | 3154 (25.00) | (0,0.4629] | | | Level II
(medium
risk) | 3846 (25.00) | (0.5818,
4.6820] | 3154 (25.00) | (0.4629,
4.3164] | | | Level III (low
risk) | 3846 (25.00) | (4.6820, 6] | 3154 (25.00) | (4.3164, 6] | | | Level IV
(minimal
risk) | 3846 (25.00) | (6.00, +∞) | 3154 (25.00) | (6.00, +∞) | |

driving style, which are essential for spatial awareness and risk identification. *A*2 includes restrictions on the vehicle's movement. It covers the HoV's kinematic state to facilitate understanding of its dynamic behavior. *A*3 contains requirements on the interactions between vehicles. It illustrates HoV interactions with NeVs, roads, and the environment, aiding in real-time risk analysis.

Starting from these categories, each sentence in the paragraph is assigned unique tokens, as shown in the Appendix S1. Additionally, the collection of all serialized tokens within the paragraph forms the token tree. The role of tokens is to use traffic regulations as foundational rules, converting the continuous numerical information of vehicle trajectories into understandable, executable, and verifiable digital traffic rules. The role of the token tree is to assign a logical structure to tokens, enabling the rapid identification of subsequent tokens based on prefixes. This ensures contextual consistency among tokens, reflecting the implicit mechanisms of human cognitive data structures and illustrating the informational dynamics between traffic regulations and driving behaviors.

It is important to note that in the process of generating the token tree from tokens, we draw inspiration from human-like reasoning models. Considering that the tree-of-thought (ToT) approach enables multi-path exploration, enhancing adaptability and reasoning efficiency (Yao et al., 2024), we propose the token-tree-of-thoughts method. This method simulates human thought processes by branching out and evaluating multiple reasoning paths to address token tree generation problems. The specific process of token tree formation is illustrated in Fig. 8.

Initially, fuzzy semantic paragraphs from (1) human driving are analyzed to identify (2) semantics such as vehicle type, position,

Fig. 7. Generation of Human-like Token Trees through token-tree-of-thoughts.

Fig. 8. Token tree generation process.

displacement, speed, acceleration, jerk, relative position, and relative speed. Then, three (3) categories of basic attributes *A*1, motion states *A*2, and environmental interactions *A*3 are extracted based on heuristic semantic rules. Subsequently, categories are further divided into specific traffic (4) features, and vehicle motion parameter values from descriptive paragraphs are input to standardize values based on feature parameter ranges determined by traffic regulations. Additionally, these standardized values are discretized into semantic tokens within respective (5) interval ranges, as shown in the Appendix S1. The collection of serialized (6) tokens constitutes the (7) token tree.

5.2. Module 2: Token tree parsing module

The research framework for analyzing the risk information embedded in the digitized token tree is illustrated in Fig. 9. Considering the scarcity and diversity of risk data, it employs a combination of pretraining and re-training.

  • Pre-training phase. By processing large-scale general risk datasets, the module grasps the basic structure, feature representation, and classification patterns of token semantics, reducing reliance on extensive annotated data.
  • Re-training phase. It further re-trains using specific annotated data to perform better in tasks such as risk identification in the urban expressway and highway interweaving area.

To organize our module, we integrate human-like semantic decoding, natural language processing encoding, and LLM decoding technologies to build a token tree decoder, feature encoder, and label decoder, facilitating risk semantic understanding, feature extraction, and risk identification.

5.2.1. Token tree decoder

The token tree decoder's primary task is to interpret the token tree's semantics. Serving as the core architecture, it provides a foundation for semantic feature extraction and risk analysis. By leveraging a

Fig. 9. Diagram of the token tree parsing module.

hierarchical node structure, the token tree Tr captures both broad and detailed semantics. It constructs a multi-layered semantic tree, where each node represents a semantic feature token [*T1, T2,* …, Ti] ∈ T ∈ Tr. Starting from the root, the algorithm progressively refines semantic information by parsing child nodes layer by layer, capturing relationships and hierarchical connections to form associated tokens with semantic links.

$$[C_1, C_2, \dots, C_i] = Token-Tree \left[T_1, T_2, \dots, T_i; W^{Token-Tree}\right]$$

$$\tag{1}$$

where Token-Tree (⋅) and WToken− Tree denote token-tree and its parameter set, respectively.

5.2.2. Feature encoder

The feature encoder plays a role in risk feature extraction by targeting the semantic features of associated tokens with potential coupling relationships in the enhanced token tree. We adopt an enhanced unsupervised model based on LDA, emulating human risk analysis capabilities. This is because LDA follows a thought process similar to humans and is a popular and interpretable method available today. LDA, a text mining method, is applied to extract semantic features from the token tree set of vehicle trajectories in interweaving area, enabling automatic detection of text probabilities and generating high-frequency key information related to risk. This tree-based semantic processing enables the algorithm to generate refined semantic feature vectors [*F1, F2,…, Fi*] from associated tokens [*C1, C2,…, Ci*], providing vectors rich in feature information while maintaining token semantics:

$$[F_1, F_2, ..., F_i] = LDA[C_1, C_2, ..., C_i; W^{LDA}]$$ (2)

where LDA (⋅) and WLDA denote LDA and its parameter set, respectively. Additionally, to achieve intuitive visualization and analysis of token tree data, all LDA-labeled token trees are used to build risk portraiture. Concretely, the LDA model mechanism is as follows:

  • ① Initialization. In the topic modeling process, analogous to the relationship among documents, paragraphs, and vocabulary, a document (i.e., token tree set) comprises multiple paragraphs (i.e., token trees), each containing 43 words (i.e., tokens). 94 tokens form the vocabulary.
  • ② Feature Vectors. LDA generates a feature vector for each token, representing its probability distribution over topics. These semantic feature vectors [*F1, F2,…, Fi*] semantically stratify the specific input data and provide multidimensional semantic information for risk analysis through feature aggregation. Ultimately, these extracted and aggregated semantic features are used for further risk pattern recognition and classification.

In this interweaving application scenario, we simplify the LDA model to use only one topic. We no longer need to consider the topic-paragraph distribution, as the probability of the sole topic in each paragraph is always 1. Instead, we directly focus on the token-topic distribution γ, which represents the probability distribution of each token under the single topic. Subsequently, we use the objective of the maximum likelihood function to calculate the generation probability of the tokens in the entire token tree set under a sole topic. During this process, probabilities for the 43 tokens in each paragraph are computed.

$$\zeta(Trs|\chi) = \prod{i=1}^{43} p(T{Tr_i}|\gamma,\chi)$$ (3)

Where Trs is the collection of all token trees. Token-topic distribution γ is the probability distribution of each token under the single topic. Hyperparameters χ control the sparsity and shape of the token-topic distribution γ. It determines the likelihood of tokens being common or rare in the topic. The maximum likelihood function ξ(Trs|χ) measures the generation probability of each token in the token tree set given hyperparameters by computing probabilities of all tokens in all paragraphs. Tokens are categorized by probability into low frequency (LP), medium frequency (MP), and high frequency (HP) to form a documentvocabulary matrix Φ.

③ Topic portraiture. In the LDA model, potential topics are identified by extracting common high-probability tokens from different token trees. Each topic is represented by a set of high-probability tokens, forming its semantic profile. This approach enables LDA to construct a structured representation of topics within the token tree framework.

LDA outputs feature vectors reflecting the frequency of various risk features. These vectors further construct risk portraiture, depicting the structure of potential risk features. In such a case, this frequency-based risk portraiture supports subsequent pattern recognition and provides crucial data for risk level analysis. Thus, the feature encoder visualizes complex semantic relationships within the token tree, offering a multidimensional perspective for risk analysis.

5.2.3. Label decoder

The label decoder's core task is to identify and classify risk patterns, outputting risk levels. Here, let us operate the BERT model as the core architecture. This is because LLMs possess significant potential in simulating human-like reasoning and have achieved notable success in natural language processing, marking a milestone in the field. We turn to the comparison: while traditional unidirectional models are used, BERT employs a bidirectional transformer architecture for revolutionary context token understanding. However, tasks such as transitioning between urban expressway and highway interweaving areas take on unique, complex semantic feature vectors [*F1, F2,…, Fi*]. For classification tasks with special requirements, such as risk identification, we divide the workflow into four sections: the pre-process, mid-process, and post-process periods, along with the results.

  • ① Preparatory Phase. Pre-training and re-training enhance risk analysis by improving task adaptability and accuracy. Pre-training uses auxiliary data to establish domain understanding, while re-training refines the model with additional parameters, an full connection layer, and a softmax layer for risk classification. This process ensures the model effectively identifies risk levels despite uneven corpus distribution.
  • ② Loss Function. The loss function is crucial for capturing riskrelated token tree features. During BERT's training, the classification token determines the hierarchical structure of risk levels, while the separator token organizes input sequences. The model predicts masked tokens, with separator token serving a structural role rather than contributing to direct risk classification. Thus, BERT's loss function integrates hierarchical risk assessment and sequence structure learning.

$$L(\alpha) = L{NTP}(\alpha) + L{MLM}(\alpha)$$ (4)

Here, LNTP(α) denotes the loss associated with the Next Token

Prediction (NTP) task at the token level. LMLM(α) represents the loss for the Masked Language Model (MLM) task. α stands for the parameters of the encoder section in the BERT model.

③ Probability generation. It is considered a post-processing step. For a given sequence of input tokens, BERT employs multi-layer selfattention mechanisms and feedforward neural networks to produce a high-dimensional feature vector matrix Q

$$\mathbb{Q} = [q_1, q_2, ..., q_i] = LLMs [F_1, F_2, ..., F_i]$$ (5)

In this process, each output information vector qi encapsulates its contextual information, providing rich semantic content and contextual features that enable the model to identify complex risk patterns. Notably, the information vector for the classification token is selected for subsequent classification tasks. We input this vector into a fully connected layer (FC) η to effectively map these features to specific risk levels, outputting in the form of a probability distribution, thereby enhancing the interpretability and accuracy of the risk analysis results. The specific computation process of the fully connected layer η is as follows:

$$\eta = \delta \cdot q_{CLS} + \varphi \tag{6}$$

where δ is the weight matrix, and φ is the bias term. Subsequently, the outputs are transformed into a probability distribution dataset R using the SoftMax function,

$$\mathbb{R} = [\mathbb{R}{I}, \mathbb{R}{II}, \mathbb{R}{II}, \mathbb{R}{IV}] = Softmax(\eta)$$ (7)

④ Risk Levels. As the result of the label decoder, the likelihood of each risk level is indicated by the probability distribution. In specific applications of risk analysis, the highest probability value is Rmax = max[RI, R*II*R*III*RIV], and the risk level corresponding to Rmax is produced as the output. Thus, upon successful risk signal identification, the label decoder converts it into a clear risk level [Level I, Level II, Level III, Level IV] output, providing a solid data foundation for decision-making.

Based on the above procedure, the system uses the token tree decoder, feature encoder, and label decoder to analyze risk semantic features and identify risk patterns, ultimately predicting risk levels. The risk level division follows Section 4.2 standards. Risk patterns are like signals from hidden tokens of danger; once captured by the detection model, they are transformed into clear risk level outputs. We have integrated traditional risk analysis methods with cutting-edge natural language processing technologies, offering strong scientific and practical value. This approach effectively identifies and classifies risk patterns but also provides data-driven risk level categorization.

6. Experimental results and analysis

The accuracy and generalization of TTGP are verified in two aspects: semantic portraiture of risk features and identification and judgment of risk level. Based on the semantic paragraphs derived from the vehicle trajectory data extracted in the previous Section 4, semantic portraiture is achieved through the combined functions of the token tree decoder and feature encoder, validated by the driving risk spatial position and density distribution map. Moreover, the latter is output by the label decoder and validated against the four main risk levels categorized in Section 4.2.

6.1. Representation of risk feature

The token tree generation module transforms structured numerical information collected from natural driving into unstructured token tree text data. This process of generating token tree semantic information closely resembles how humans perceive and describe textual information. Given the significance of traffic crash risk management, it is crucial to determine whether data, once discretized into semantic tokens, remains effective. Therefore, we depict the semantic portraiture (Fig. 10, after balancing) and the spatial distribution (Fig. 11, before balancing)

Fig. 10. Semantic token tree portraiture of risk characteristics in the urban expressway interweaving area.

Fig. 11. Spatial distribution of risk levels I–IV.

of interweaving area risk features to validate the effectiveness of the semantic modeling proposed in this study. Fig. 11, based on the ETTC risk level classification, illustrates the spatial distribution of Level I to IV grades within the interweaving area of highways and urban expressways. This highlights a significant imbalance in the distribution of sample sizes across risk classes, which once again emphasizes the necessity and importance of data balancing discussed in Section 4.2.

(1) In Fig. 11, the risk distributions across different risk levels exhibit a relatively high degree of similarity with respect to the direction of travel. Similarly, as illustrated in Fig. 10, HoVs maintain normal ranges for longitudinal speed differences (Normal(Δvcur,F x 、Δvtar,F x 、 Δvtar,B x 、Δvcur,B x )), lateral speed differences (Normal(Δvcur,F y 、Δvtar,F y 、 Δvtar,B y 、Δvcur,B y )), and total speed differences (Normal(Δ*vcur,F*、Δ*vtar,F*、 Δ*vtar,B*、Δvcur,B)) with the front and behind NeVs in both target and current lanes. This finding demonstrates the similarity of vehicle speed. Both analyses demonstrate consistent risk patterns for vehicles crossing the same curbline, regardless of whether the lane change is to the left or right.

(2) Furthermore, Fig. 11 indicates that the risk levels in the merging nose region are markedly lower than those in the diverging nose region. This difference can be attributed to vehicles that merge at the end of the interweaving area to exit the mainline, often changing lanes at a higher safety risk. As shown in Fig. 10, the semantic portraiture of risk features reveals that HoVs frequently engage in merging (Merge area(zx)) and diverging (Diverge area(zx)) behaviors across the dataset. The longitudinal displacement differences (Strong_interaction (dcur,F x 、dtar,F x 、dtar,B x 、dcur,B x )) and combined displacement differences (Strong_interaction(*dtar,F*、*dtar,B*、dcur,B)) indicate a strong interactive state with neighboring NeVs. Their lateral displacement generally remains within the normal range (Normal (sy)). Owing to traffic congestion and driving environment constraints in interweaving area, the space for maneuver is limited, resulting in lower longitudinal and overall speeds (Under (vx), Under(v)). This situation makes it difficult to meet drivers' expectations in the early part of the interweaving area, with vehicles needing to merge only executing lane changes when close to the diverging nose (Near (r)). Consequently, both the analyses of merging and diverging behaviors lead to similar conclusions about the challenges encountered in these regions.

(3) In summary, Fig. 11 captures the risk of the driving process, precisely recording Level I to III risks, which exhibit a trend of diminishing from the interweaving area outward along the driving direction. The decrease in longitudinal risk suggests that vehicles in the innermost and outermost lanes have less involvement in weaving and possess higher priority, while the reduction in transverse risk indicates steady traffic conditions immediately upstream and downstream. One of the factors that lead to vehicle conflict and increased interference is the merging and diverging demand, which is consistent with the actual operation characteristics. In summary, Fig. 10 suggest that HoV faces higher passive risks compared to active collision behaviors. These risks are particularly evident at the end of interweaving area, where issues such as low speed or waiting to change lanes, significant speed differences, sharp turns, and sudden acceleration or deceleration may arise, posing higher driving risks. The conclusion aligns with the spatial distribution results, demonstrating effective modeling and observability of risk feature semantics.

The model adeptly describes the complex vehicle conflict characteristics within the interweaving area, thereby confirming the effectiveness of the risk portrayal model developed in this study, which accounts for the information of the NeVs.

6.2. Identification and judgment of risk level

The label decoder translates token tree semantic feature vectors into risk levels via LLMs, essentially reflecting human risk judgment in driving. On this basis, the performance of classical models such as Tree,

Naïve Bayes, RUSBoost, and Efficient Logistic Regression models is discussed.

  • (1) Tree model (Gregoriades et al., 2021), a machine learning model based on tree structures for solving classification and regression problems. In topic extraction, decision-tree models can identify key topics or main content in a text by analyzing features, aiding in understanding important topics and classifying or extracting topics based on specific rules or conditions.
  • (2) Naïve Bayes model (Dag et al., 2023), a classification algorithm based on Bayes' theorem that assumes feature independence. They can identify key topics or main content in a text by analyzing features such as words, phrases, or semantic information and constructing a classifier that predicts the topics or categories of text based on these features.
  • (3) RUSBoost model (He et al., 2021), a classic ensemble learning method that combines random undersampling and boosting algorithms. They built a strong classifier by training a series of weak classifiers (usually decision trees) and could handle imbalanced text datasets in which certain topics may be infrequent. Using random undersampling, RUSBoost reduces the sample size of the majority class, making it easier for the classifier to learn from the minority class.
  • (4) Efficient Logistic Regression model (Liu et al., 2019), a probabilistic classification model based on the logistic function (sigmoid) that transforms a linear combination of input features into probabilities. It is commonly used for binary classification tasks, estimating the likelihood of data samples belonging to distinct classes. Defining a loss function, computing gradients, and optimizing the model through gradient descent, it evaluates the performance of the classification and constructs a decision boundary to separate classes effectively.

The chord diagram comparison results are shown in Fig. 12. The connecting lines between different models indicate their classification capability from a statistical standpoint. The thinner the connecting lines, the higher the accuracy, and vice versa. For the urban expressway interweaving area, the connecting lines for the Tree, Naïve Bayes, RUSBoost and Efficient Logistic Regression models are relatively thick. In contrast, the TTGP framework has thinner connections, indicating superior performance in identifying four types of driving risks. For the highway interweaving area, as shown in Fig. 13, The performance of the Tree, Naïve Bayes, and RUSBoost models is similar to that in the urban expressway interweaving area, with relatively thick connection lines, indicating poorer traffic crash risk identification performance. Surprisingly, the Efficient Logistic Regression model performs better in risk identification in the highway interweaving area than in the urban expressway interweaving area. This suggests that the Efficient Logistic Regression model is unstable. It is more adept at capturing the simpler behaviors of vehicles in the highway interweaving area but struggles to grasp the complex interactions of vehicles in the urban expressway interweaving area. In contrast, the TTGP model consistently maintains strong performance across all scenarios.

Specifically, for the urban expressway interweaving area, the Tree model tends to misclassify Level I-high risk as Levels II-medium risk, IIIlow risk, or IV-minimal risk. Similarly, Level II-medium risk is often misclassified as Level III-low risk, while Level IV-minimal risk is prone to being misclassified as Levels II or III. The Tree model shows extreme vagueness in distinguishing the four risk categories, leading to noticeable intersections of connection lines in the chord diagram, possibly due to the imbalance in sample characteristics across different risk levels. The Naïve Bayes model tends to misclassify Level I-high risk and Level IImedium risk as Level IV-minimal risk, and Level III-low risk is easily misclassified as Levels II-medium risk and IV-minimal risk. This model exhibits a tendency to misclassify all risk levels into a single category, likely due to its simplicity, which fails to effectively capture the complex weaving behavior patterns in urban area, resulting in insufficient classification accuracy. Although the RUSBoost model has the capability to address data imbalance, its classification performance remains poor. It tends to misclassify Level I-high risk as Level III-low risk, Level IImedium risk as Level III-low risk and Level IV-minimal risk, and Level

Fig. 12. Comparison of risk identification results for the urban expressway interweaving area.

Fig. 13. Comparison of risk identification results for the highway interweaving area.

IV-minimal risk as Level III-low risk and Level I-high risk. The Efficient Logistic Regression model also exhibits a significant misclassification issue, similar to the three previously mentioned models. It misclassifies Level I-high risk as Level II-medium risk and Level IV-minimal risk. Additionally, it misclassifies Level III-low risk as Level I-high risk and Level IV-minimal risk, while Level IV-minimal risk is incorrectly

classified as Level III-low risk. In contrast, the TTGP framework exhibits the best accuracy in risk categorization, with notably fewer connection line intersections compared to the aforementioned models, indicating fewer misclassifications. This demonstrates the TTGP framework's superior performance in categorizing risk levels for imbalanced sample characteristics, making it suitable for driving risk assessment in complex

traffic environments.

Furthermore, for the risk identification of the highway interweaving area, the Efficient Logistic Regression model has best traffic crash risk identification performance, followed by TTGP, while the Tree, Naïve Bayes, and RUSBoost models remain the least effective. Specifically, the Tree model performs well for classifying Level II-medium risk but shows significant misclassification for Levels I-high risk, III-low risk, and IVminimal risk. The Naïve Bayes model is effective for classifying Level IV-minimal risk but exhibits severe misclassification for the other three risk levels, particularly misclassifying Level II-medium risk as Level IVminimal risk. Similar to the Tree model, the RUSBoost model performs well for Level II-medium risk. The TTGP framework, however, demonstrates fewer misclassifications across different risk categories, as indicated by thinner connection lines in the chord diagram. Further analysis reveals that the misclassified samples in the TTGP framework are primarily due to high-speed lane changes.

Overall, Although the Efficient Logistic Regression model demonstrates the best performance in the highway interweaving area, its effectiveness in the urban expressway interweaving area is quite poor. This highlights the instability of the model's performance. Its application in real-world traffic crash risk identification would struggle to support more complex scenarios. Therefore, considering the risk classification effectiveness for both urban expressway and highway interweaving areas, the TTGP framework accurately distinguishes Level IVminimal risk samples in both scenarios. It also shows fewer misclassifications for Levels I-high risk, II-medium risk, and III-low risk, reflecting its stable and precise identification capability for the complex and dynamic risk characteristics of interweaving area.

To validate the efficacy of the TTGP model, metrics including Accuracy (ACC), Error Rate (ER), True Positive Rate (TPR), True Negative Rate (TNR), Positive Predictive Value (PPV), False Positive Rate (FPR), F1 Score (F1), Matthews Correlation Coefficient (MCC), and Kappa (KAP) are applied for comprehensive evaluation, as detailed in Table 3. The TTGP model demonstrates the best performance in traffic crash risk identification for both the highway interweaving area and urban expressway interweaving area, indicating that the TRGP model is adept at accurately capturing the complex linguistic structures and semantic relationships associated with driving risks.

(1) Firstly, we use ACC and ER to evaluate the overall error level of traffic crash risk identification models. In the case of crash risk identification for the urban expressway interweaving area, the TTGP model achieves an ACC of 0.8359 and an ER of 0.1641. For the highway interweaving area, TTGP yields an ACC of 0.8336 and an ER of 0.1664. These results from TTGP significantly outperform those of the Tree, Naïve Bayes, RUSBoost, and Efficient Logistic Regression models. This is because the TTGP model boasts hundreds of millions of parameters, which are endowed with exceptional language representation abilities, enabling the learning of more complex and nuanced risk language representations. This high-capacity architecture significantly enhances the accuracy and reliability of analysis when handling complex risk data. However, the Naïve Bayes model relies on the assumption of feature independence. The RUSBoost model, Tree model and Efficient Logistic Regression model may experience performance challenges owing to data balance and feature selection, resulting in mediocre ACC and ER performance.

(2) Secondly, we use TPR, TNR, PPV, and FPR to evaluate the model's ability to correctly classify different types of samples in traffic crash risk identification. For crash risk identification in the urban expressway interweaving area, the TTGP model achieves TPR, TNR, PPV, and FPR values of 0.8347, 0.9449, 0.8956, and 0.0551, respectively, all of which outperform the other four models. For the highway interweaving area, TTGP achieves TPR, TNR, PPV, and FPR values of 0.8337, 0.9445, 0.845, and 0.0555, respectively. While TTGP shows a slight decline in PPV compared to the Efficient Logistic Regression model, it performs well in terms of TPR, TNR, and FPR. Specifically, the Tree model's structural approach may not capture the full semantic relationships in lengthy or intricate sentences. The Naïve Bayes and Efficient Logistic Regression model have feature independence assumption, this can hinder its handling of contextual text information, and while the RUSBoost model is effective with unbalanced datasets, it may not fully leverage the text's semantic relationships for complex classification tasks. The TTGP model benefits from bidirectional encoding to automatically learn rich feature representations and effectively capture semantic and contextual relationships. This capability enables a deep understanding of the semantics and context of text tokens, thereby facilitating a comprehensive grasp of the token tree. Hence the bidirectional encoding, with its foresight and hindsight, excels in NLP tasks, allowing for a better understanding of the semantic features of potential risks and leading to more accurate judgments in risk-type decision-making tasks.

(3) Thirdly, we use F1, MCC, and KAP as comprehensive evaluation metrics for traffic crash risk identification models. For crash risk identification in the urban expressway interweaving area, the TTGP model achieves F1, MCC, and KAP values of 0.8452, 0.8085, and 0.5625, respectively. For the highway interweaving area, TTGP yields F1, MCC, and KAP values of 0.8367, 0.7833, and 0.5564, respectively. These results still significantly outperform the other four models. The TTGP model demonstrated the benefits of advanced language modeling, bidirectional context modeling, and multitasking through pre-training and re-training, leading to improved model performance. During the pre-training phase, the model leverages large-scale unsupervised data to learn language and masked language model tasks, obtaining rich language representations. The re-training phase involves retraining on specific risk scenarios and task requirements to adapt the model to the features output by specific encoders. Therefore, this dual-stage approach provides more precise results in complex risk identification tasks in specific scenarios.

In summary, traffic crash risk identification performance of the TTGP aligns well with the risk level standards in Section 4.2 and the spatial distribution of risk features, confirming its accuracy and generalization capabilities.

Table 3 Comparison of risk identification model results.

| Index | | Urban Expressway Interweaving Area | | | | | Highway Interweaving Area | | | | | |-------|--------|------------------------------------|----------|--------|--------|--------|---------------------------|----------|--------|--------|--| | | Tree | Naïve Bayes | RUSBoost | ELR | TTGP | Tree | Naïve Bayes | RUSBoost | ELR | TTGP | | | ACC | 0.4063 | 0.3536 | 0.3736 | 0.498 | 0.8359 | 0.4624 | 0.399 | 0.3985 | 0.77 | 0.8336 | | | ER | 0.5937 | 0.6464 | 0.6264 | 0.502 | 0.1641 | 0.5376 | 0.601 | 0.6015 | 0.23 | 0.1664 | | | TPR | 0.4057 | 0.3525 | 0.374 | 0.4972 | 0.8347 | 0.462 | 0.3985 | 0.3981 | 0.7712 | 0.8337 | | | TNR | 0.8022 | 0.7844 | 0.7914 | 0.8326 | 0.9449 | 0.8208 | 0.7996 | 0.7994 | 0.9235 | 0.9445 | | | PPV | 0.4131 | 0.3515 | 0.3805 | 0.4994 | 0.8956 | 0.4761 | 0.4059 | 0.4037 | 0.8721 | 0.845 | | | FPR | 0.1978 | 0.2156 | 0.2086 | 0.1674 | 0.0551 | 0.1792 | 0.2004 | 0.2006 | 0.0765 | 0.0555 | | | F1 | 0.406 | 0.3361 | 0.3685 | 0.4965 | 0.8452 | 0.4569 | 0.3924 | 0.3918 | 0.7225 | 0.8367 | | | MCC | 0.2111 | 0.1362 | 0.168 | 0.3308 | 0.8085 | 0.2882 | 0.2013 | 0.2001 | 0.7192 | 0.7833 | | | KAP | 0.3683 | 0.4199 | 0.4013 | 0.253 | 0.5625 | 0.3025 | 0.376 | 0.3766 | 0.3867 | 0.5564 | |

*Note: The best values are in bold, and the worst values are in italics.

7. Conclusion

Data-driven AI autonomous driving technology is considered to have great potential in improving traffic system safety and efficiency. However, when data is sparse, data availability is limited, or data is fuzzy rather than precise, the host vehicle (HoV) may fail to provide accurate risk estimation results.

Inspired by human drivers' use of subjective, fuzzy language to identify driving risks, we propose a novel risk analysis framework called TTGP. The Token Tree Generation Module captures unstructured risk semantic rules from continuous and structured natural driving data by incorporating traffic regulations. The Token Tree Parsing Module utilizes large language model (LLM) to identify implicit risk levels. This framework effectively integrates human drivers' knowledge-driven insights with the data-driven methods used by autonomous vehicles, resulting in risk analysis outcomes that closely resemble human reasoning.

Experimental results on complex interweaving areas of highway and urban expressway show that, compared to traditional methods such as Efficient Logistic Regression, Naive Bayes, RUSBoost, and Tree models, TTGP has better performance on accuracy (ACC), error rate (ER), and other metrics. These results demonstrate TTGP's significant advantage in identifying and understanding the risk features and levels hidden behind semantics compared to traditional models.

In conclusion, this framework enables the host vehicle to adapt to sparse and incomplete data in driving environments, providing reliable risk estimation results. It contributes to enhanced road safety and supports risk decision-making of the host vehicle in dynamic, ever-changing environments. Our proposed method holds promise for application across L1 to L5 autonomous driving scenarios. For L1-L2 autonomous driving systems, our method is expected to accommodate low-quality data while enhancing driving safety. For L3-L5 autonomous driving, our approach aims to improve the system's adaptability to complex scenarios, reduce dependence on high-precision sensors, and further enhance overall safety. In the future work, it is advisable to consider incorporating more useful macroscopic data information, such as weather and road conditions, thereby ensuring the model's effectiveness and safety in practical applications. Furthermore, after achieving reliable crash risk identification tasks, reactions of vehicles should take to prevent accidents from happening should be the next important study direction, such as automatic braking, speed adjustment, yield, as well as lane changes or route alterations.

CRediT authorship contribution statement

Jiming Xie: Methodology, Formal analysis, Conceptualization, Writing – original draft, Data curation. Yaqin Qin: Supervision, Funding acquisition. Yan Zhang: Methodology, Formal analysis, Conceptualization, Writing – original draft, Data curation. Jianhua Li: Visualization, Software, Data curation. Tianshun Chen: Visualization, Formal analysis. Xiaohua Zhao: Supervision, Formal analysis. Yulan Xia: Writing – review & editing, Methodology, Investigation, Conceptualization.

Declaration of competing interest

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Acknowledgments

The authors would like to express their sincere thanks to Ms. Bijun Wang and Mr. Ke Li from the Kunming University of Science and Technology for their helpful comments, and to Prof. Bo Peng from the Chongqing Jiaotong University for providing the data used in this study. This work is supported by the National Natural Science Foundation of China (No. 72261021), Science and Technology Innovation and Demonstration Projects, Department of Transport of Yunnan Province, China (No. 2023-121; 2022-23-3), Research Project on Key Technologies for Highway Safety and Disaster Mitigation and Prevention, Department of Transport of Yunnan Province, China (No. SZKM202231022), Science and Technology R&D Projects of Yunnan Communications Investment & Construction Group Co., Ltd (No. YCIC-YF-2021-05). In addition, we would like to thank the anonymous reviewers for their invaluable insights. Their thoughtful comments have been highly instrumental in improving the overall quality of this paper and providing valuable guidance for our future research.

Note

  • 1. Data: The conclusions of this study are intended to deepen the understanding of how human drivers use subjective and ambiguous language to identify driving risks. Since the data were collected from sample populations in two specific regions—Kunming and Chongqing, China—and considering that driving policies vary across locations, these conclusions may not fully represent the general patterns among populations with different cultural, social, economic, and political backgrounds.
  • 2. Results: From the spatial distribution of the four types of risks, it can be seen that the density distributions of the trajectories are different. This is because the data are raw and have not been balanced—resulting in uneven sample proportions for each risk. Moreover, the volume of this data is not entirely consistent with that of our previous research (Xie et al., 2023).
  • 3. Model: At present, classical surrogate safety theories such as TTC, PET, and ETTC (the ETTC model was originally proposed by us; however, it is merely a perfect model under ideal data conditions) can achieve satisfactory classification accuracy when applied to precise data. However, when faced with real-world data that are imprecise, incomplete, and fuzzy, these methods almost completely fail. In contrast, TTGP demonstrates robust performance in risk identification using fuzzy data and is capable of addressing this challenge.

Appendix S. 1. Results of discretized semantic token

Based on the interaction feature parameters between HoVs and NeVs provided in Table 1, a total of 43 sentences S containing traffic semantic characteristics were constructed, as shown in Table S1. The semantic description is categorized into three types: basic attributes *A*1, motion states *A*2, and environmental interactions *A*3,where *S*1− 3 ∈ *A*1, *S*4− 15 ∈ *A*2, *S*16− 43 ∈ *A*3. Each sentence consists of a unique traffic semantic characteristic, corresponding value and unit, and a conjunctive phrase. Each sentence S1 ∼ *S*43 uniquely corresponds to the continuous semantic description, parameter unit, value range RH 1 ∼ RH 43 in the urban expressway interweaving area, value range RE 1 ∼ RE 43 in the highway interweaving area, and the corresponding discretized semantic token Tn1 1 ∼ Tn43 43as shown in the table.

Table S1 Processing of 43 semantic characteristic parameters.

Sentence Category Continuous Semantic Description Parameter
/Unit
Value Range in Urban
Expressway Interweaving Area
Value Range in Highway
Interweaving Area
Discretized Semantic
Token
S1 A1 HoV's length w/m (0,6] (0,6] Car(w)
(6,9] (6,9] Lig_truck(w)
(9,∞] (9,∞] Hea_truck(w)
S2 HoV's geometric center coordinate in x zx/m (0,40] (0,25] Upstream(zx)
direction (40,60] (25,50] Merge nose(zx)
(60,100] (50,100] Merge area(zx)
(100,130] (100,175] Diverge area(zx)
(130,150] (175,200] Diverge nose(zx)
(150,200] (200,300] Downstream(zx)
HoV's type of driving style ∂/- [1,2,3] [1,2,3] Cautious(∂)
S3
Aggressive(∂)
Normal(∂)
S4 A2 Displacement of the HoV in x direction sx/m [-1,1] [-2,2] Normal(sx)
(unit time) else else ¬Normal(sx)
S5 Displacement of the HoV in y direction sy/m [-1,1] [-2,2] Normal(sy)
(unit time) else else ¬Normal(sy)
S6 HoV's displacement(unit time) s/m [-1,1] [-2,2] Normal(s)
else else ¬Normal(s)
S7 HoV's gap distance with interweaving area r/m (− 30,30] (− 60,60] Near(r)
diverter nose else else ¬Near(r)
S8 HoV's velocity in x direction − 1
vx/m⋅s
(17,+∞] (34,+∞] Over(vx)
(11,17] (22,34] Normal(vx)
(0,11] (0,22] Under(vx)
HoV's acceleration in x direction − 2 (− 2,2] (− 4,4]
S9 ax/m⋅s Normal(ax)
− 1 else else ¬Normal(ax)
S10 HoV's velocity in y direction vy/m⋅s (− 1,1] (− 2,2] Normal(vy)
else else ¬Normal(vy)
S11 HoV's acceleration in y direction − 2
ay/m⋅s
(− 1,1] (− 2,2] Normal(ay)
else else ¬Normal(ay)
S12 HoV's velocity − 1
v/m⋅s
(17,+∞] (34,+∞] Over(v)
(11,17] (22,34] Normal(v)
(0,11] (0,22] Under(v)
Angle of HoV's velocity θ/rad (− 0.4,0.4] (− 0.8,0.8] Normal(θ)
S13
− 2 else else ¬Normal(θ)
S14 HoV's acceleration a/m⋅s (− 2,2] (− 4,4] Normal(a)
− 3 else else ¬Normal(a)
S15 HoV's jerk j/m⋅s (− 7,7] (− 14,14] Comfort(j)
else else ¬Comfort(j)
S16 A3 HoV with front of the current lane NeV's dcur,F x /m (− 20,20] (− 40,40] Strong_interaction
gap distance in x direction else else (dcur,F x )
¬Strong_interaction
(dcur,F x )
S17 HoV with front of the current lane NeV's − 1
Δvcur,F x /m⋅s
(− 8,8] (− 16,16] Normal(Δvcur,F x )
velocity difference in x direction else else
¬Normal(Δvcur,F x )
S18 HoV with front of the current lane NeV's dcur,F y /m (− 2,2] (− 2,2] Strong_interaction
gap distance in y direction else else (dcur,F y )
¬Strong_interaction
(dcur,F y )
S19 HoV with front of the current lane NeV's − 1 (− 2,2] (− 4,4]
Δvcur,F y /m⋅s Normal(Δvcur,F y )
velocity difference in y direction else else ¬Normal(Δvcur,F y )
S20 HoV with front of the current lane NeV's dcur,F/m (− 20,20] (− 40,40] Strong_interaction
gap distance else else (dcur,F)
¬Strong_interaction
(dcur,F)
S21 HoV with front of the current lane NeV's − 1
Δvcur,F/m⋅s
(− 8,8] (− 16,16] Normal(Δvcur,F)
velocity difference else else ¬Normal(Δvcur,F)
S22 HoV with front of the target lane NeV's gap dtar,F x /m (− 20,20] (− 20,20] Strong_interaction
distance in x direction [else] [else] (dtar,F x )
¬Strong_interaction
(dtar,F x )
S23 HoV with front of the target lane NeV's − 1
Δvtar,F x /m⋅s
(− 8,8] (− 16,16] Normal(Δvtar,F x )
velocity difference in x direction else else ¬Normal(Δvtar,F x )
S24 HoV with front of the target lane NeV's gap dtar,F y /m (− 2,2] (− 2,2] Strong_interaction
distance in y direction else else (dtar,F y )
¬Strong_interaction
(dtar,F y )
HoV with front of the target lane NeV's − 1 (− 2,2] (− 4,4]
S25 Δvtar,F y /m⋅s Normal(Δvtar,F y )
velocity difference in y direction else else ¬Normal(Δvtar,F y )
S26 HoV with front of the target lane NeV's gap dtar,F/m (− 20,20] (− 40,40] Strong_interaction
distance else else (dtar,F)

Table S1 (continued )

Sentence Category Continuous Semantic Description Parameter
/Unit
Value Range in Urban
Expressway Interweaving Area
Value Range in Highway
Interweaving Area
Discretized Semantic
Token
¬Strong_interaction
(dtar,F)
S27 HoV with front of the target lane NeV's − 1
Δvtar,F/m⋅s
(− 8,8] (− 16,16] Normal(Δvtar,F)
velocity difference else else ¬Normal(Δvtar,F)
S28 HoV with behind of the target lane NeV's dtar,B x /m (− 20,20] (− 20,20] Strong_interaction
gap distance in x direction else else (dtar,B x )
¬Strong_interaction
(dtar,B x )
S29 HoV with behind of the target lane NeV's − 1
Δvtar,B x /m⋅s
(− 8,8] (− 16,16] Normal(Δvtar,B x )
velocity difference in x direction else else ¬Normal(Δvtar,B x )
S30 HoV with behind of the target lane NeV's dtar,B y /m (− 2,2] (− 2,2] Strong_interaction
gap distance in y direction else else (dtar,B y )
¬Strong_interaction
(dtar,B y )
S31 HoV with behind of the target lane NeV's − 1
Δvtar,B y /m⋅s
(− 2,2] (− 4,4] Normal(Δvtar,B y )
velocity difference in y direction else else ¬Normal(Δvtar,B y )
S32 HoV with behind of the target lane NeV's dtar,B/m (− 20,20] (− 40,40] Strong_interaction
gap distance else else (dtar,B)
¬Strong_interaction
(dtar,B)
S33 HoV with behind of the target lane NeV's − 1
Δvtar,B/m⋅s
(− 8,8] (− 16,16] Normal(Δvtar,B)
velocity difference else else ¬Normal(Δvtar,B)
S34 HoV with behind of the current lane NeV's dcur,B x /m (− 20,20] (− 40,40] Strong_interaction
gap distance in x direction else else (dcur,B x )
¬Strong_interaction
(dcur,B x )
S35 HoV with behind of the current lane NeV's − 1
Δvcur,B x /m⋅s
(− 8,8] (− 16,16] Normal(Δvcur,B x )
velocity difference in x direction else else ¬Normal(Δvcur,B x )
S36 HoV with behind of the current lane NeV's dcur,B y /m (− 2,2] (− 2,2] Strong_interaction
gap distance in y direction else else (dcur,B y )
¬Strong_interaction
(dcur,B y )
S37 HoV with behind of the current lane NeV's − 1
Δvcur,B y /m⋅s
(− 2,2] (− 4,4] Normal(Δvcur,B y )
velocity difference in y direction else else ¬Normal(Δvcur,B y )
S38 HoV with behind of the current lane NeV's dcur,B/m (− 20,20] (− 40,40] Strong_interaction
gap distance else else (dcur,B)
¬Strong_interaction
(dcur,B)
S39 HoV with behind of the current lane NeV's − 1
Δvcur,B/m⋅s
(− 8,8] (− 16,16] Normal(Δvcur,B)
velocity difference else else ¬Normal(Δvcur,B)

*Note: In previous research, it was found that four metrics warrant further investigation: AV's geometric centerline to lane centerline distance in sentence *S*40, AV's longitudinal distance from lane change path to cross-lane line minus half vehicle width in sentence *S*41, Range Entropy in sentence *S*42, and Group-based trajectory in sentence *S*43. Considering that the core of the TTGP research focuses on tokens, these feature parameters are introduced for testing to further enhance token generation; however, due to the composite nature of the parameters, they are not classified into specific types but are instead briefly described in terms of their token classification. The derivation, computation, and application of these metrics are the focus of another major research project by the team (Xie, 2025). Tokens are assigned as follows:

  • *S*40: For AV's geometric centerline to lane centerline distance, a Normal(Δdm) token is assigned when the value falls within (− 1.9, 1.9] m; else, a ¬Normal(Δdm) token is assigned.
  • *S*41: For AV's longitudinal distance from lane change path to cross-lane line minus half vehicle width, a Normal(Δdt) token is assigned when the value falls within (− 5.7, 5.7] m; else, a ¬Normal(Δdt) token is assigned.
  • *S*42: For Range Entropy, a Normal(En) token is assigned when the value falls within (15, 85th]; else, a ¬Normal(En) token is assigned.
  • *S*43: For Group-based trajectory, an Ltraj(ϑ) token is assigned when the value equals 1; an Mtraj(ϑ) token is assigned when the value equals 2; an Htraj(ϑ) token is assigned when the value equals 3.

Please note that this study focuses on crash risk identification in fuzzy, stochastic, and complex traffic environments. Therefore, the extracted structured data needs be processed into semantic data with fuzzy thresholds. It is important to emphasize that fuzzy data is ubiquitous in real-world traffic scenarios due to factors such as hardware failures, data transmission errors, and software precision limitations. The key objective of our approach is to simulate, at the semantic level, the human driver's fuzzy cognitive process in risk perception, rather than to model low-level sensor noise or artificially introduce data fuzzification.

In other words, this can be understood as constructing an inherently "erroneous problem"—the presence of fuzzy data—while requiring an "accurate answer"—precise data—to verify whether the problem has been effectively addressed. Even if this "erroneous problem" is constructed using our refined and structured data, its purpose remains solely to validate our proposed solution.

Data availability

Data will be made available on request.

References

Higher-Order Abstractions, arXiv preprint arXiv:2308.08334 (2023).