Traffic emergency command retrieval enhancement generation method based on static and dynamic double-layer knowledge base enhancement

CN122507769APending Publication Date: 2026-08-04FUJIAN PINGTAN RUIQIAN INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610620515.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-08
Publication Date
2026-08-04

Smart Images

  • Figure CN122507769A_ABST
    Figure CN122507769A_ABST
Patent Text Reader

Abstract

The application discloses a traffic emergency command retrieval enhancement generation method based on static and dynamic double-layer knowledge base enhancement. In view of the problems of existing RAG technology, such as static and dynamic knowledge splitting, lack of regulation constraints and strategy verification, a static knowledge base including a basic regulation sub-library and a historical case sub-library, and a dynamic knowledge base including a real-time situation sub-library and a prediction and deduction sub-library are constructed; a four-level knowledge graph of events, scenes, strategies and effects is established; after receiving an emergency event, multi-dimensional timeliness activation weights including emergency degree, freshness, spatial correlation and historical similarity are calculated to activate dynamic knowledge, and cross-layer attention mechanism is used to associate static knowledge for multi-target fusion sorting; the fused knowledge is input into a large language model, candidate strategies are generated by combining regulation Trie tree constraint decoding; and the optimal strategy is output after sand table deduction and evaluation by a traffic digital twin model, and feedback closed-loop optimization is carried out based on actual disposal effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information technology, and in particular to a traffic emergency command retrieval enhancement generation method based on a static and dynamic dual-layer knowledge base. Background Technology

[0002] With the rapid development of Large Language Model (LLM) technology, Retrieval-Augmented Generation (RAG) has become an important technical approach to improve the accuracy, timeliness, and interpretability of model output. RAG combines external knowledge bases with the generative model, introducing retrieval results relevant to the user's query during the generation phase. This effectively alleviates the inherent "illusion" problem of large language models and empowers the model to access real-time or domain-specific knowledge.

[0003] Currently, RAG technology has been initially applied in areas such as general question answering, medical diagnosis, and legal consultation. In the transportation industry, some research institutions and operating units are experimenting with applying RAG technology to scenarios such as traffic regulation queries, historical case retrieval, and routine business consultations. By building a traffic-related knowledge base, they are enabling the retrieval and generation of static knowledge such as the meaning of traffic signs, violation penalty standards, and routine maintenance specifications. For example, a traffic regulation knowledge base built based on a vector database can retrieve relevant regulatory clauses and generate explanatory answers based on natural language queries input by users.

[0004] Traffic emergency command is one of the most demanding scenarios in the transportation industry in terms of knowledge application. Sudden events on highways and urban roads (such as chain-reaction collisions caused by severe weather, hazardous chemical leaks, and major traffic accidents) are characterized by their suddenness, high timeliness, strong regulatory constraints, and the need for multi-source heterogeneous data fusion. The formulation of emergency response strategies not only relies on static legal regulations, emergency plans, and historical case studies, but also requires deep integration of dynamic data such as real-time traffic flow conditions, weather conditions, structured information from video surveillance, and the location of rescue resources.

[0005] In traffic emergency command scenarios, any decision-making error or response delay can directly lead to secondary accidents, the spread of traffic congestion, or even casualties. Therefore, this field places much higher technical demands on the timeliness of knowledge retrieval, the accuracy of knowledge fusion, the compliance of generation strategies, and the verifiability of strategy execution than in general RAG scenarios.

[0006] However, existing search-enhanced generation technologies suffer from key technical problems in the field of traffic emergency command, such as the separation of static and dynamic knowledge, lack of multi-dimensional correlation, absence of regulatory constraints, and insufficient strategy verification. These issues fail to meet the urgent needs of the transportation industry for timely, compliant, and reliable emergency decision-making. Summary of the Invention

[0007] The purpose of this invention is to solve the above-mentioned problems by providing a traffic emergency command retrieval enhancement generation method based on a static and dynamic dual-layer knowledge base.

