Highway river-crossing bridge traffic accident intelligent analysis method fusing local fine-tuning LLM

By constructing a domain-specific corpus and a lightweight, adaptable large language model, the problems of slow report generation and insufficient professionalism in cross-river bridge traffic accident analysis have been solved, enabling rapid and accurate generation of emergency response strategies and improving the efficiency and economic benefits of accident analysis.

CN121301528APending Publication Date: 2026-01-09JIANGSU UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202511604792.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-05
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

Existing technologies for analyzing traffic accidents on cross-river bridges suffer from problems such as slow report generation, insufficient professionalism, and difficulty in implementing recommendations. They are unable to meet the needs for rapid, accurate, and actionable emergency response, especially in situations with severe weather and complex multi-source information.

Method used

By employing a method that integrates local fine-tuning of LLM, a domain-specific corpus and a lightweight, adaptable large language model are constructed to automatically convert multi-source heterogeneous information into structured input, generate professional causal inferences and suggestions, and format them in real time into on-site executable control strategies.

Benefits of technology

It enables rapid response and efficient analysis of cross-river bridge accidents, improves data processing efficiency, and generates more accurate and actionable recommendations, meeting the emergency response needs of cross-river bridges and reducing accident rates and economic losses.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121301528A_ABST
    Figure CN121301528A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of traffic accident intelligent analysis, and particularly relates to an expressway river-crossing bridge traffic accident intelligent analysis method fused with local fine tuning LLM, and the method comprises the following steps: 1, carrying out the target extraction of obtained traffic report data, carrying out the preprocessing and optimization of the data, and obtaining an answer structured corpus data set; 2, the target data set is uploaded to a folder of an LLaMA Factory, the target data set is encoded to enter a Webui webpage of the folder, and a fine tuning parameter training model is set through an LLaMA Factory tool; and 3, constructing a multi-dimensional scoring system in combination with weight distribution, and performing quantitative evaluation and visual comparison on suggestions given by the model before and after fine adjustment by using text vectorization, keyword matching, cosine similarity calculation and statistical test methods. According to the method, the three requirements of efficient analysis, multi-factor correlation analysis and quick response are considered, and the three major problems that in the prior art, the report issuing speed is low, the specialty is insufficient, and suggestions are difficult to fall to the ground are effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of intelligent traffic accident analysis technology, specifically relating to an intelligent analysis method for traffic accidents on highway cross-river bridges that integrates local fine-tuning LLM. Background Technology

[0002] A traffic accident visualization analysis method and system based on big data analytics technology can provide real-time information on highway traffic accidents and predict related accidents through platform construction. Chinese patent CN118211176A discloses a highway traffic accident risk assessment method based on multi-model fusion; however, this technology has shortcomings in implementation in specific scenarios. The visualized information is mostly macro-level statistical data, lacking detailed analysis for specific road sections, and therefore does not provide sufficient support for the actual decision-making of grassroots traffic management departments.

[0003] Current methods for analyzing accident reports mainly fall into three categories: (1) The empirical judgment method based on manual rules can quickly process standardized reports, such as accident liability determination reports; however, it is difficult to process unstructured data. (2) Traditional machine learning methods can integrate multi-source data; however, they have limited understanding of complex scenarios and cannot automatically discover useful features from raw data. They rely too much on manual feature engineering and have insufficient scalability.

[0004] (3) Using data from traffic accident investigation reports, construct a knowledge graph of traffic accident causes and analyze risk factors; however, the construction cost is high.

[0005] While these methods have achieved some results, they are inefficient when dealing with generalized data, and the research results are mostly focused on the analysis of ordinary road sections, with less research on bridge accidents, especially cross-river bridge accidents. This makes it difficult to meet the accident analysis needs of cross-river bridges, which have unique risk characteristics such as long spans and high elevations.

[0006] Existing accident reporting and processing procedures for complex traffic nodes such as cross-river bridges are often time-consuming, failing to produce professional and actionable response plans in the immediate aftermath of an accident. Traditional methods rely heavily on manual screening, expert judgment, or offline statistical analysis, requiring tedious text annotation and multiple rounds of proofreading, resulting in excessively long report production cycles that cannot meet the urgent needs of on-site command centers for rapid response and timely decision-making. Furthermore, existing tools are inefficient in information extraction and correlation analysis when dealing with complex, multi-source information such as severe weather and vehicle dynamics, further delaying the emergency response process.

[0007] While large language models possess significant potential for natural language understanding and generation, their pre-training corpora are largely geared towards general scenarios and lack specialized knowledge support for key causal chains in bridge accidents. General models without specific fine-tuning often suffer from information omissions or overly general suggestions in such high-risk scenarios, failing to meet the needs of rapid, accurate, and actionable emergency response in special road sections such as cross-river bridges.

