Multi-agent urban building safety risk prediction method based on large language model

By introducing a multi-agent system based on large language models into the urban building safety risk prediction model, the hyperparameter combination is dynamically optimized and complex environmental factors are dealt with, and the existing models are solved the problem of low efficiency and insufficient performance in complex environments of hyperparameter optimization, and more efficient and accurate risk prediction is achieved.

CN119904102APending Publication Date: 2025-04-29QINGDAO PROSPECTS CONNECTED INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411994139.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-29

AI Technical Summary

Technical Problem

The existing urban building safety risk prediction model has low efficiency and poor scalability in hyperparameter optimization, and traditional machine learning algorithms are insufficient in complex dynamic environments, making it difficult to cope with the risks of multiple interaction factors and dynamic changes.

Method used

Using a multi-agent system based on large language model (LLM), the hyperparameter combination is dynamically optimized through the collaboration between the generator agent and the executor agent, and the interactive factors in complex architectural description text and variable environments are processed through LLM to improve the adaptability and prediction accuracy of the model.

Benefits of technology

It significantly improves the optimization efficiency and adaptability of urban building safety risk prediction models, enhances the practicality and scalability of the model in large-scale data processing, and can predict building safety risks more accurately and maintain efficient operation in dynamic environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119904102A_ABST
    Figure CN119904102A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of risk prediction, in particular to a multi-agent urban building safety risk prediction method based on a large language model, and the method comprises the steps: enabling a generator agent and an executor agent to cooperate, carrying out the analysis of input background information and experiment logs through the LLM, intelligently generating and iteratively optimizing a hyper-parameter combination, and carrying out the prediction of the safety risk of an urban building. Compared with a traditional random search or grid search method, an executor agent calls a risk prediction tool to predict input data through optimized hyper-parameters and model weights, generates a risk assessment result of a building, generates a detailed natural language risk report through LLM, and feeds back a closed-loop mechanism to obtain a risk assessment result of the building. The prediction result is compared with the actual situation, the model performance is further optimized, the model performance and the prediction precision can be improved when large-scale complex data is processed, and powerful technical support is provided for urban building safety management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of risk prediction, and in particular to a multi-agent urban building safety risk prediction method based on a large language model (LLM). Background Art

[0002] Multi-Agent Systems (MAS) have demonstrated excellent problem-solving capabilities in risk prediction in various fields, especially in systems involving multiple parties, complex interactions, and dynamic changes. Risk prediction in fields such as financial markets, natural disaster emergency response, and public health often requires considering multiple parties and various factors at the same time, and there are complex dependencies and mutual influences between these factors. Traditional single models are difficult to capture this multi-level, multi-angle dynamic interaction, while multi-agent technology can effectively predict the risk transmission effect of each party's behavior on the overall system by simulating the behavior and decision-making of each participant (i.e., agent). Each agent can not only make decisions independently, but also interact with other agents, thereby more realistically reflecting the complex risk transmission path within the system. For example, in the financial market, the behavior of investors, regulators, and exchanges can trigger market fluctuations, which in turn lead to systemic risks. Multi-agent systems effectively solve the risk prediction problem under multi-party participation and complex interactions through distributed collaboration, and provide more accurate and forward-looking prediction capabilities. Although multi-agent systems have been widely used in risk prediction in fields such as finance and public health, research on urban building safety risk prediction is still insufficient.