[0008] The technical solution of this application is implemented as follows: A traffic emergency command retrieval enhancement generation method based on a static and dynamic dual-layer knowledge base is characterized by the following steps: S1. Construct a static knowledge base, which includes a basic regulations sub-base and a historical case sub-base. The basic regulations sub-base is used to store vectorized representations of traffic regulations and emergency plans, and the historical case sub-base is used to store vectorized representations of historical emergency response cases. S2, Construct a dynamic knowledge base, which includes a real-time situation sub-base and a prediction and inference sub-base. The real-time situation sub-base is used to cache real-time vectorized data of traffic flow data, meteorological data and event messages in a streaming manner. The prediction and inference sub-base is used to store vectorized data of future situation predictions generated based on traffic simulation models. S3. Establish a four-level knowledge graph of event-scene-strategy-effect. The nodes of the knowledge graph include event nodes, scene nodes, strategy nodes and effect nodes. Adjacent level nodes are associated through directed edges with confidence weights to form a bidirectional association link between static and dynamic knowledge. S4, receive emergency event messages, perform multi-dimensional analysis on the emergency event messages, and obtain event type, event level, spatiotemporal attributes and environmental conditions; S5. Based on the multi-dimensional analysis results, calculate the multi-dimensional timeliness activation weight of the dynamic knowledge slice. The multi-dimensional timeliness activation weight includes urgency factor, freshness factor, spatial relevance factor and historical similarity factor. Activate the relevant knowledge slice in the dynamic knowledge base based on the multi-dimensional timeliness activation weight. S6, based on the activated knowledge slices, retrieve the associated static knowledge through the four-level knowledge graph, and perform multi-objective fusion sorting on the dynamic knowledge and static knowledge to obtain the fused knowledge sequence; S7, input the fused knowledge sequence into the large language model, and combine it with the constraint decoding mechanism based on the legal prefix tree to generate multiple candidate emergency response strategies; S8. Input the multiple candidate emergency response strategies into the traffic digital twin model for sand table simulation, and select the optimal strategy for output based on the simulation evaluation indicators.

[0009] As a further improvement, in step S1, the basic legal sub-library is stored in a hierarchical structure according to the level of legal validity, applicable scenarios and the timeliness of the clauses, and an index for resolving conflicts between legal clauses is established; the historical case sub-library is encoded using multi-label vectorization according to event type, handling result, scope of impact and spatiotemporal characteristics.

[0010] As a further improvement, in step S2, the real-time situation sub-library adopts a sliding time window mechanism to manage data timeliness, and the window duration is adaptively adjusted according to the event level; the prediction and inference sub-library is periodically updated through an online traffic simulation model, and the inference time granularity is negatively correlated with the urgency of the event.

[0011] As a further improvement, in step S3, the construction of the fourth-level knowledge graph includes: The event node includes accident type, vehicle type, weather conditions, and event level labels; The scene nodes include road level, traffic flow, surrounding facilities, and spatial topology tags; The strategy node includes control measures, rescue routes, information dissemination plans, and resource allocation tags; The effect nodes include congestion dissipation time, secondary accident risk value, and social impact assessment labels; The confidence weights between adjacent level nodes are determined by combining historical case statistics and expert knowledge annotation.

[0012] As a further improvement, in step S5, the multidimensional timeliness activation weight is calculated using the following formula: ,in, Based on the calculation of event level and risk of casualties, Calculated based on the difference between the data timestamp and the current time. Calculated based on the geographical distance and road topology relationship between the event location and the data spatial source. Vector similarity calculation based on current event features and historical cases; , The coefficients are adaptive and dynamically adjusted according to the event handling stage and distance. β and δ are the freshness weight coefficient and the historical similarity weight coefficient, respectively.

[0013] As a further improvement, in step S6, the multi-objective fusion sorting adopts a static-dynamic knowledge coupling sorting algorithm, including: Calculate the freshness score, spatial coverage score, and inference credibility score of dynamic knowledge; calculate the authority score, scenario matching score, and historical success rate score of static knowledge. The correlation strength score between dynamic knowledge and static knowledge is calculated using a cross-layer attention mechanism; Based on the above scores, a weighted fusion or Pareto optimal solution is performed to generate the fused knowledge sequence.

[0014] As a further improvement, in step S7, the constraint decoding mechanism based on the regulatory prefix tree includes: The mandatory and prohibitive clauses in the basic regulations sub-library are constructed into a Trie tree constraint structure; At each step of the autoregressive decoding of the large language model, the current token sequence is matched with the Trie tree; If a prohibited path is matched, the logits probability of the corresponding token is dynamically blocked; if a mandatory path is matched, the sampling probability of the corresponding token is increased to ensure that the generated candidate strategy does not violate mandatory legal provisions.

[0015] As a further improvement, in step S8, the sand table simulation includes: The candidate strategies are parsed into the control inputs of the traffic simulation model, and the control inputs include lane closure, speed limit, traffic light timing, and rescue route. Run microscopic traffic simulations in a digital twin environment to simulate traffic evolution over a predetermined future time period; Calculate and evaluate the simulation indicators, which include congestion dissipation time, secondary accident risk value, rescue arrival time, economic cost and social impact index; The optimal strategy is selected by using multi-indicator weighted scoring or constraint satisfaction screening.

[0016] As a further improvement, the method also includes step S9, feedback closed-loop optimization: Collect data on the effectiveness of actual emergency response and calculate actual evaluation indicators; Compare the deviations between the actual evaluation indicators and the predicted indicators from the sand table simulation; When the deviation exceeds a preset threshold, the online correction of the confidence weights of the relevant edges in the fourth-level knowledge graph, the recoding of the corresponding case vectors in the historical case sub-library, and the gradient update of the adaptive coefficients in the multi-dimensional timeliness activation weights are triggered.