[0008] Therefore, this invention proposes an intelligent analysis method for traffic accidents on highway bridges spanning rivers that integrates local fine-tuning LLM. Summary of the Invention

[0009] The purpose of this invention is to provide an intelligent analysis method for traffic accidents on highway bridges spanning rivers, integrating locally fine-tuned LLM (Limited Language Model). First, it automatically and rapidly converts multi-source heterogeneous information, such as on-site text records and meteorological monitoring data, into structured input. Then, based on a constructed domain-specific corpus, it performs lightweight adaptation on a large language model, enabling it to possess professional causal inference and suggestion generation capabilities in bridge accident scenarios. Finally, through predefined decision templates, the model's output disposal plan is formatted in real-time into an executable control strategy. This method addresses the three requirements of efficient parsing, multi-factor correlation analysis, and rapid response, effectively improving the three major problems of existing technologies: slow report generation, insufficient professionalism, and difficulty in implementing suggestions. It provides a timely, accurate, and operable intelligent solution for emergency response to accidents on bridges spanning rivers and similar complex traffic nodes.

[0010] The specific technical solution adopted by this invention is as follows: A method for intelligent analysis of traffic accidents on highway bridges spanning rivers, incorporating locally fine-tuned LLM; comprising the following steps: Step 1: Extract targets from the acquired traffic report data, preprocess and optimize it to obtain a structured corpus dataset of responses; Step 1 includes the following specific steps: Step 11: Integrate accident reports: Effectively extract the content of traffic accident reports from a certain highway bridge across a river in 2024, and screen relevant descriptions of the traffic accidents, on-site handling methods, weather conditions on the day, and core influencing factors of on-site traffic accident photos; Step 12: Multivariate Data Annotation Processing: Analyze the above data to determine its causes and accident types. Using a combination of manual processing and code support, integrate and arrange the data into an initial JSONL text file according to the accident description, handling method, and labels of cause or accident type. Clean the data by compiling Python code to correct illegal formats, remove invalid characters compiled from non-UTF-8 encoding, and remove duplicate lines, consecutively repeated punctuation marks, and abnormal symbols. Step 13: Standardized Database Construction: First, the DeepSeek-R1-Distall-7B model was asked what preventative suggestions it could make based on the on-site accident descriptions in the text dataset. By providing system prompts, a relatively comprehensive response was obtained, and preliminary suggestions were derived. Secondly, the prevention suggestions generated by the model are manually corrected and optimized. First, while partially retaining the content framework of each response, meaningless, unoriginal, and ineffective suggestions are deleted, and prevention suggestions are re-formulated manually based on their positioning and content framework. Then, response suggestions that are short in content, lack hierarchy, or deviate from laws and regulations are thoroughly modified. Finally, these contents are integrated into the corresponding processing methods in the text dataset, and format conversion code is used to convert them into the Alpaca format suitable for LLaMA Factory, resulting in the final structured dialogue dataset.

[0011] Step 2: Upload the target dataset to the LLaMA Factory folder, access its WebUI page, and use the LLaMA Factory tools to set up fine-tuning parameters and train the model; Step 2 includes the following specific steps: Step 21: Local deployment of DeepSeek-R1-Qwen-Distill-7B; download the relevant model files from the HuggingFace website. Step 22: QLoRA data fine-tuning; Step 22 includes the following specific steps: Step 221: Store the dataset: Place the dataset in the data root directory of the LLaMA Factory folder and modify the dataset file; Step 222: Set training parameters: Launch the LLaMA Factory CLI via CMD to access its web UI fine-tuning training webpage and begin setting training parameters; The model uses the locally downloaded DeepSeek-R1-Qwen-Distill-7B file path, with LoRA as the fine-tuning method. The input is an uploaded dataset JSON file. The training phase is Supervised Fine-Tuning, with quantization level 4, quantization method bnb, acceleration method auto, learning rate 5e-5, training epochs 3, maximum training norm 1, maximum sample size 100,000, computation type bf16, cutoff length 2048, gradient accumulation 4, validation set ratio 0.1, warm-up steps 50, and learning rate scheduler set to cosine. The parameters for the QLoRA method are: LoRA rank is 8, LoRA scaling factor is 32, number of trainable layers is 2, LoRA random dropout is 0.3, and LoRA + learning rate ratio is 8. Step 223: Post-training Detection and Correction: After setting the parameters in the LLaMA Factory training section, start fine-tuning the training. At the same time, fine-tuning commands and logs will appear in the CMD, showing the fine-tuning progress and the usage of computing resources such as GPU memory. As the fine-tuning is completed, the model will be loaded in the chat section to verify the training effect. If the effect is not obvious, the parameters will be reset according to the model fine-tuning feedback and running commands provided by the system.