[0003] Hyperparameter optimization of building safety risk prediction models often requires a lot of computing resources and manual intervention to gradually adjust model parameters to achieve the best results. At present, the methods and hyperparameter optimization of urban building safety risk prediction models still mainly rely on traditional methods. For example, the literature "Singh Walia, Bhavkaran, et al. A dynamic pipeline for spatio-temporal fire risk prediction. Proceedings of the 24th ACMSIGKDD International Conference on Knowledge Discovery & Data Mining. 2018." discloses a building risk prediction framework, which uses XGBoost and random forest algorithms to predict the building fire risk in Pittsburgh, and optimizes hyperparameters through manual adjustment and grid search methods; the literature "Dang, Trung Thanh, et al. Fire risk prediction using multi-source data: A case study in humberside area. 2019 25th International Conference on Automation and Computing (ICAC). IEEE, 2019. "A fire risk prediction model was built for commercial buildings. A variety of machine learning algorithms including AdaBoost, XGBoost, random forest and multi-layer perceptron were compared. It was found that AdaBoost performed best in prediction performance and also relied on manual adjustment methods for hyperparameter optimization; the literature "Lee, Ina, Hyung-Rok Oh, and Zoonky Lee. Risk prediction and analysis of building fires-based on property damage and occurrence of fires. The Journal of Bigdata 6.1 (2021): 133-144." Using Ensemble Voting technology, the random forest, XGBoost and LightGBM algorithms were combined to predict the fire risk of buildings in Seoul, and the hyperparameters were optimized by manual adjustment methods; the literature "Lei, Yating, et al. Fire risk level prediction of timber heritage buildings based on entropy and XGBoost.Journal of Cultural Heritage 63(2023):11-22. "By comparing multiple machine learning algorithms such as XGBoost, GBDT, CatBoost, Adaboost, and SVM, it was found that XGBoost performed best in predicting the fire risk of wooden heritage buildings, and feature importance analysis and iterative feature selection were used to assist in adjusting the hyperparameters of the prediction model. In the field of architecture, the application of multi-agent systems has gradually expanded; the literature "Lim, Haewon, Hyunsoo Lee, and Ji-Hyoun Hwang. Multi-Agent Simulation on Staff Evacuation Behavior in Elderly Nursing Home Fire Emergencies. Buildings 13.2(2023):400." adopted an agent-based multi-agent simulation method to construct a system including nursing staff and elderly agents, and simulated the emergency evacuation behavior of elderly nursing home fires in detail; among them, the agents interacted according to predefined behavioral rules. The researchers used this method to evaluate the impact of different evacuation strategies on reducing the overall evacuation time, providing valuable insights; the literature "Fonseca, Tiago, et al. A low-cost multi-agent system for physical security in smart buildings. AIP Conference Proceedings. Vol. 2919. No. 1. AIP Publishing, 2024. "A low-cost multi-agent system called IP2S is proposed. The system effectively mitigates physical security incidents in smart buildings by coordinating various IoT sensors and actuators. This is also an agent-based agent system, in which agents represent different sensors and actuators to collaboratively respond to security incidents. The literature "Pagou, Ephraim Sinyabe, et al. Shapefile-based multi-agent geosimulation and visualization of building evacuationscenario. Procedia Computer Science 220 (2023): 519-526." discloses a multi-agent geographic simulation model for simulating building evacuation scenarios. This is also an agent-based agent system, in which agents represent people in the building, and they perform evacuation simulations based on GIS data in the environment, providing a new perspective for building evacuation planning and management.

[0004] Although existing research has made some progress in urban building safety risk prediction, urban building evacuation and risk mitigation based on multi-agent systems, in the face of the complexity and dynamic changes in urban building safety risk prediction and management, existing research has limitations in many aspects, which restricts the effective application and development of multi-agent systems and machine learning technologies. First, most urban building safety risk prediction models rely on manual adjustment or traditional grid search methods for hyperparameter optimization, which leads to low efficiency and difficulty in dealing with large-scale data and complex tasks in practical applications; second, traditional machine learning algorithms are mainly used for risk prediction in static environments, and they are insufficient in dealing with complex dynamic and multi-interactive factors, making it difficult to fully cope with the variable risks in actual urban building environments. In addition, multi-agent systems are currently mainly used in the fields of personnel evacuation and risk mitigation, and have not yet been widely used in urban building safety risk prediction, resulting in the existing prediction models being weak in flexibility and adaptability. These problems limit the practical application of multi-agent systems and machine learning in urban building safety risk prediction, and more efficient and adaptive methods are urgently needed to optimize the application of technology in this field. Summary of the invention

[0005] The purpose of the present invention is to overcome the shortcomings of the prior art and to design a multi-agent urban building safety risk prediction method based on a large language model (LLM). The flexibility, accuracy and adaptability of risk prediction are improved by improving the hyperparameter optimization mechanism, enhancing the model's ability to handle complex dynamic environments, and expanding the application of multi-agent systems in the field of urban building safety risk prediction.

[0006] To achieve the above object, the present invention adopts the following technical solution:

[0007] A multi-agent urban building safety risk prediction method based on a large language model includes two processes: model hyperparameter optimization and safety risk prediction. The model hyperparameter optimization specifically includes the following steps:

[0008] S11, input background information, the background information includes hyperparameter information, data set information, optimization target and large language model information;