[0017] The advantages or beneficial effects of the above technical solutions include at least the following: (1) Achieving deep integration of static experience and real-time situation. This invention constructs a static and dynamic dual-layer knowledge base and a four-level knowledge graph of events, scenarios, strategies, and effects. It performs structured association modeling of offline stored regulations and cases with online access dynamic data such as traffic flow, weather, and prediction, overcoming the defect of static and dynamic knowledge separation in the existing RAG system. This makes the generated emergency strategies have both the authority of historical experience and the relevance of the on-site situation.

[0018] (2) Multi-dimensional and precise activation and ranking of emergency knowledge has been achieved. This invention activates weights based on multiple dimensions of timeliness, such as urgency, freshness, spatial relevance, and historical similarity, and introduces coefficients that are adaptively adjusted according to the stage of disposal and spatial distance. This enables refined value assessment and priority ranking of dynamic knowledge slices, ensuring that key information with high timeliness and high spatial relevance enters the retrieval sequence first, and effectively avoiding interference from irrelevant or outdated data on decision-making.

[0019] (3) Achieved regulatory-level compliance hard constraints for the generation strategy. This invention constructs mandatory and prohibitive legal provisions into a Trie tree constraint structure and embeds it into the autoregressive decoding process of a large language model. At the token level, it implements probability shielding for prohibited paths and probability enhancement for mandatory paths, fundamentally eliminating the risk of generated content violating mandatory traffic regulations and significantly reducing the legal compliance risk of traffic operators.

[0020] (4) Digital pre-verification of emergency response strategies has been achieved. This invention resolves candidate strategies as control inputs to a traffic simulation model, runs micro-traffic simulation in a digital twin environment, and performs quantitative evaluation and selection based on multi-dimensional indicators such as congestion dissipation time, secondary accident risk value, and rescue arrival time, forming a "simulation first, execution later" decision-making mode, which greatly reduces on-site trial and error costs and secondary risks.

[0021] (5) Online self-evolution of knowledge base and decision model is realized. This invention collects actual treatment effect data and compares the deviation with the sand table simulation prediction value to trigger online correction of the edge confidence of the four-level knowledge graph, recoding of historical case vectors and gradient update of multi-dimensional weight coefficients, forming a data-driven feedback loop, so that the system can continuously optimize itself in continuous application and improve the decision accuracy of rare complex events.

[0022] (6) Significantly improved the overall efficiency of traffic emergency command. The synergistic effect of the above-mentioned technical effects enables this method to significantly shorten emergency response time, improve the compliance and scientific nature of response strategies, and reduce the incidence of secondary accidents in the handling of emergencies on highways and urban roads, thus meeting the stringent requirements of the transportation industry for timely, reliable, and compliant emergency decision-making. Attached Figure Description The accompanying drawings illustrate exemplary embodiments of the present application and, together with the description thereof, serve to explain the principles of the present application. These drawings are included to provide a further understanding of the present application and are incorporated in and constitute a part of this specification.

[0023] Figure 1 The flowchart illustrates a traffic emergency command retrieval enhancement generation method based on a static and dynamic dual-layer knowledge base, as provided in an embodiment of the present invention. Detailed Implementation

[0024] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While some embodiments of this application are shown in the drawings, it should be understood that this application can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this application. It should be understood that the drawings and embodiments of this application are for illustrative purposes only and are not intended to limit the scope of protection of this application.

[0025] It should be noted that, where there is no conflict, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0026] The names of the messages or information exchanged between multiple devices in the embodiments of this application are for illustrative purposes only and are not intended to limit the scope of these messages or information.

[0027] Reference Figure 1 This invention provides a traffic emergency command retrieval enhancement generation method based on a static and dynamic dual-layer knowledge base, comprising the following steps: S1. Construct a static knowledge base, which includes a basic regulations sub-base and a historical case sub-base. The basic regulations sub-base is used to store vectorized representations of traffic regulations and emergency plans, and the historical case sub-base is used to store vectorized representations of historical emergency response cases.

[0028] The basic legal sub-library can be constructed in a hierarchical and structured manner according to the level of legal validity, applicable scenarios and the timeliness of clauses, and an index for resolving conflicts between legal clauses can be established.

[0029] Specifically, in one embodiment, BERT-base-Chinese can be used to vectorize regulations such as the "Road Traffic Safety Law," the "Design Specifications for Highway Traffic Safety Facilities" (JTG D81-2017), and the "Specifications for Setting Road Traffic Signs and Markings" (JTGD82-2009). Each regulation clause is stored as a structured vector, containing fields as shown in Table 1.