[0012] Step 23: Fine-tuning the model: In the export section, load the most recently fine-tuned model and export the model file to your local machine. Write a Python script to call the file, implement basic chat functionality, fill in the file save path, and run the program. You can then use the model's reasoning and information retrieval and integration capabilities to request traffic accident prevention suggestions outside the model's training set.

[0013] Step 3: Construct a multi-dimensional scoring system by combining weight allocation, and use text vectorization, keyword matching, cosine similarity calculation, and statistical testing methods to quantitatively evaluate and visually compare the suggestions given by the model before and after fine-tuning; Step 3 includes the following steps: Step 31: Data Loading and Text Reading: Read data from the JSONL file and store the suggestions before and after fine-tuning into cell arrays respectively; Step 32: Quantify the richness of detail in the recommendations using the specificity scoring formula; In the formula, ; ; ; Based on the visualization constants; This is a weight vector used to assign weights based on specificity, operability, and relevance. This is the sub-item score vector, with each sub-item ranging from [0,1]. Step 33: Evaluate the feasibility of implementing the recommendations using the feasibility scoring formula; In the formula, Used to detect verbs; Used to quantify the number of indicators; The presence of a responsible party serves as a marker for keyword detection; when a responsible party exists, ;otherwise ; Step 34: Measure the relevance of the recommendations to the highway accident handling scenario using a relevance scoring formula; Step 34 includes the following specific steps: Step 341: Construct the vocabulary: Step 342: Text Vectorization: In the formula, This is an indicator function used to count word frequencies; Step 343: Keyword Vectorization: Step 344: Keyword Matching Count: Step 345: Calculate cosine similarity: In the formula, Cosine similarity; This is a text word frequency vector based on the word segmentation results; These are keyword vectors from highwayKeywords; The number of keywords matched; Step 346: Calculate the relevance score: ; Step 35: Calculate the weighted sum of the scores for the three dimensions of specificity, operability, and relevance to obtain the comprehensive score; In the formula, ; ; ; Based on the visualization constants; This is a weight vector used to assign weights based on specificity, operability, and relevance. This is the sub-item score vector, with each sub-item ranging from [0,1]. Step 36: Compare the statistical significance of the difference in scores before and after fine-tuning using a t-test. In the formula, The mean of the scores before fine-tuning; This is the mean of the scores after fine-tuning; This is the standard deviation before fine-tuning; This is the adjusted standard deviation; For sample size; Degrees of freedom are used to determine The critical value of the distribution; Step 37: Display the distribution of the two sets of scores using a box plot; the distribution of the two sets of scores includes the median, dispersion, and outliers, and outputs the mean score, standard deviation, and test results.

[0014] The technical effects achieved by this invention are as follows: This invention first automatically and rapidly converts heterogeneous information from multiple sources, such as on-site text records and meteorological monitoring data, into structured input. Then, based on a constructed domain-specific corpus, it performs lightweight adaptation on a large language model, enabling it to possess professional causal inference and suggestion generation capabilities in bridge accident scenarios. Finally, through predefined decision templates, the model's output disposal plan is formatted in real-time into an executable control strategy for the site. This solution addresses the three requirements of efficient parsing, multi-factor correlation analysis, and rapid response, effectively improving the three major problems of existing technologies: slow report generation, insufficient professionalism, and difficulty in implementing suggestions. It provides a timely, accurate, and operable intelligent solution for emergency response to accidents on cross-river bridges and similar complex traffic nodes. Attached Figure Description

[0015] Figure 1 This is a logical block diagram of the technical route of this invention; Figure 2 This is a schematic diagram of the technical route of the present invention; Figure 3 This is a screenshot of the code that is being used in this invention; Figure 4 This is a schematic diagram of the first example of the present invention; Figure 5 This is a schematic diagram of the second example of the present invention; Figure 6 This is a schematic diagram of an example dataset of the present invention; Figure 7 This is a schematic diagram comparing the suggested quality before and after the fine-tuning of this invention. Detailed Implementation

[0016] To make the objectives and advantages of this invention clearer, the invention will be specifically described below with reference to embodiments. It should be understood that the following text is merely used to describe one or more specific embodiments of the invention and does not strictly limit the scope of protection specifically claimed by the invention.