[0009] S12, the generator agent generates a new hyperparameter combination. The generator agent first extracts relevant information from the background information through the natural language understanding ability of the large language model and generates an initial hyperparameter combination. The large language model then combines the experimental log results to enable the generator agent to generate a better hyperparameter combination in subsequent iterations.

[0010] S13, the executor agent trains the model and saves the experiment log. The executor agent first trains the large language model according to the hyperparameter combination generated by the generator agent, monitors the training progress, and then conducts the experiment. After the experiment is completed, the log is automatically saved and the hyperparameters and model performance are associated;

[0011] S14, LLM assists in the analysis of experimental logs. After the model training and experiment are completed, LLM extracts key information from the experimental logs, analyzes the impact of hyperparameter combinations on model performance, and generates an analysis report to provide feedback information for the next round of hyperparameter generation.

[0012] S15, iterative optimization of the generator agent. The generator agent uses the analysis results of the experimental log by LLM to generate new hyperparameter combinations, and continues to iterate experiments and feedback until the performance target or time limit is reached;

[0013] S16. Output the optimal hyperparameter combination to obtain the urban building safety risk prediction model;

[0014] Security risk prediction specifically includes the following steps:

[0015] S21, LLM processes input data and extracts features. Based on the data agent of LLM, the input building description text data is semantically parsed and features are extracted, and the unstructured text data is converted into the feature data required by the model;

[0016] S22. The executor agent calls the risk prediction tool to use the optimal prediction model. The executor agent loads the pre-optimized hyperparameter combination and model weights through the tool setting module to ensure the optimal configuration of the model in the current environment. After loading, the executor agent calls the risk prediction tool to quickly and efficiently perform prediction analysis of building safety risks. The entire process does not require retraining the model, and can quickly and accurately generate risk prediction results for the building based on the current input data, ensuring that the prediction process is efficient and accurate.

[0017] S23. Obtain risk prediction results. The executor agent generates risk assessment results for the building based on the output of the risk prediction tool. The risk assessment results are presented in the form of levels, including high, medium, and low risk classifications of the building. LLM assists the executor agent in interpreting the prediction results as natural language descriptions and generates a detailed risk report through the analysis result tool. The report explains the prediction results in natural language for easy understanding by users. Users can understand the risk status of each building through the report and formulate further risk control measures based on the prediction results.

[0018] S24. Result analysis and feedback. After the risk prediction is completed, the executor agent uses the feedback tool to compare the prediction results with the actual situation and records the control suggestions generated by the system. LLM generates targeted risk control suggestions for users by analyzing historical feedback data and current prediction results. For example, the system can recommend strengthening security monitoring of certain buildings or optimizing emergency response strategies in specific areas.

[0019] S25. Feedback loop of risk prediction and hyperparameter optimization. The executor agent provides feedback results to the generator agent through tool settings, forming a closed loop of hyperparameter optimization and risk prediction. LLM combines the prediction feedback information to help the generator agent further optimize the model performance in the future. This feedback mechanism ensures that the system remains adaptive in a dynamic environment, and continuously adjusts the optimization strategy based on new prediction data and real feedback, so that the model can better cope with future risk prediction tasks.

[0020] The present invention aims at the problem of hyperparameter optimization. The generator agent generates new hyperparameter combinations through historical experimental data, and the executor agent feeds back the model performance through the experimental log to further optimize the hyperparameters, thereby solving the problem of low efficiency of traditional grid search. Based on the data agent, the processing ability of building description text and complex interactive factors in a changing environment is improved to make up for the shortcomings of traditional static machine learning models. Secondly, by expanding the application scenarios of the multi-agent system, it is expanded from the current personnel evacuation and risk mitigation to the prediction of urban building safety risks, and the collaboration of multiple agents is used to improve the adaptability of the model in a dynamic environment.

[0021] Compared with the prior art, the present invention has the following beneficial effects:

[0022] (1) In order to solve the problems of low efficiency and poor scalability of hyperparameter optimization of existing urban building safety risk prediction models, the present invention adopts a multi-agent system dynamic hyperparameter optimization method based on a large-scale language model (LLM), which significantly improves the optimization efficiency and adaptability of the model, effectively solves the limitations of traditional manual adjustment or grid search methods, and enhances the practicality and scalability of the model in large-scale data processing.