[0030] Table 1 provides an example of how each legal clause is stored as a structured vector.

[0031] For example, in the regulatory conflict resolution index, when the search finds "the speed limit on highways should be 60 km / h in icy and snowy weather" (JT / T617 recommended standard) and "the minimum speed limit on highways shall not be lower than 60 km / h" (mandatory clause), the conflict resolution index automatically marks the former as a recommended clause and the latter as a mandatory clause, and the mandatory clause takes precedence when generating constraints.

[0032] The historical case sub-library can be multi-labeled vectorized and encoded according to event type, handling result, scope of impact, and spatiotemporal characteristics.

[0033] Specifically, as an example, 1200 cases of rear-end collisions handled during icy and snowy weather on national highways over the past 5 years were collected. Each case was coded as a 1024-dimensional vector, with the following multi-label structure: { Case ID: CASE-2023-BJ-0892 Event Type: ["Rear-end collision", "Multi-vehicle", "Truck involved"], Weather conditions: ["Sleet", "Icy roads", "Visibility <200m"] Road Classification: Highway (Eight-lane, Two-way) "Handling Outcome": "Successful - No secondary accidents - Congestion dissipated in 45 minutes". "Affected Area": ​​"3 lanes occupied - 2.8km of congestion behind", "Spatiotemporal characteristics": { "Season": "Winter", "Time of Day": "14:00-16:00", "Latitude and Longitude": [120.3521, 31.2847], "Topological relationship": "2km upstream of the interchange" }, "Vector representation": [0.23, -0.87, ..., 0.15] / / 1024 dimensions}.

[0034] S2, Construct a dynamic knowledge base, which includes a real-time situation sub-base and a prediction and inference sub-base. The real-time situation sub-base is used to cache real-time vectorized data of traffic flow data, meteorological data and event reports in a streaming manner. The prediction and inference sub-base is used to store vectorized data of future situation predictions generated based on traffic simulation models.

[0035] In step S2, the real-time situation sub-library can use a sliding time window mechanism to manage data timeliness, and the window duration can be adaptively adjusted according to the event level; the prediction and extrapolation sub-library can be periodically updated through an online traffic simulation model, and the extrapolation time granularity is negatively correlated with the urgency of the event.

[0036] Specifically, real-time data from multiple sources is received through a Kafka message queue, managed using a sliding time window, as shown in Table 2.

[0037] Table 2 shows the timeliness of data management using the sliding time window mechanism in the real-time situational awareness sub-database.

[0038] The following is an example of the adaptive window duration adjustment mechanism: When an event is classified as a Level III major accident (with injuries, multi-vehicle rear-end collisions, and severe weather), the system automatically shortens the sliding window duration of the real-time situation sub-database from the default 5 minutes to 90 seconds to increase the weight of data freshness.

[0039] The specific implementation of the prediction and inference sub-library is as follows: Using the SUMO (Simulation of Urban Mobility) micro-traffic simulation engine, with the current real-time situation as the initial condition, the following settings are configured: Simulation step size: 0.5 seconds (fine-grained simulation is used due to the urgency of the event). Prediction duration: Next 30 minutes; Input parameters: Current cross-sectional flow rate 1800 pcu / h / ln, average vehicle speed 35 km / h, accident occupies 2 lanes; The online simulation runs every 5 minutes, outputting a future situation prediction vector, including: Speed ​​of congestion spread: The congestion is expected to extend to 5.2km in 15 minutes; Secondary accident risk point: K1198+200 (combination of curve and slope, predicted risk value 0.73).

[0040] S3. Establish a four-level knowledge graph of event-scene-strategy-effect. The nodes of the knowledge graph include event nodes, scene nodes, strategy nodes and effect nodes. Adjacent level nodes are associated with directed edges with confidence weights to form a bidirectional association link between static and dynamic knowledge.

[0041] In step S3, the construction of the fourth-level knowledge graph includes: The event node includes accident type, vehicle type, weather conditions, and event level labels; The scene nodes include road level, traffic flow, surrounding facilities, and spatial topology tags; The strategy node includes control measures, rescue routes, information dissemination plans, and resource allocation tags; The effect nodes include congestion dissipation time, secondary accident risk value, and social impact assessment labels; The confidence weights between adjacent level nodes are determined by combining historical case statistics and expert knowledge annotation.

[0042] Specifically, event nodes (Event): {"node_id": "E_20260115_1432_001", Accident Type: Chain Rear-End Collision "Vehicle type combination": ["Heavy-duty trucks", "Passenger cars"], Weather conditions: Sleet, Icy roads "Event Level": "Level III - Major Incident" "Casualties": "To be confirmed"}