[0017] like Figure 1 as well as Figure 2 As shown, a method for intelligent analysis of traffic accidents on highway bridges across rivers, integrating local fine-tuning LLM, is implemented as follows: Figure 4 As shown, it includes, for example, the following steps.

[0018] Step 1: Using the 2024 traffic weekly report of a certain highway cross-river bridge as the core material source, process and optimize its massive information to obtain key materials suitable for fine-tuning training of the LLaMA Factory framework.

[0019] Step 11: Accident Report Integration: Traffic reports contain numerous factors that influence accident occurrences, including daily traffic flow on each road segment, daily road maintenance status, and weather forecasts. To ensure the model's attention is efficiently focused on key factors, extract the most critical influencing factors from the report: weather conditions, a brief description of the entire accident occurrence and handling process, and on-site accident photos.

[0020] Step 12: Multi-source data annotation processing: Analyze the above data to obtain its causes and accident types, and integrate these contents into JSONL data text that is easy for the model to read and understand in the form of "accident description + handling method + cause or accident type label", and use Python code to unify the format.

[0021] Based on this, cleaning code is added to remove abnormal characters and irrelevant content that are not compiled using UTF-8 from the JSONL format file content, ensuring that the data is clean, the format is neat, and the text structure is consistent for easy subsequent processing and management.

[0022] Step 13: Standardize Database Construction: First, obtain preliminary suggestions using DeepSeek-R1-Distall-7B. Upload the pre-processed text dataset to the open-source DeepSeek-R1-Distall-7B platform. Set system prompts and ask the model for preventative suggestions based on the description, tags, and handling process of the incident, repeating this process until the system provides a comprehensive response. The following is an example of one of the model's responses: {"messages": [{"role": "system", "content": "You are an expert in the field of transportation operations"}, {"role": "user", "content": "

Fire Situation

[0023] Technical monitoring: An intelligent monitoring system for early fire warning is deployed by installing infrared thermal imaging cameras under the median strip of the bridge; covering a radius of 50 meters, it monitors temperature anomalies in real time; it automatically alarms when the temperature is ≥80℃; and with the help of AI image recognition algorithms, it can distinguish between combustion smoke and ordinary cooking smoke; combustion smoke is characterized by a sharp increase in PM2.5 / CO concentration.

[0024] Emergency Response: Shorten response time and reduce losses. Configure bridge-specific fire extinguishing equipment: Equip maintenance vehicles with high-pressure water mist spray devices to cool and prevent fires from spreading on bridge metal structures; stockpile fire-retardant coating quick-repair kits for emergency protection of minor burn areas.

[0025] Long-term management: Enhancing bridge durability and disaster resistance. Strengthening bridge structural safety through regular corrosion inspections: Quarterly infrared thermal imaging scans of the bridge's exterior surface to detect coating damage or steel reinforcement corrosion. Using this as a template, carefully examine each piece of content, eliminate any erroneous or meaningless replies, supplement them with new text based on their logical framework, and expand each appropriate reply.

[0026] Secondly, the model-generated suggestions undergo comprehensive review, evaluation, correction, and improvement by human reviewers. First, the model's suggestions at each level—including drivers, vehicles, road surfaces, and traffic systems—are retained, but those that are vague, outdated, or lack effectiveness are identified and revised manually based on their respective levels. Second, some responses that are too brief or contradict relevant laws and regulations are completely rewritten. Finally, these are integrated and converted using Python code into the Alpaca format, which is compatible with LLaMA Factory.

[0027] Step 2: After completing the above steps, we obtain the final training dataset. We then fully utilize the simple, efficient, and modular fine-tuning training tool, LLaMA Factory, to train the DeepSeek-R1-Qwen-Distill-7B pre-trained model. Step 21: Local deployment of DeepSeek-R1-Qwen-Distill-7B. Download the relevant model files from the HuggingFace website.

[0028] Step 22: Detailed process of fine-tuning QLoRA data.

[0029] Step 221: Store the dataset in the data folder of LLaMA Factory and modify the dataset file to add dataset information. Only then is the data upload complete.

[0030] Step 222: Access the LLaMA Factory's web UI main page via CMD coding using the CLI, and any operations performed on it will run as command lines in CMD. You can then begin setting fine-tuning parameters on the main page.

[0031] First, let's set up the basic components. The model chosen is DeepSeek-R1-Qwen-Distill-7B, and the file path is the locally saved path. In the data directory on the page, select the recently uploaded training dataset as input. The fine-tuning method chosen is LoRA. LoRA achieves efficient fine-tuning by inserting a small number of trainable low-rank matrices (A, B) next to the pre-trained model weights, optimizing only these low-rank parameters, significantly reducing GPU memory and computational cost. After fine-tuning, the low-rank matrices can be merged with the original weights, resulting in no additional inference latency during deployment.