[0023] (2) In view of the limitations of traditional machine learning algorithms in dealing with complex dynamic environments and multiple interacting factors, the present invention introduces a multi-agent system based on LLM to improve the flexibility and adaptability of the model in complex urban building environments. It can more accurately predict building safety risks and maintain efficient operation in a dynamically changing urban environment, thus overcoming the shortcomings of traditional methods in dealing with dynamic risks.

[0024] (3) In view of the insufficient application of multi-agent systems in urban building safety risk prediction, the present invention expands the application scenarios of multi-agent systems and enhances their intelligent interaction and collaborative processing capabilities in building safety risk prediction, especially when dealing with multi-source heterogeneous data and complex building risk scenarios, showing higher prediction accuracy and efficiency, thereby solving the application problem of multi-agent systems in urban building safety risk prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a workflow framework diagram of the multi-agent urban building safety risk prediction method based on a large language model of the present invention.

[0026] Figure 2 Schematic diagram of the collaboration mechanism of the multi-agent system of the present invention.

[0027] Figure 3 This is a hyperparameter optimization flow chart of the urban building safety risk prediction model of the present invention.

[0028] Figure 4 This is a flow chart for predicting urban building safety risks according to the present invention. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "an" and "the" used in the embodiments of the present application are also intended to include plural forms, unless the context clearly indicates other meanings.

[0031] It should be understood that the term "and / or" used in the present invention is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present invention generally indicates that the associated objects before and after are in an "or" relationship.

[0032] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.

[0033] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.

[0034] This embodiment provides a multi-agent urban building safety risk prediction method based on a large language model, which aims to improve the accuracy and efficiency of urban building safety risk prediction through an intelligent hyperparameter optimization process and an efficient risk prediction model. The method consists of two main processes: first, the generator agent collaborates with the executor agent, using LLM to analyze the input background information and experimental logs, intelligently generate and iteratively optimize hyperparameter combinations, and surpass traditional random search or grid search methods; second, the executor agent uses the optimized hyperparameters and model weights to call the risk prediction tool to predict the input data, generate the risk assessment results of the building, and generate a detailed natural language risk report through LLM. Through the feedback closed-loop mechanism, the prediction results are compared with the actual situation to further optimize the model performance. This method can improve model performance and prediction accuracy when processing large-scale complex data, and provide strong technical support for urban building safety management. The framework diagram of this method is shown below. Figure 1 As shown in the figure, the schematic diagram of the cooperation mechanism of the multi-agent system is as follows Figure 2 As shown in the figure, the hyperparameter optimization iterative flowchart is as follows Figure 3 As shown in the figure, the flow chart for predicting urban building safety risks is as follows: Figure 4 As shown, this embodiment takes the fire risk prediction in urban building safety risk as an example, and the specific implementation includes the following steps:

[0035] The first is the hyperparameter optimization process of the urban building fire risk prediction model. The specific process is as follows:

[0036] S11. Background information input in fire risk prediction. Background information includes hyperparameter information, data set information, optimization objectives and model information related to building fires. This information provides basic data for the generator agent and guides the subsequent hyperparameter generation and model optimization process.