[0043] Scene node: {"node_id": "S_G15_K1200", Road Classification: Highway (Eight-lane, Two-way) Current traffic: 1800 pcu / h / ln "Road Alignment": "Straight Section - 2km upstream of the interchange", "Nearby Facilities": ["Service Area_8km Ahead", "Toll Station_5km Behind"], "Spatial Topology": "Upstream 2km is a hub interchange - there are diversion conditions"}.

[0044] Strategy Node: {"node_id": "ST_001", "Traffic Control Measures": "Lane 2 and 3 closed; speed limit in Lane 1: 60 km / h". "Rescue Route": "Police car_K1198 entrance_Estimated arrival time: 6 minutes" Information Release: "Information Board - Accident Ahead - Slow Down - Detour Recommended", "Resource allocation": ["2 tow trucks", "1 ambulance", "1 de-icing agent spreader"]}.

[0045] Effect node: { "node_id": "EF_001", "Congestion dissipation time": 42 minutes "Secondary accident risk value": "0.12", "Social Impact Index": "Medium-level congestion, localized traffic jams, no confirmed casualties"

[0046] The following is an example of calculating the confidence of directed edges: Confidence of the edge Event-->Scene = Matching degree of the "sleet + rear-end collision + high speed" scene in historical cases (0.85) × Expert annotation weight (0.90) = 0.765. Confidence of the edge Strategy-->Effect = Success rate of similar strategies in historical cases (0.82) × Simulation inference consistency (0.88) = 0.722.

[0047] S4, receive emergency event messages, perform multi-dimensional analysis on the emergency event messages, and obtain event type, event level, spatiotemporal attributes and environmental conditions.

[0048] Example of a received message: The combined BSM (Basic Safety Message) and RSI (Road Side Information) messages reported by the Roadside Unit (RSU): { "msg_type": "emergency_event", "timestamp": "2026-01-15T14:32:18+08:00", "location": {"lng": 120.3521, "lat": 31.2847, "milepost": "K1200+500"}, "event": { "type": "multi_vehicle_collision", "severity": 3, "vehicles_involved": 5, "lanes_blocked": [2, 3], "weather": {"type": "sleet", "temp": -2.3, "visibility": 180} }, "traffic_state": { "volume": 1800, "speed": 35, "occupancy": 0.68 }}.

[0049] The parsing results from the above message are as follows: Event type tags: [rear-end collision, multiple vehicles, truck involved, rain / snow, icy road]; Event Level: Level III (based on ≥5 vehicles, severe weather, and obstruction of traffic); Spatiotemporal attributes: [Winter, 14:00-16:00, straight road section, 2km upstream of the interchange]; Environmental conditions: [Temperature < -2℃, Precipitation > 2mm / h, Visibility < 200m].

[0050] S5. Based on the multi-dimensional analysis results, calculate the multi-dimensional timeliness activation weight of the dynamic knowledge slice. The multi-dimensional timeliness activation weight includes urgency factor, freshness factor, spatial relevance factor and historical similarity factor. Activate the relevant knowledge slices in the dynamic knowledge base based on the multi-dimensional timeliness activation weight.

[0051] Specifically, in step S5, the multidimensional timeliness activation weight is calculated using the following formula: ,in, Based on the calculation of event level and risk of casualties, Calculated based on the difference between the data timestamp and the current time. Calculated based on the geographical distance and road topology relationship between the event location and the data spatial source. Vector similarity calculation based on current event features and historical cases; , The coefficients are adaptive and dynamically adjusted according to the event handling stage and distance. β and δ are the freshness weight coefficient and the historical similarity weight coefficient, respectively.

[0052] Specifically, in one embodiment, W The values ​​of are shown in Table 3.

[0053] Table 3 is... W Value table

[0054] Adaptive coefficient adjustment: The accident handling phase is classified as the initial response phase (0-15 minutes), with a value of 1.2 (increasing the urgency weight). The distance between the data source and the road network at the accident site is 0km (same road segment), and the value is 1.0; if it is an adjacent road segment (2km apart), the value is reduced to 0.6.

[0055] Example of calculation results: For real-time meteorological data (time difference 0 seconds, spatial distance 0 km):

[0056] For historical traffic data from 5 minutes ago (time difference 300 seconds, spatial distance 0km):

[0057] Real-time meteorological data receives a higher activation weight and is given priority in the retrieval queue.

[0058] S6. Based on the activated knowledge slices, retrieve the associated static knowledge through the four-level knowledge graph, and perform multi-objective fusion sorting on the dynamic and static knowledge to obtain the fused knowledge sequence.

[0059] Specifically, in step S6, the multi-objective fusion sorting adopts a static-dynamic knowledge coupling sorting algorithm, including: Calculate the freshness score, spatial coverage score, and inference credibility score of dynamic knowledge; calculate the authority score, scenario matching score, and historical success rate score of static knowledge. The correlation strength score between dynamic knowledge and static knowledge is calculated using a cross-layer attention mechanism; Based on the above scores, a weighted fusion or Pareto optimal solution is performed to generate the fused knowledge sequence.

[0060] Dynamic knowledge scoring and static knowledge scoring are shown in Tables 4 and 5 for details: Table 4 shows the dynamic knowledge scoring table.

[0061] Table 5 is the static knowledge scoring table.

[0062] Cross-layer attention association strength calculation: Using Scaled Dot-Product Attention, the association strength between dynamic knowledge "Real-time weather: -2.3℃ / icing" and static knowledge "Regulations: Speed ​​limit on highways is 60km / h in icy and snowy weather" is calculated. .

[0063] in, Q Vector representations of dynamic knowledge slices (such as real-time weather vectors and flow vectors). K This is an index vector for static knowledge nodes (such as scenario tag vectors for regulations and event tag vectors for historical cases). V It is the complete semantic content vector of each knowledge node in the static knowledge base. For example, for the law node, VIt is a 768-dimensional semantic vector of the full text of the regulation after being encoded by BERT; while for historical case nodes, V It is a complete vectorized representation of the case handling process and effect evaluation; d k express K The number of dimensions of the (key) vector.

[0064] The calculation logic above is as follows: First, calculate the similarity between Q (dynamic knowledge) and K (static index) to obtain the attention weight (i.e., "which static knowledge should be paid attention to" in dynamic knowledge); then use this weight to perform a weighted summation on V (the actual semantics of static content) to output a static knowledge representation that incorporates the dynamic query intent.

[0065] Divide by The primary purpose of scaling factors is to prevent dimensionality issues. d k When the value is large, the dot product result QK T When the value is too large, the Softmax function enters the gradient saturation region, causing gradient vanishing. d k When the value is large, the variance of the dot product of a random vector increases linearly with the dimension; dividing by... The dot product result can be rescaled to a reasonable range to maintain numerical stability and keep the gradient of Softmax effective.

[0066] Merged sorting results: Regulations: Speed ​​limit on highways in icy and snowy weather is 60km / h (dynamic correlation 0.89 + static score 0.97) --> Overall 0.93; Real-time weather: -2.3℃ / icing (dynamic score 0.95) --> Overall score 0.91; Predicted congestion: 5.2km in 15 minutes (dynamic score 0.86) --> Overall score 0.84; Historical case: CASE-2023-BJ-0892 (static score 0.83) --> overall score 0.80.

[0067] S7. Input the fused knowledge sequence into the large language model and combine it with the constraint decoding mechanism based on the legal prefix tree to generate multiple candidate emergency response strategies.

[0068] In step S7, the constraint decoding mechanism based on the regulatory prefix tree includes: The mandatory and prohibitive clauses in the basic regulations sub-library are constructed into a Trie tree constraint structure; At each step of the autoregressive decoding of the large language model, the current token sequence is matched with the Trie tree; If a prohibited path is matched, the logits probability of the corresponding token is dynamically blocked; if a mandatory path is matched, the sampling probability of the corresponding token is increased to ensure that the generated candidate strategy does not violate mandatory legal provisions.

[0069] Specifically, the Trie tree path for encoding mandatory regulatory clauses is illustrated below: root ├── Highway │├── Snowy weather ││├── Must-->[Turn on fog lights, speed limit 60 km / h, maintain safe following distance] ││└── Prohibited --> [Occupying the emergency lane, speeding, driving against traffic] │└── Accident Handling │├── Must-->[Set up warning signs 150m away, sound the alarm, and provide assistance to the injured] │└── Prohibited-->[Moving vehicles without authorization, disturbing the scene].

[0070] The following diagram illustrates the next decoding step after the large language model generates "suggestions for vehicles behind": Candidate token: "speed through" --> matches with Trie tree path highway / snowy weather / prohibited / speeding --> prohibited path --> the probability of this token's logits is multiplied by 0.001 (dynamic masking); Candidate token: "Slow down" --> matches the semantics of the Trie tree path Highway / Ice / Snowy Weather / Necessary / Speed ​​Limit 60 --> Mandatory path --> The probability of this token's logits is multiplied by 2.0 (probability increase); Candidate token: "Turn on fog lights" --> matches the Trie tree path Highway / Snowy weather / Required / Turn on fog lights --> Mandatory path --> Increased probability.

[0071] The final generated candidate strategies are as follows: Candidate Strategy A: "Immediately close lanes 2 and 3 at kilometer marker K1200+500 on the G15 Shenhai Expressway. Limit the speed in lane 1 to 60 km / h. Publish 'Accident ahead, slow down' information on the rear information boards. Guide vehicles to divert from the K1198 interchange to the S32 Shenjiahu Expressway. Rescue forces are expected to arrive at 14:38." Candidate Strategy B: "Close lanes 2 and 3, impose a speed limit of 40 km / h across the entire width, do not initiate traffic diversion, only issue a warning and await on-site handling." Candidate Strategy C: "Close lanes 2 and 3, as well as the emergency lane; limit speed in lane 1 to 60 km / h; initiate remote traffic diversion (K1195); and deploy additional de-icing agent spreaders to prevent secondary accidents." S8. Input the multiple candidate emergency response strategies into the traffic digital twin model for sand table simulation, and select the optimal strategy for output based on the simulation evaluation indicators.

[0072] In step S8, the sand table simulation includes: The candidate strategies are parsed into the control inputs of the traffic simulation model, and the control inputs include lane closure, speed limit, traffic light timing, and rescue route. Run microscopic traffic simulations in a digital twin environment to simulate traffic evolution over a predetermined future time period; Calculate and evaluate the simulation indicators, which include congestion dissipation time, secondary accident risk value, rescue arrival time, economic cost and social impact index; The optimal strategy is selected by using multi-indicator weighted scoring or constraint satisfaction screening.

[0073] Table 6 is a parameter table for control inputs.

[0074] Microscopic traffic simulations were run in a digital twin environment to simulate traffic evolution over the next 30 minutes, as shown in Table 7.

[0075] Table 7 shows the traffic evolution parameters for the simulated future time period.

[0076] The following evaluation indicators were calculated using a multi-indicator weighted scoring method:

[0077] From Table 6 above, the optimal strategy output is: Strategy C.

[0078] In other embodiments, after step S8, step S9 is further included, specifically: Collect data on the effectiveness of actual emergency response and calculate actual evaluation indicators; Compare the deviations between the actual evaluation indicators and the predicted indicators from the sand table simulation; When the deviation exceeds a preset threshold, the online correction of the confidence weights of the relevant edges in the fourth-level knowledge graph, the recoding of the corresponding case vectors in the historical case sub-library, and the gradient update of the adaptive coefficients in the multi-dimensional timeliness activation weights are triggered.

[0079] Specifically, the actual response adopted a variant of Strategy C (due to the discovery of one seriously injured person at the scene, the rescue arrival time was extended to 10 minutes). Please refer to Table 8 for the actual evaluation indicators: Table 8 shows the deviation parameters between the predicted data and the actual data.

[0080] As can be seen from Table 7, the congestion dissipation time deviation of 17.1% is less than the threshold of 20%, so no correction is triggered; the secondary accident risk value deviation of 37.5% is greater than the threshold of 30%, so online correction is triggered as follows.

[0081] 1. Level 4 Knowledge Graph Edge Confidence Correction: The confidence of the edge Strategy (remote diversion + snow melting agent) --> Effect (secondary accident risk) is adjusted from 0.75 to: 0.75×0.8+0.11×0.2=0.622 (a decrease, reflecting that the actual risk is higher than expected); 2. Historical Case Vector Recoding: This case is added as a new sample to the historical case sub-database, and its vector encoding is as follows: { Case ID: "CASE-2026-JS-0001", "Event Type": ["Rear-end collision", "5 vehicles", "Truck", "Sleet", "Seriously injured"], "Response Strategy": "Remote diversion + snow melting agent + multiple rescue teams" "Actual effect": {"Congestion reduction": 41, "Secondary risk": 0.11}, "Vector": [0.18, -0.92, ..., 0.33]} Adaptive coefficient gradient update: Updated using gradient descent. This makes the predicted secondary risk value closer to the actual value: Where the loss function L = (0.08) 0.11) 2 =0.0009, learning rate η=0.01, after update In the scenario of "casualties", the value has been adjusted from 1.2 to 1.15 to reduce the excessive weighting of the urgency factor.