[0032] Secondly, the training parameters are set. The current training method is Supervised Fine-Tuning with a learning rate of 5e-5, controlling the step size of weight adjustments with each gradient update to ensure training stability. The number of training epochs is 3, allowing the model to fully learn the dataset before overfitting and preventing it to some extent. The maximum gradient norm is 1 to prevent gradient explosion. The maximum number of samples is 100,000 to ensure manageable training time. Bf16 mixed-precision training is used, significantly reducing underflow / overflow issues caused by insufficient numerical range during training; gradient vanishing / exploding is also less common, resulting in better training stability. The stage length is 2048, defining the maximum token sequence length the model can handle. Gradient accumulation is 4, alleviating the difficulty of selecting larger training batches due to insufficient GPU memory. The validation set ratio is 0.1, providing a reference for drawing the loss graph, facilitating subsequent tracking of model training progress and effects, and adjusting training parameters. The learning rate adjuster is cosine, resulting in better final model performance and a smoother convergence process. The warm-up steps are set to 50 to allow the model to "warm up" stably in the early stages of training, avoiding instability caused by using a large learning rate to shock the model at the beginning.

[0033] Finally, let's discuss the QLoRA parameter settings. The quantization method is bnb, and the quantization level is 4. This is a core component of QLoRA, primarily chosen to balance saving GPU memory resources with performance. The LoRA rank (lora_r) is 8, achieving a good balance between performance and parameter count. A larger lora_r might result in better fitting but slightly higher training costs, while a smaller lora_r saves more resources but might limit the model's adaptability. The LoRA scaling factor is 32, conforming to the recommended ratio and effectively enhancing the influence of the low-rank matrix on model parameters. The number of trainable layers is 2. Only the last two layers of the Transformer (usually the last two Decoder layers) are inserted with low-rank adapters and participate in training, while the remaining layers remain frozen, achieving significant results with minimal changes. The LoRA dropout ratio is 0.3, improving model generalization ability. However, the risk of overfitting on small datasets is extremely high, requiring stronger regularization. The LoRA+ learning rate ratio is 8, consistent with the core idea and principles of LoRA+, significantly accelerating adapter convergence and reducing the risk of overfitting.

[0034] Step 223: After configuring all parameters, you can start fine-tuning the model. At this time, commands will be executed in CMD, and the running log will be updated every certain number of steps on the main page, reporting the detailed process, status, and performance of model fine-tuning. The running progress and the computing resources consumed are also displayed in the form of a progress bar. The curve loss graph of the validation set and the current model will also appear on the right. In the chat section, you can load the model that has just been fine-tuned to compare and verify the fine-tuning effect. If it is not obvious or overfitting occurs, you can return to the training section to reset the parameters according to the performance feedback and training process.

[0035] Step 23: In the export section, enter the local path for exporting. This will export the fine-tuned model to the specified local path. The system will also merge the model's LoRA adapter into the model, which includes all the files needed for normal model use, such as tokenizer and config files. Write Python code to load and call the model locally, enabling it to answer questions in context, achieve streaming output, and demonstrate its thought process. Simply modify the model's local save path in the code, and the code can read and call it to achieve dialogue in VS Code. See the specific code examples below. Figure 3 illustrate: When modifying code in VS Code, simply fill in the save path in the "Change to your path" section.

[0036] Running the code will bring up a dialog box in the terminal. Enter the text from the traffic report describing the accident and its handling to receive preventative advice and dialogue regarding the accident.

[0037] Step 3: Construct a multi-dimensional scoring system by combining weight allocation, and use text vectorization, keyword matching, cosine similarity calculation and statistical testing methods to quantitatively evaluate and visually compare the suggestions given by the model before and after fine-tuning.

[0038] Step 31: Data Loading and Text Reading: Read data from the JSONL file and store the suggestions before and after fine-tuning into cell arrays respectively.

[0039] Step 32: Quantify the richness of detail in the recommendations using the specificity scoring formula.

[0040] In the formula, ; ; ; Based on the visualization constants; This is a weight vector used to assign weights based on specificity, operability, and relevance. This is the sub-item score vector, and each sub-item ranges from [0,1].

[0041] Step 33: Assess the feasibility of implementing the recommendations using the operability scoring formula.

[0042] In the formula, Used to detect verbs; Used to quantify the number of indicators; The presence of a responsible party serves as a marker for keyword detection; when a responsible party exists, ;otherwise .

[0043] Step 34: Measure the relevance of the recommendations to the highway accident handling scenario using a relevance scoring formula.