[0037] Specifically, this embodiment adopts the XGBoost model as the basic model for fire risk prediction. The key hyperparameters in the model include the learning rate (learning_rate), the minimum weight of child nodes (min_child_weight) and the number of decision trees (n_estimators). The value range of the hyperparameters will be optimized by the generator agent during the training process. The specific value range is set as follows: learning rate (learning_rate), controls the step size of each model update. A smaller learning rate can improve the generalization ability of the model and avoid overfitting, but it will also increase the training time. In order to strike a balance between accuracy and training time, this embodiment sets the value range of the learning rate to is [0.0001,0.1]; this range covers most optimization requirements to a large extent, so that the model can fine-tune the step size as needed during training; child node minimum weight (min_child_weight), this parameter determines the minimum sample weight and the number of leaf nodes required for child node splitting, affecting the complexity of the model and the ability to prevent overfitting; a larger value can avoid excessive complexity of the model, thereby reducing the risk of overfitting; the value range is set to [1,10], and experiments can verify the impact of different weights in this range on the model effect; the number of decision trees (n_estimators), this parameter is the number of decision trees in the XGBoost model, which directly affects the expressiveness of the model and computational complexity; more decision trees can usually improve the performance of the model, but will also increase computing time and resource consumption; the value range is set to [50,500] to ensure a balance between the model's learning ability and training efficiency; the dataset for fire risk prediction is derived from the relevant features of historical fire data of urban buildings. The statistical details of the dataset are as follows: sample size, the dataset contains 5,000 records of historical samples related to fires and building information without fires. Each record represents a specific building fire event or building information and contains multiple feature data; feature dimension, each sample record contains 20 features, including building type, building area, fire protection facilities, environmental factors (such as temperature, humidity, etc.), etc. These features It provides rich information for the model, which helps to improve the accuracy of the prediction; target class variable, this embodiment adopts a binary classification problem, and the target class variable is "fire occurs" and "fire does not occur", that is, for each record, the model needs to predict whether a fire will occur in the building under given conditions, and the fire occurrence is marked as 1, and the fire does not occur is marked as 0; the optimization goal is to guide the main direction that the generator agent should achieve in the process of hyperparameter search, specifically including: improving the prediction accuracy of the model, this embodiment uses the F1 score as the main performance measurement standard, the F1 score can comprehensively consider the precision (Precision) and recall (Recall) of the model in an unbalanced data set, and is a key indicator for evaluating the effectiveness of the fire risk prediction model.Precision refers to the proportion of actual fires among all samples predicted as "fire occurrence". The calculation formula is as follows: Recall refers to the proportion of "fire occurrence" successfully predicted by the model among all samples that actually occurred. The calculation formula is as follows: Formula (2); F1 Score comprehensively evaluates the performance of the model through the harmonic mean of Precision and Recall. The calculation formula is as follows: Formula (3); Reduce the training time of the model. Under the premise of ensuring the prediction performance, reduce the training time of the model as much as possible to improve the efficiency of overall optimization; Model information. XGBoost is used as the basic model for fire risk prediction. XGBoost is an ensemble learning algorithm based on decision trees. It has a strong ability to handle nonlinear relationships and high-dimensional features and is suitable for the complex problem of fire risk prediction. The binary cross entropy loss function is used in model training to measure the difference between the prediction result and the true label. The calculation formula is as follows: Formula (1)-(4) are as follows:

[0038]

[0039] Among them, TP (True Positive) is the number of samples where a fire actually occurred and the model correctly predicted that a fire had occurred, and FP (False Positive) is the number of samples where the model incorrectly predicted that a fire had occurred;

[0040]

[0041] Among them, TP is the same as above, FN (False Negative) is the number of samples where a fire actually occurred but the model failed to predict that a fire occurred;

[0042]

[0043] Where N is the number of samples, y i is the true label (fire occurred or not, 1 or 0), p i The loss function can effectively guide the optimization of the model in the binary classification problem and help the model continuously converge to the best classification performance.

[0044] S12. The generator agent generates a new hyperparameter combination. In this embodiment, the generator agent uses the natural language processing capability of the large language model (LLM) and combines the input background information and experimental log to generate and optimize the hyperparameter combination for fire risk prediction. The specific process of generating a new hyperparameter combination includes the following steps:

[0045] S121: Generate initial hyperparameter combinations. In the first round of the experiment, the generator agent extracts the hyperparameter value range of the XGBoost model from the background information and generates the initial hyperparameter combination based on experience and known data. The specific initial combination generated is as follows. This initial combination is used for the first model training and provides a benchmark for subsequent optimization: θ 0 ={learning_rate=0.07, min_child_weight=5, n_estimators=120};

[0046] S122. Optimize the hyperparameter combination in combination with the experimental log. Through the initial experiment, the generator agent reads the results in the experimental log and uses LLM to perform semantic analysis on these results. For example, by analyzing the Precision, Recall, and F1 scores obtained after the first round of training, the generator agent decides to adjust the learning rate and the minimum weight of the child nodes to further improve the performance of the model. The hyperparameter combination generated after optimization is updated as follows: θ 1 ={learning_rate=0.05, min_child_weight=3, n_estimators=180}.

[0047] S13, executor agent experiment and log recording. In this embodiment, the executor agent performs the training experiment of the XGBoost model according to the hyperparameter combination provided by the generator agent, and completely records the experimental logs. These logs provide detailed data support for subsequent analysis and optimization. The specific experiment and log recording process includes the following steps:

[0048] S131. Apply the new hyperparameter combination. The executor agent loads the latest combination generated by the generator agent through the hyperparameter configuration tool. For example, the executor agent configures the following hyperparameter combination: θ 1 ={learning_rate=0.05, min_child_weight=3, n_estimators=180};