[0082] Those skilled in the art should understand that the above embodiments are merely for illustrative purposes and are not intended to limit the scope of this application. Those skilled in the art can make other changes or modifications based on the above disclosure, and these changes or modifications still fall within the scope of this application.

Claims

1. A traffic emergency command retrieval enhancement generation method based on static and dynamic double-layer knowledge base enhancement, characterized in that, Includes the following steps: S1. Construct a static knowledge base, which includes a basic regulations sub-base and a historical case sub-base. The basic regulations sub-base is used to store vectorized representations of traffic regulations and emergency plans, and the historical case sub-base is used to store vectorized representations of historical emergency response cases. S2, Construct a dynamic knowledge base, which includes a real-time situation sub-base and a prediction and inference sub-base. The real-time situation sub-base is used to cache real-time vectorized data of traffic flow data, meteorological data and event messages in a streaming manner. The prediction and inference sub-base is used to store vectorized data of future situation predictions generated based on traffic simulation models. S3. Establish a four-level knowledge graph of event-scene-strategy-effect. The nodes of the knowledge graph include event nodes, scene nodes, strategy nodes and effect nodes. Adjacent level nodes are associated through directed edges with confidence weights to form a bidirectional association link between static and dynamic knowledge. S4, receive emergency event messages, perform multi-dimensional analysis on the emergency event messages, and obtain event type, event level, spatiotemporal attributes and environmental conditions; S5. Based on the multi-dimensional analysis results, calculate the multi-dimensional timeliness activation weight of the dynamic knowledge slice. The multi-dimensional timeliness activation weight includes urgency factor, freshness factor, spatial relevance factor and historical similarity factor. Activate the relevant knowledge slice in the dynamic knowledge base based on the multi-dimensional timeliness activation weight. S6, based on the activated knowledge slices, retrieve the associated static knowledge through the four-level knowledge graph, and perform multi-objective fusion sorting on the dynamic knowledge and static knowledge to obtain the fused knowledge sequence; S7, input the fused knowledge sequence into the large language model, and combine it with the constraint decoding mechanism based on the legal prefix tree to generate multiple candidate emergency response strategies; S8. Input the multiple candidate emergency response strategies into the traffic digital twin model for sand table simulation, and select the optimal strategy for output based on the simulation evaluation indicators.