[0044] Step 341: Construct the vocabulary: Step 342: Text Vectorization: In the formula, This is an indicator function used to count word frequencies.

[0045] Step 343: Keyword Vectorization: Step 344: Keyword Matching Count: Step 345: Calculate cosine similarity: In the formula, Cosine similarity; This is a text word frequency vector based on the word segmentation results; These are keyword vectors from highwayKeywords; The number of keywords matched.

[0046] Step 346: Calculate the relevance score: Step 35: The scores for the three dimensions of specificity, operability, and relevance are weighted and summed to obtain the comprehensive score.

[0047] In the formula, ; ; ; Based on the visualization constants; This is a weight vector used to assign weights based on specificity, operability, and relevance. This is the sub-item score vector, and each sub-item ranges from [0,1].

[0048] Step 36: Compare the statistical significance of the difference in scores before and after fine-tuning using a t-test. In the formula, The mean of the scores before fine-tuning; This is the mean of the scores after fine-tuning; This is the standard deviation before fine-tuning; This is the adjusted standard deviation; For sample size; Degrees of freedom are used to determine The critical value of the distribution.

[0049] Step 37: Display the distribution of the scores of the two groups (median, dispersion, outliers) using a box plot, and output the mean score, standard deviation, and test results.

[0050] This invention addresses the gap in accident analysis for special sections of cross-river bridges. The technical means of this invention are as follows: A tagged structured corpus of "accident description-handling suggestions" is constructed, which is then transformed into JSONL data text that is easy for the model to read and understand. Further, by adding "weather-accident" tags, such as the combination of "dense fog + crosswind," the model is guided to focus on the unique risk factors of the cross-river bridge, and the model is locally fine-tuned to adapt to special scenarios. Specific data formats are as follows: Figure 6 As shown: Technical effects of this invention: Improved adaptability of the model to different domains: The accuracy of identifying special risk characteristics of cross-river bridges such as "long span and strong closure" is improved by more than 40%; Compared with traditional knowledge graph methods, the depth of accident pattern mining is enhanced, and the accident rate per unit mileage is reduced by 15%-20%.

[0051] To address the issues of low processing efficiency and insufficient comprehensiveness of unstructured accident reports, this invention employs the following technical means: locally deploying the DeepSeek-R1-7B model and using LLaMAFactory for lightweight fine-tuning, and training with specific parameters such as learning rate and number of training rounds. This supports multi-source data fusion and can further build a vehicle-road cooperative platform.

[0052] The technical effects of this invention are as follows: a leap in data processing efficiency: the speed of accident report parsing is increased by about 5 times; within 48 minutes to 10 minutes, the analysis error rate is less than 3%, the generation of response strategies is real-time, and the delay in rescue response is reduced by 30%.

[0053] Improved efficiency of multi-factor correlation analysis: Through the fusion and analysis of multi-source data, the model can provide more comprehensive opinions after training.

[0054] This invention addresses the needs for data privacy protection and localized deployment. Technical means include: local deployment of the private model to prevent the leakage of sensitive raw data, while reducing resource consumption and training energy consumption compared to full parameter fine-tuning. Technical effects include: enhanced privacy and security: zero outbound transmission of sensitive traffic data, meeting the requirements of the "Transportation Data Security Specification," and providing a trusted infrastructure for cross-regional federated learning.

[0055] To address the shortcomings of accident prevention strategies in terms of practicality and operability, this invention employs an innovative multi-dimensional quantitative weighted evaluation system. This system determines the specificity, operability, and relevance of suggestions based on the frequency of keyword occurrences, and utilizes a formula... The combined score of the two recommendations was calculated, and the recommendations before and after were compared to verify the effectiveness of the fine-tuning. The quality comparison of the recommendations before and after the fine-tuning is as follows: Figure 7 As shown: Technical effect: The quality of strategy recommendations has been significantly improved: For example... Figure 7 The results shown and statistical tests confirm that the locally fine-tuned model generated higher scores (p<0.05) for its prevention and control strategy recommendations in all three core dimensions: specificity, operability, and relevance. The recommendations are more detailed, the steps are clearer, the responsible parties are more clearly defined, and the quantitative indicators are more specific, and they are highly aligned with the actual needs of handling accidents on cross-river bridges.

[0056] Closed-loop validation and continuous optimization foundation: The quantitative evaluation system provides objective and measurable validation standards for model performance, forming a closed loop of "generation-evaluation-feedback (implicit optimization)" and providing data support for the continuous iteration and optimization direction of the subsequent model.

