# MIRA-ChatGLM: A Fine-Tuned Large Language Model for Intelligent Risk Assessment in Coal Mining
## 3 Methods
### Data Sources and Pre-Processing  
To ensure that the MIRA-ChatGLM model can efficiently and accurately conduct a coal mine risk assessment, we meticulously constructed a high-quality coal mine risk assessment (RA) dataset and performed detailed preprocessing. The dataset is derived from gas sensors installed in critical safety production areas of the coal mine, collecting a wealth of historical alarm data. It covers various types of measurement points, including concentration data for gases such as CO, laser methane, and CO\({}_{2}\), as well as sensor data from locations across the mine, including ventilation shaft sensors, coal face sensors, and more. Additionally, the dataset includes different types of alarm information, such as limit exceedance alarms, sensor disconnection, and sensor calibration, ensuring comprehensive coverage of all areas within the mine. The dataset also includes the alarm causes and corresponding mitigation measures uploaded by relevant personnel after risk alarms, providing rich contextual information for the model. A sample of the main components of the dataset is shown in Table 1.  
Figure 2: Overall pipeline of GLM-4 All Tools and customized GLM (agent). In the data preprocessing stage, we conducted two rounds of screening and cleaning of the collected data. The primary purpose of the first round of screening and cleaning was to eliminate invalid and duplicate information. Since the alarm data is stored in Excel format, it contains many missing data entries, such as records with only gas concentration values but missing alarm causes or mitigation measures. There was also information redundancy, such as the inclusion of the name of the person who registered the alarm, or fields unrelated to the risk assessment, such as alarm time, production construction type, and production construction status. To address these issues, we manually screened and cleaned the data in the table, ensuring that the data used was closely related to risk assessment. The focus of the second round of screening and cleaning was to review the data fields directly related to the assessment and remove useless data. For example, we reduced the emphasis on alarm data triggered by factors such as fan switches, ensuring that the selected data was of higher quality for the assessment process. Additionally, we standardized the data format and units, unifying the gas concentration units and alarm threshold standards to ensure data consistency. Furthermore, we labeled the data by classifying and annotating the alarm data uploaded by sensors and the alarm causes and fault handling measures from safety inspection records. This step helps the model better understand and learn the characteristics of mining risks. During the data labeling process, we strictly followed standards such as the \"Coal Mine Safety Monitoring System and Detection Instrument Usage Management Specification AQ 1029-2019\" and \"Coal Mine Safety Regulations\" to ensure the accuracy and consistency of the annotations. These standards provided clear guidance for our data labeling, allowing the model to more accurately identify and predict potential gas concentration risks. The dataset we created contains 10,000 gas risk alarm records, covering four gas types: carbon monoxide, carbon dioxide, laser methane, and oxygen. Each gas type corresponds to different alarm types and their causes. From the collected data, the number of laser methane alarm records is relatively high, while oxygen alarm data is sparse, and the records for carbon monoxide and carbon dioxide alarms are moderate. After screening and processing, we selected an appropriate amount of data for each gas type, ensuring that all potential alarm situations were covered. Specifically, the dataset contains the highest proportion of sensor disconnection alarms, followed by sensor calibration alarms, with limit exceedance alarm data being less frequent.