[0049] S132, start model training and monitor progress. The executor agent starts the training program, trains the fire risk prediction model, and monitors various performance indicators in the training process in real time, including loss function value, F1 score, Precision and Recall;

[0050] S133. Record the log after the experiment is completed. After the experiment is completed, the executor agent uses the logging tool to automatically record the results to the system. The log contains the specific performance of each hyperparameter combination. The following is an example of an experimental log:

[0051] Experiment Log={learning_rate:0.05,min_child_weight:3,n_estimators:180,Precision:0.92,Recall:0.87,F1? Score:0.89,L:0.30}.

[0052] S14, LLM assists in the analysis of experimental logs. After the experiment and training are completed, LLM conducts an in-depth analysis of the recorded experimental logs and provides targeted optimization suggestions for the generator agent. This analysis process uses natural language processing capabilities to transform the experimental results into a deep understanding of the impact of parameters, forming the basis for the next round of optimization. The specific experimental log analysis process includes the following steps:

[0053] S141, extract key information and analyze the impact of hyperparameter combinations. LLM reads key indicators in the experiment log, especially the changes in Precision and Recall. It combines numerical analysis with context understanding to determine the effectiveness of the current hyperparameter combination. For example, if Precision is high but Recall is low, LLM will recommend adjusting the minimum weight of the child node to increase the recognition rate of positive examples.

[0054] S142. Generate an analysis report to provide feedback for the next round of optimization. LLM generates a report containing detailed data analysis and optimization suggestions. The report points out which hyperparameter combinations have a positive impact on the performance of the model and clearly suggests how to adjust the hyperparameters, such as further reducing the learning rate or increasing the number of decision trees.

[0055] S15, iterative optimization of the generator agent. The generator agent continuously generates new hyperparameter combinations based on the feedback report of the LLM and continues to perform iterative optimization. Each round of optimization is fine-tuned according to the experimental feedback until the performance of the model reaches the expected level. The specific iterative optimization process includes the following steps:

[0056] S151: Generate a new hyperparameter combination based on the feedback. Combined with the suggestions in the LLM analysis report, the generator agent decides to further optimize the combination and generates a new hyperparameter combination as follows. This combination is directly applied to the next round of experiments, forming a closed loop of continuous feedback, adjustment, and optimization:

[0057] θ 2 ={learning_rate=0.04, min_child_weight=2, n_estimators=220};

[0058] S152: Continuously iterate experiments and feedback. The generator agent and the executor agent continuously approach the optimal solution for model performance through multiple rounds of experiments, feedback, and optimization, ensuring that the F1 score and other key indicators reach the preset goals.

[0059] S16. Output the optimal hyperparameter combination and fire risk prediction model. After multiple rounds of experiments and optimization, the generator agent and the executor agent finally determine the optimal hyperparameter combination and output a deeply optimized fire risk prediction model. The model has good prediction performance and can effectively identify the risk of urban building fires. The specific process includes the following steps:

[0060] S161: Determine the optimal hyperparameter combination. The final output hyperparameter combination is as follows. This combination is the result of multiple rounds of experiments and feedback optimization, and represents the best model configuration under the current conditions:

[0061] θ * ={learning_rate=0.03, min_child_weight=1, n_estimators=225};

[0062] S162: Generate a fire risk prediction model. The executor agent uses the optimal hyperparameter combination to perform final training on the fire risk model and uses the model to predict new input data. The model shows good accuracy and stability in practical applications, with an F1 score of 0.91, which significantly improves the reliability of fire risk prediction.

[0063] Then comes the process of predicting urban building safety risks. The specific process is as follows:

[0064] S21, LLM processes input data and extracts features. In the process of fire risk prediction, the input data is usually a descriptive text of urban buildings, including unstructured information such as building type, area, fire protection facilities, and historical fire records. In this step, LLM is responsible for semantic analysis of the input text and converting unstructured data into structured features for model input. The specific process includes the following steps:

[0065] S211: semantically parse the input building description text. In this embodiment, the executor agent receives text data containing detailed descriptions of the building, such as the number of floors, purpose, and status of fire protection facilities of the building. These descriptions are usually in natural language form, such as: "The building is a 5-story commercial complex equipped with a complete fire sprinkler system, but a small fire occurred in the past year." LLM parses these texts through natural language processing technology, extracts semantic information and converts it into a format that the model can understand. For example, the features extracted from the above description are as follows:

[0066] Feature Vector={floors=5, type=commercial, fire_sprinklers=1, past_fire_incidents=1};

[0067] S212, Feature extraction and structured data conversion. After parsing, LLM quantifies and normalizes the extracted features to ensure that the input data meets the requirements of the prediction model. For example, the building use is converted into numerical features through One-Hot encoding, and historical fire events are converted into binary variables (0 for not occurring, 1 for occurring), finally forming a complete input feature matrix.

[0068] S22. The executor agent calls the risk prediction tool to use the optimal prediction model. After LLM completes feature extraction, the executor agent inputs the normalized data into the optimal building fire risk prediction model. Using the previously optimized hyperparameter combination, the executor agent can efficiently load the model and quickly perform fire risk prediction. The specific process includes the following steps:

[0069] S221. Load the optimal hyperparameter combination and model weights. The executor agent uses the tool setting module to load the best combination obtained in the hyperparameter optimization phase as follows, and loads the corresponding model weights to ensure the optimal configuration of the model under the current input data environment:

[0070] θ * ={learning_rate=0.03, min_child_weight=1, n_estimators=225};

[0071] S222. Perform fire risk prediction. The executor agent uses the loaded model to perform risk prediction on the characterized input data and calculates the probability value of fire in each building. Through the probability value output by the model, the executor agent can divide the building into different risk levels, specifically p≥0.7, which is rated as high risk; 0.5≤p<0.7, which is rated as medium risk; p<0.5, which is rated as low risk. For example, the features collected in S21 are input into the optimal fire risk prediction model, and the probability value p of fire in the building is 0.6. According to the threshold setting, the building is rated as medium risk.

[0072] S23. Obtain risk prediction results. The executor agent generates risk assessment results for urban buildings based on the output of the risk prediction tool. These results provide a basis for decision-making for urban safety managers and help formulate corresponding fire prevention measures. The specific process includes the following steps:

[0073] S231. Output the risk level classification result. The executor agent evaluates the probability of fire occurrence of each building and outputs the corresponding risk level. For example, if the probability of fire occurrence of a building is 0.6, the system will classify it as a medium-risk building.

[0074] S232. Generate a detailed risk report. LLM assists the executor agent to interpret the prediction results as natural language descriptions and generate a report containing a detailed risk analysis of the building. For example, "The building is assessed as medium risk. Although it is equipped with a complete fire sprinkler system, there are certain fire hazards due to a small fire that occurred in the past year. It is recommended to regularly maintain and inspect the fire sprinkler system, and at the same time strengthen fire inspections and safety training inside the building to reduce the possibility of fire."

[0075] S24, Result Analysis and Feedback. After the fire risk prediction is completed, the executor agent uses the feedback tool to compare the prediction results with the actual situation and generate risk control suggestions. LLM combines the model prediction and the actual situation to analyze the changing trend of building risks and provide improvement suggestions to users. The specific process includes the following steps:

[0076] S241. Comparison of results with actual conditions. The executor agent compares and analyzes the model's predicted results with the actual historical conditions of the building. By checking the correlation between the actual status of the building's fire protection facilities, recent fire incidents, and the predicted results, it is found that although the building is equipped with a sprinkler system, a fire still occurred in the past year, indicating that there may be deficiencies in the maintenance or use of fire protection measures.

[0077] S242: Generate targeted risk control suggestions. Based on the results of comparative analysis, LLM generates detailed risk control suggestions for users. The suggestions are not only targeted at the current risk level, but also refer to historical events to provide improvement measures. For example, "Although the building is equipped with a complete fire sprinkler system, a small fire occurred in the past year and the assessment result is medium risk. It is recommended to regularly maintain the fire sprinkler system to ensure that the system can work normally in the early stage of a fire. In addition, daily fire inspections should be strengthened, with special attention paid to high-risk areas that are easily overlooked, such as electrical equipment rooms and storage areas."

[0078] S25, the feedback loop of risk prediction and hyperparameter optimization. The executor agent provides feedback results to the generator agent through tool settings, forming a closed loop of hyperparameter optimization and risk prediction. LLM combines the prediction feedback information to help the generator agent further optimize the model performance in the future, so that the system can adapt to changes in a dynamic environment. The specific process includes the following steps:

[0079] S251: Establishment of feedback loop. Based on the prediction results and actual feedback of intermediate risks, the generator agent found that the model may have recognition bias for buildings with complete fire protection facilities but still with historical fire records. In order to improve the accuracy of the prediction, the generator agent adjusts the model's hyperparameter combination based on the feedback results. For example, the number of decision trees is increased to enhance the model's ability to learn complex relationships between multiple factors. The updated hyperparameter combination is as follows:

[0080] θ′={learning_rate=0.04, min_child_weight=2, n_estimators=250};

[0081] S252: Continuous optimization and adjustment. The generator agent applies new hyperparameter combinations to retrain the model and re-evaluate buildings in similar situations. This iterative optimization process helps the model to more accurately distinguish buildings with similar fire protection facilities but different fire histories, and improves the prediction stability for medium- and high-risk buildings. The optimized model shows better accuracy in practice, reduces the misjudgment rate of buildings with complete facilities but insufficient maintenance, and further improves the reliability and effectiveness of the model in practical applications.

Claims

1. A multi-agent urban building safety risk prediction method based on a large language model, characterized in that: It includes two processes: model hyperparameter optimization and security risk prediction.

2. According to claim 1, the multi-agent urban building safety risk prediction method based on a large language model is characterized in that: The model hyperparameter optimization specifically includes the following steps: S11, input background information, the background information includes hyperparameter information, data set information, optimization target and large language model information; S12, the generator agent generates a new hyperparameter combination. The generator agent first extracts relevant information from the background information through the natural language understanding ability of the large language model and generates an initial hyperparameter combination. The large language model then combines the experimental log results to enable the generator agent to generate a better hyperparameter combination in subsequent iterations. S13, the executor agent trains the model and saves the experiment log. The executor agent first trains the large language model according to the hyperparameter combination generated by the generator agent, monitors the training progress, and then conducts the experiment. After the experiment is completed, the log is automatically saved and the hyperparameters and model performance are associated; S14, LLM assists in the analysis of experimental logs. After the model training and experiment are completed, LLM extracts key information from the experimental logs, analyzes the impact of hyperparameter combinations on model performance, and generates an analysis report to provide feedback information for the next round of hyperparameter generation. S15, iterative optimization of the generator agent. The generator agent uses the analysis results of the experimental log by LLM to generate new hyperparameter combinations, and continues to iterate experiments and feedback until the performance target or time limit is reached; S16. Output the optimal hyperparameter combination to obtain the urban building safety risk prediction model.

3. According to claim 2, the multi-agent urban building safety risk prediction method based on a large language model is characterized in that: The security risk prediction specifically includes the following steps: S21, LLM processes input data and extracts features. Based on the data agent of LLM, the input building description text data is semantically parsed and features are extracted, and the unstructured text data is converted into the feature data required by the model; S22. The executor agent calls the risk prediction tool to use the optimal prediction model. The executor agent loads the pre-optimized hyperparameter combination and model weights through the tool setting module to ensure the optimal configuration of the model in the current environment. After loading, the executor agent calls the risk prediction tool to quickly and efficiently perform prediction analysis of building safety risks. The entire process does not require retraining the model, and can quickly and accurately generate risk prediction results for the building based on the current input data, ensuring that the prediction process is efficient and accurate. S23. Obtain risk prediction results. The executor agent generates risk assessment results for the building based on the output of the risk prediction tool. The risk assessment results are presented in the form of levels, including high, medium, and low risk classifications of the building. LLM assists the executor agent in interpreting the prediction results as natural language descriptions and generates a detailed risk report through the analysis result tool. The report explains the prediction results in natural language for easy understanding by users. Users can understand the risk status of each building through the report and formulate further risk control measures based on the prediction results. S24. Result analysis and feedback. After the risk prediction is completed, the executor agent uses the feedback tool to compare the prediction results with the actual situation and records the control suggestions generated by the system. LLM generates targeted risk control suggestions for users by analyzing historical feedback data and current prediction results. For example, the system can recommend strengthening security monitoring of certain buildings or optimizing emergency response strategies in specific areas. S25. Feedback loop of risk prediction and hyperparameter optimization. The executor agent provides feedback results to the generator agent through tool settings, forming a closed loop of hyperparameter optimization and risk prediction. LLM combines the prediction feedback information to help the generator agent further optimize the model performance in the future. This feedback mechanism ensures that the system remains adaptive in a dynamic environment, and continuously adjusts the optimization strategy based on new prediction data and real feedback, so that the model can better cope with future risk prediction tasks.