[0057] This patent aims to address three major pain points in cross-river bridge accident analysis—namely, the lack of data processing and the difficulty in implementing strategies—through a three-tiered technical chain: "construction of a professional domain corpus → local fine-tuning of a lightweight model → algorithm verification of strategy effectiveness." This will enable a quantifiable reduction in the accident rate of high-speed cross-river bridges and a paradigm shift in prevention and control.

[0058] It is projected that the system will significantly improve economic benefits. Based on the estimated 20% reduction in accidents per cross-river bridge annually, each bridge could directly prevent 2-3 deaths per year. This 20% reduction in accidents annually would directly save 6.96 million yuan. With each bridge preventing an average of 2-3 deaths per year, the province's direct economic losses would be reduced by 6.96 million yuan.

[0059] As shown in the specific embodiments of this patent, in order to verify the performance of the DeepSeek large language model after fine-tuning and local deployment in practical applications, we simulated two typical traffic accident scenarios on highway bridges across rivers for testing.

[0060] In the first example, such as Figure 4 As shown, for rear-end collisions caused by "failure to maintain a safe following distance", the model not only identifies the direct cause, but also deeply analyzes the intertwined factors such as vehicle speed, driver reaction time, and road conditions through a systematic thinking process. Finally, it outputs specific and actionable prevention suggestions from seven dimensions, including driver awareness, vehicle performance, and road facilities, such as installing monitoring radar and setting up warning zones.

[0061] In the second example regarding the collision caused by "slippery roads in rainy weather and excessive speed," such as... Figure 5 As shown, the model accurately identifies the core risks of low visibility and increased braking distance in rainy weather, and then proposes a comprehensive solution encompassing technologies such as emergency driving training, upgrading vehicle anti-skid equipment, and introducing intelligent monitoring systems. These two embodiments fully demonstrate that the method of this invention can transform a brief accident description into a deep, structured, and highly operational professional analysis report, significantly improving the efficiency, professionalism, and decision support value of accident analysis, and effectively solving the problems of slow report generation, insufficient professionalism, and difficulty in implementing recommendations in the background technology. The above description is merely a preferred embodiment of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention. Structures, devices, and operating methods not specifically described or explained in this invention are implemented according to conventional methods in the art unless otherwise specified or limited.

Claims

1. A method for intelligent analysis of traffic accidents on highway bridges spanning rivers, incorporating locally fine-tuned LLM, characterized in that: Includes the following steps: Step 1: Extract the target from the acquired traffic report data, preprocess and optimize it to obtain a structured corpus dataset of responses; Step 2: Upload the target dataset to the LLaMA Factory folder, access its WebUI page, and use the LLaMA Factory tools to set up fine-tuning parameters and train the model; Step 3: Construct a multi-dimensional scoring system by combining weight allocation, and use text vectorization, keyword matching, cosine similarity calculation and statistical testing methods to quantitatively evaluate and visually compare the suggestions given by the model before and after fine-tuning.

2. The intelligent analysis method for traffic accidents on highway bridges across rivers, which integrates local fine-tuning LLM, as described in claim 1, is characterized in that: Step 1 includes the following specific steps: Step 11: Integrate accident reports: Effectively extract the content of traffic accident reports from historical highway cross-river bridges, and screen relevant descriptions of the traffic accidents, on-site handling methods, weather conditions on the day, and core influencing factors of on-site traffic accident photos; Step 12: Multivariate data annotation processing: Analyze the above data to obtain its causes and accident types, and integrate and arrange the initial JSONL data text by manually adding accident description, handling method and cause or accident type tags. Data is cleaned by compiling Python code, which corrects illegal formats in the dataset, removes invalid characters compiled from non-UTF-8 encoding, and removes duplicate lines, consecutively repeated punctuation marks, and abnormal symbols. Step 13: Standardized Database Construction: First, the DeepSeek-R1-Distall-7B model was asked what preventative suggestions it could make based on the on-site accident descriptions in the text dataset. By providing system prompts, a relatively comprehensive response was obtained, and preliminary suggestions were derived. Secondly, the prevention suggestions generated by the model are manually corrected, improved and optimized; firstly, while partially retaining the content framework of each answer, meaningless, unoriginal and ineffective suggestions are deleted, and prevention suggestions are re-formulated manually according to their positioning and content framework; Then thoroughly revise any responses that are too brief, lack structure, or contradict laws and regulations. Then, this content is integrated into the corresponding processing methods in the text dataset, and through format conversion code, it is transformed into the Alpaca format suitable for LLaMA Factory, resulting in the final structured dialogue dataset.