2. The method according to claim 1, characterized in that, In step S1, the basic legal sub-library is stored in a hierarchical structure according to the level of legal validity, applicable scenarios and the timeliness of the clauses, and an index for resolving conflicts between legal clauses is established; the historical case sub-library is encoded using multi-label vectorization according to event type, handling result, scope of impact and spatiotemporal characteristics.

3. The method according to claim 1, characterized in that, In step S2, the real-time situation sub-library uses a sliding time window mechanism to manage data timeliness, and the window duration is adaptively adjusted according to the event level; the prediction and inference sub-library is periodically updated through an online traffic simulation model, and the inference time granularity is negatively correlated with the urgency of the event.

4. The method according to claim 1, characterized in that, In step S3, the construction of the fourth-level knowledge graph includes: The event node includes accident type, vehicle type, weather conditions, and event level labels; The scene nodes include road level, traffic flow, surrounding facilities, and spatial topology tags; The strategy node includes control measures, rescue routes, information dissemination plans, and resource allocation tags; The effect nodes include congestion dissipation time, secondary accident risk value, and social impact assessment labels; The confidence weights between adjacent level nodes are determined by combining historical case statistics and expert knowledge annotation.

5. The method according to claim 1, characterized in that, In step S5, the multidimensional timeliness activation weight is calculated using the following formula: ,in, Based on the calculation of event level and risk of casualties, Calculated based on the difference between the data timestamp and the current time. Calculated based on the geographical distance and road topology relationship between the event location and the data spatial source. Vector similarity calculation based on current event features and historical cases; , The coefficients are adaptive and dynamically adjusted according to the event handling stage and distance. β and δ are the freshness weight coefficient and the historical similarity weight coefficient, respectively.