3. The intelligent analysis method for traffic accidents on highway bridges across rivers, which integrates local fine-tuning LLM, as described in claim 1, is characterized in that: Step 2 includes the following specific steps: Step 21: Local deployment of DeepSeek-R1-Qwen-Distill-7B; download the relevant model files from the HuggingFace website. Step 22: Fine-tuning QLoRA data; Step 23: Fine-tuning the model: In the export section, load the most recently fine-tuned model and export the model file to your local machine. Write a Python script to call the file, implement basic chat functionality, fill in the file save path, and run the program. You can then use the model's reasoning and information retrieval and integration capabilities to request traffic accident prevention suggestions outside the model's training set.

4. The intelligent analysis method for traffic accidents on highway bridges across rivers, which integrates local fine-tuning LLM, as described in claim 3, is characterized in that: Step 22 includes the following specific steps: Step 221: Store the dataset: Place the dataset in the data root directory of the LLaMA Factory folder and modify the dataset file; Step 222: Set training parameters: Launch the LLaMA Factory CLI via CMD to access its web UI fine-tuning training webpage and begin setting training parameters; The model uses the locally downloaded DeepSeek-R1-Qwen-Distill-7B file path, with LoRA as the fine-tuning method. The input is an uploaded dataset JSON file. The training phase is Supervised Fine-Tuning, with quantization level 4, quantization method bnb, acceleration method auto, learning rate 5e-5, training epochs 3, maximum training norm 1, maximum sample size 100,000, computation type bf16, cutoff length 2048, gradient accumulation 4, validation set ratio 0.1, warm-up steps 50, and learning rate scheduler set to cosine. The parameters for the QLoRA method are: LoRA rank is 8, LoRA scaling factor is 32, number of trainable layers is 2, LoRA random dropout is 0.3, and LoRA + learning rate ratio is 8. Step 223: Post-training detection and correction: After setting the parameters in the LLaMA Factory training section, start fine-tuning the training. At the same time, fine-tuning commands and logs will appear in the CMD, showing the fine-tuning progress and the usage of computing resources such as GPU memory. As the fine-tuning is completed, the model will be loaded in the chat section to verify the training effect based on the loss graph of the training process. If the effect is not obvious, reset the parameters according to the model fine-tuning feedback and running commands provided by the system.

5. The intelligent analysis method for traffic accidents on highway bridges across rivers, which integrates local fine-tuning LLM, as described in claim 4, is characterized in that: Step 3 includes the following steps: Step 31: Data Loading and Text Reading: Read data from the JSONL file and store the suggestions before and after fine-tuning into cell arrays respectively; Step 32: Quantify the richness of detail in the recommendations using the specificity scoring formula; In the formula, ; ; ; Based on the visualization constants; This is a weight vector used to assign weights based on specificity, operability, and relevance. This is the sub-item score vector, with each sub-item ranging from [0,1]. Step 33: Evaluate the feasibility of implementing the recommendations using the feasibility scoring formula; In the formula, Used to detect verbs; Used to quantify the number of indicators; The presence of a responsible party serves as a marker for keyword detection; when a responsible party exists, ;otherwise ; Step 34: Measure the relevance of the recommendations to the highway accident handling scenario using a relevance scoring formula; Step 35: Calculate the weighted sum of the scores for the three dimensions of specificity, operability, and relevance to obtain the comprehensive score; In the formula, ; ; ; Based on the visualization constants; This is a weight vector used to assign weights based on specificity, operability, and relevance. This is the sub-item score vector, with each sub-item ranging from [0,1]. Step 36: Compare the statistical significance of the difference in scores before and after fine-tuning using a t-test. In the formula, The mean of the scores before fine-tuning; This is the mean of the scores after fine-tuning; This is the standard deviation before fine-tuning; This is the adjusted standard deviation; For sample size; Degrees of freedom are used to determine The critical value of the distribution; Step 37: Display the distribution of the two sets of scores using a box plot; the distribution of the two sets of scores includes the median, dispersion, and outliers, and outputs the mean score, standard deviation, and test results.

6. The intelligent analysis method for traffic accidents on highway bridges across rivers, which integrates local fine-tuning LLM, as described in claim 5, is characterized in that: Step 34 includes the following specific steps: Step 341: Construct the vocabulary: Step 342: Text Vectorization: In the formula, This is an indicator function used to count word frequencies; Step 343: Keyword Vectorization: Step 344: Keyword Matching Count: Step 345: Calculate cosine similarity: In the formula, Cosine similarity; This is a text word frequency vector based on the word segmentation results; These are keyword vectors from highwayKeywords; The number of keywords matched; Step 346: Calculate the relevance score: 。

Citation Information

Patent Citations

  • Highway traffic accident risk assessment method based on multi-model fusion

    CN118211176A