6. The method according to claim 1, characterized in that, In step S6, the multi-objective fusion sorting adopts a static-dynamic knowledge coupling sorting algorithm, including: Calculate the freshness score, spatial coverage score, and inference credibility score of dynamic knowledge; calculate the authority score, scenario matching score, and historical success rate score of static knowledge. The correlation strength score between dynamic knowledge and static knowledge is calculated using a cross-layer attention mechanism; Based on the above scores, a weighted fusion or Pareto optimal solution is performed to generate the fused knowledge sequence.

7. The method according to claim 1, characterized in that, In step S7, the constraint decoding mechanism based on the regulatory prefix tree includes: The mandatory and prohibitive clauses in the basic regulations sub-library are constructed into a Trie tree constraint structure; At each step of the autoregressive decoding of the large language model, the current token sequence is matched with the Trie tree; If a prohibited path is matched, the logits probability of the corresponding token is dynamically blocked; if a mandatory path is matched, the sampling probability of the corresponding token is increased to ensure that the generated candidate strategy does not violate mandatory legal provisions.

8. The method according to claim 1, characterized in that, In step S8, the sand table simulation includes: The candidate strategies are parsed into the control inputs of the traffic simulation model, and the control inputs include lane closure, speed limit, traffic light timing, and rescue route. Run microscopic traffic simulations in a digital twin environment to simulate traffic evolution over a predetermined future time period; Calculate and evaluate the simulation indicators, which include congestion dissipation time, secondary accident risk value, rescue arrival time, economic cost and social impact index; The optimal strategy is selected by using multi-indicator weighted scoring or constraint satisfaction screening.