A risk warning question-answering method and device based on a large language model

Through text blocking and vectorization processing combined with professional knowledge of the oil industry, the problem that traditional large language models cannot meet user needs in risk warning Q&A is solved, and high-quality risk warning Q&A is achieved.

CN120336495BActive Publication Date: 2025-08-22WUHAN SHENGHUAWEIYE TECHNOLGY CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510820908.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-08-22
Estimated Expiration
2045-06-19

AI Technical Summary

Technical Problem

The traditional large language model lacks professional knowledge and experience in handling the oil industry, which leads to the oil industry risk warning Q&A that cannot meet user needs.

Method used

Combining industry expertise and variable data, large language models are trained through text blocking, vectorized processing and lightweight fine-tuning to achieve accurate analysis and response to risk warning problems.

Benefits of technology

Improve the accuracy and adaptability of risk warning questions and answers, be able to understand professional background and generate high-quality responses that meet industry standards.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120336495B_ABST
    Figure CN120336495B_ABST
Patent Text Reader

Abstract

The present application provides a risk warning question-answering method and device based on a large language model, which relates to the technical field of data processing. The method includes: converting different types of specialized documents into plain text data, and performing text block processing to obtain multiple knowledge data blocks; vectorizing the risk warning questions input by the user, performing similarity matching with the stored vector database, retrieving knowledge data blocks whose similarity meets preset conditions from multiple knowledge data blocks, and constructing optimized prompt data in combination with the risk warning questions; inputting prompt data into a preset first model to obtain the reply output of the preset first model; using the prompt data and reply output, and combining with the existing question-answering data set, to train the preset second model, and after the training is completed, a question-answering model for risk warning is obtained. The present application can combine industry expertise and variable data to accurately respond to user risk warning questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data processing, and in particular to a risk warning question-answering method and device based on a large language model. Background Art

[0002] The Big Language Model is an advanced natural language processing system built using massive corpus and deep neural networks. It achieves high-quality text generation and accurate understanding through multi-level semantic understanding and contextual association capabilities. Its pre-training and fine-tuning technologies continuously improve its generalization ability and professional adaptability in multi-task scenarios. It not only performs well in traditional tasks such as question answering, summarization and translation, but also demonstrates innovative advantages in cross-modal information fusion, knowledge reasoning and situation prediction, providing strong technical support for intelligent decision-making and information services in various industries.

[0003] Risk warning Q&A in the oil industry often involves specialized knowledge in drilling, geological exploration, and equipment monitoring. Answering these questions requires not only textual information but also multivariate data analysis. For example, when abnormal conditions such as lost circulation or well collapse occur, the system must reason based on parameters such as current well depth, drilling pressure, and formation lithology. Traditional large language models lack direct experience processing this specialized knowledge, resulting in responses that fail to meet user needs. Summary of the Invention

[0004] This application provides a risk warning question-answering method and device based on a large language model, which can accurately respond to user risk warning questions by combining industry expertise and variable data.

[0005] In a first aspect of the present application, a risk warning question answering method based on a large language model is provided, the method comprising:

[0006] Convert different types of specialized documents into plain text data and process the text into blocks to obtain multiple knowledge data blocks;

[0007] Vectorize the risk warning question input by the user, perform similarity matching with the stored vector database, search for knowledge data blocks whose similarity meets preset conditions among the multiple knowledge data blocks, and construct optimized prompt data based on the risk warning question;

[0008] Input the prompt data into a preset first model, and obtain a reply output of the preset first model;

[0009] The prompt data and the reply output are used, and combined with the existing question-answer data set, to train the preset second model. After the training is completed, a question-answer model for risk warning is obtained.

[0010] Based on the above technical solution, preferably, vectorizing the risk warning question input by the user and performing similarity matching with the stored vector database specifically includes:

[0011] Separate the real-time monitoring data collected by downhole sensors involved in the risk warning problem;

[0012] Performing semantic processing on the numerical information of the real-time monitoring data to generate numerical description text;

[0013] Performing vectorization processing on the numerical description text to obtain a first sub-vector;

[0014] Performing vector processing on the descriptive text content contained in the risk warning question to obtain a second sub-vector;

[0015] Fusing the first sub-vector and the second sub-vector to obtain a first vector;

[0016] The similarity between the first vector and the second vector of the knowledge data block is calculated, thereby performing similarity matching between the knowledge data block and the risk warning question.

[0017] Based on the above technical solution, preferably, before performing semantic processing on the numerical information of the real-time monitoring data to generate numerical description text, the method further includes:

[0018] By analyzing historical downhole monitoring data and industry standards of the oil industry, and calculating the relative deviation of the historical downhole monitoring data according to the downhole operation process parameters and warning thresholds corresponding to the historical downhole monitoring data, a deviation rate is obtained;

[0019] Extracting the change trend, fluctuation amplitude and mutation point of the historical downhole monitoring data by statistical methods to obtain the trend characteristics of the historical downhole monitoring data;

[0020] Constructing a text generation template to generate a descriptive text according to the deviation rate and the trend characteristics;

[0021] A mapping relationship between the historical downhole monitoring data and the descriptive text is established to obtain a numerical conversion rule.

[0022] Based on the above technical solution, preferably, the semantic processing of the numerical information of the real-time monitoring data to generate numerical description text specifically includes:

[0023] Matching the real-time monitoring data with the historical downhole monitoring data to determine target historical monitoring data that is closest to the real-time monitoring data among a plurality of historical downhole monitoring data;

[0024] According to the numerical conversion rule, the descriptive text corresponding to the target historical monitoring data is determined, and the numerical description text corresponding to the real-time monitoring data is obtained.

[0025] Based on the above technical solution, preferably, the step of searching for a knowledge data block whose similarity meets a preset condition from the plurality of knowledge data blocks and constructing optimized prompt data in combination with context information specifically includes:

[0026] Performing structured analysis on the risk warning problem, extracting multiple first modules through named entity recognition and dependency syntax analysis, where the first modules include at least one of key entities, anomaly descriptions, time information, and core parameters;

[0027] Performing structural analysis on the target knowledge block to obtain multiple second modules, each of which includes at least one of a key entity, an anomaly description, time information, and a core parameter, wherein the target knowledge block is a knowledge data block whose similarity satisfies a preset condition after searching the multiple knowledge data blocks;

[0028] Aligning the plurality of first modules with the plurality of second modules, and generating initial prompt data through the aligned plurality of first modules and the plurality of second modules in a templated construction manner;

[0029] The thinking chain reasoning strategy is introduced to obtain the prompt data by adding step-by-step reasoning guidance sentences to the initial prompt data.

[0030] Based on the above technical solution, preferably, the prompt data and the response output are used, and combined with the existing question-answer data set, to train a preset second model. After the training is completed, a question-answer model for risk warning is obtained, which specifically includes:

[0031] Constructing a question-answering dataset based on the prompt data, the response output, and the question-answering dataset;

[0032] Preprocessing the question-answer dataset to obtain a processed dataset;

[0033] A lightweight fine-tuning method is adopted to train the preselected parameter matrix of the preset second model during the training of the preset second model using the processed data set. At the same time, the reply output is used as a soft label to train the question-answering model.

[0034] On the basis of the above technical solution, preferably, the lightweight fine-tuning method is used to train the preselected parameter matrix of the preset second model during the training of the preset second model using the processed data set, specifically including:

[0035] Setting the preselected parameter matrix, the preselected parameter matrix includes a query matrix, a key matrix, and a value matrix;

[0036] A matrix decomposition layer is added to the preselected parameter matrix to obtain a low-rank matrix, so as to train the low-rank matrix during the training process.

[0037] In a second aspect of the present application, a risk warning question-answering device based on a large language model is provided, wherein the device is configured to execute a risk warning question-answering method based on a large language model as described above, and the device comprises an acquisition module, a processing module, and an output module, wherein:

[0038] The processing module is used to convert different types of specialized documents into plain text data and perform text block processing to obtain multiple knowledge data blocks;

[0039] The processing module is configured to vectorize the risk warning question input by the user, perform similarity matching with the stored vector database, search for knowledge data blocks whose similarity meets preset conditions from the plurality of knowledge data blocks, and construct optimized prompt data in combination with the risk warning question;

[0040] The acquisition module is used to input the prompt data into the preset first model and obtain the reply output of the preset first model;

[0041] The output module is used to use the prompt data and the reply output, and combine them with the existing question and answer data set to train the preset second model. After the training is completed, a question and answer model for risk warning is obtained.

[0042] On the basis of the above technical solution, preferably, the processing module is used to separate the real-time monitoring data collected by the downhole sensor included in the risk warning problem;

[0043] The processing module is used to perform semantic processing on the numerical information of the real-time monitoring data to generate numerical description text;

[0044] The processing module is configured to perform vectorization processing on the numerical description text to obtain a first sub-vector;

[0045] The processing module is configured to perform vector processing on the description text content contained in the risk warning question to obtain a second sub-vector;

[0046] The processing module is configured to fuse the first sub-vector and the second sub-vector to obtain a first vector;

[0047] The processing module is used to calculate the similarity between the first vector and the second vector of the knowledge data block, so as to perform similarity matching between the knowledge data block and the risk warning question.

[0048] On the basis of the above technical solution, preferably, the processing module is used to analyze the historical downhole monitoring data and the industry standards of the oil industry, and calculate the relative deviation of the historical downhole monitoring data according to the downhole operation process parameters and early warning thresholds corresponding to the historical downhole monitoring data to obtain the deviation rate;

[0049] The processing module is used to extract the change trend, fluctuation amplitude and mutation point of the historical downhole monitoring data through a statistical method to obtain the trend characteristics of the historical downhole monitoring data;

[0050] The processing module is used to construct a text generation template and generate a descriptive text according to the deviation rate and the trend characteristics;

[0051] The processing module is used to establish a mapping relationship between the historical downhole monitoring data and the descriptive text to obtain a numerical conversion rule.

[0052] On the basis of the above technical solution, preferably, the processing module is used to match the real-time monitoring data with the historical downhole monitoring data, and determine the target historical monitoring data that is closest to the real-time monitoring data among the multiple historical downhole monitoring data;

[0053] The processing module is used to determine the descriptive text corresponding to the target historical monitoring data according to the numerical conversion rule, and obtain the numerical description text corresponding to the real-time monitoring data.

[0054] Based on the above technical solution, preferably, the processing module is used to perform structured analysis on the risk warning problem, and extract multiple first modules through named entity recognition and dependency syntax analysis, where the first modules include at least one of key entities, anomaly descriptions, time information, and core parameters;

[0055] The processing module is configured to perform structured analysis on the target knowledge block to obtain a plurality of second modules, wherein the second modules include at least one of a key entity, an anomaly description, time information, and a core parameter, and the target knowledge block is a knowledge data block whose similarity satisfies a preset condition when searching for the plurality of knowledge data blocks;

[0056] The processing module is configured to align the plurality of first modules with the plurality of second modules, and generate initial prompt data using the aligned plurality of first modules and the plurality of second modules in a templated construction manner;

[0057] The acquisition module is used to introduce a thought chain reasoning strategy and obtain the prompt data by adding a step-by-step reasoning guidance statement to the initial prompt data.

[0058] On the basis of the above technical solution, preferably, the processing module is used to construct a question-answering dataset according to the prompt data, the reply output, and the question-answering dataset;

[0059] The processing module is used to preprocess the question and answer dataset to obtain a processed dataset;

[0060] The processing module is used to adopt a lightweight fine-tuning method to train the preselected parameter matrix of the preset second model during the training of the preset second model using the processed data set. At the same time, the reply output is used as a soft label to train the question-answering model.

[0061] On the basis of the above technical solution, preferably, the output module is used to set the preselected parameter matrix, and the preselected parameter matrix includes a query matrix, a key matrix and a value matrix;

[0062] The output module is used to add a matrix decomposition layer to the preselected parameter matrix to obtain a low-rank matrix, thereby training the low-rank matrix during the training process.

[0063] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device performs any of the methods described above.

[0064] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions. When the instructions are executed, any one of the methods described above is executed.

[0065] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:

[0066] 1. This application builds a knowledge database based on professional documents, uses text segmentation and vector retrieval to ensure accurate acquisition of knowledge data blocks related to user risk warning questions from the industry knowledge base, and optimizes prompt data based on variable data input by the user, so that the preset first model can understand the professional background and perform reasoning analysis based on real-time monitoring data, thereby generating high-quality responses. By performing lightweight fine-tuning training on the preset second model, further integrating existing question-and-answer data sets, industry cases, and model response outputs, the learning ability of professional terminology, variable correlation analysis, and risk warning models is improved, enabling it to more accurately understand complex working conditions and provide accurate answers that meet industry standards.

[0067] 2. By separating downhole sensor data and text description information, accurate analysis of risk warning issues is achieved, and the monitoring data is converted into understandable text descriptions through the semanticization of numerical information to enhance semantic expression capabilities. Vectorization processing is used to generate numerical description vectors and text description vectors respectively, and a complete risk warning problem vector is constructed through vector fusion, which not only contains industry-specific semantic information but also integrates key parameter features. Subsequently, through vector database retrieval, the similarity between the risk warning problem vector and the knowledge data block is calculated to achieve efficient and accurate matching. It can quickly extract the most relevant historical cases and industry experience from the professional knowledge base, providing accurate knowledge support for subsequent intelligent question and answer, thereby improving the accuracy, adaptability and decision-making reliability of risk warnings.

[0068] 3. Structured analysis of risk warning questions and target knowledge blocks, accurately extracting key entities, anomaly descriptions, time information, and core parameters, and performing semantic alignment to ensure that the retrieved knowledge data blocks are deeply matched with the risk questions entered by the user. Using a templated construction approach, the aligned information is converted into structured initial prompt data, ensuring that the large language model can accurately understand the industry context and variable data during processing. Furthermore, a thought chain reasoning strategy is introduced, adding step-by-step reasoning guidance to the prompt data, enabling the model to perform multi-step reasoning based on logical deduction rather than simply matching answers, thereby improving the accuracy, explainability, and reasoning ability of the answers. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 This is a flow chart of a risk warning question-answering method based on a large language model disclosed in an embodiment of the present application;

[0070] Figure 2 This is a module diagram of a risk warning question-answering device based on a large language model disclosed in an embodiment of the present application;

[0071] Figure 3 This is a structural diagram of an electronic device disclosed in an embodiment of the present application.

[0072] Explanation of the reference numerals: 201, acquisition module; 202, processing module; 203, output module; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION

[0073] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.

[0074] In the description of the embodiments of this application, words such as "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "for example" or "for instance" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "for example" or "for instance" is intended to present the relevant concepts in a concrete manner.

[0075] In the description of the embodiments of the present application, the term "multiple" means two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.

[0076] Large language models are built on massive corpora and deep neural networks, and have multi-level semantic understanding and context association capabilities. They demonstrate excellent generalization and professional adaptability in tasks such as question answering, summarization, translation, cross-modal information fusion, knowledge reasoning, and situational prediction, providing strong support for intelligent decision-making in various industries. However, risk warning question answering in the oil industry involves highly specialized fields such as drilling, geological exploration, and equipment monitoring, and requires precise reasoning based on multivariate real-time data such as well depth, drilling pressure, and formation lithology. Traditional large language models lack experience in directly processing such professional knowledge and are therefore unable to meet the needs of high-precision risk warnings.

[0077] This embodiment discloses a risk warning question answering method based on a large language model. Figure 1 , including the following steps S110-S140:

[0078] S110, converting different types of specialized documents into plain text data, and performing text block processing to obtain multiple knowledge data blocks.

[0079] The embodiment of the present application discloses a risk warning question-and-answer method based on a large language model, which is applied to a server. The server includes, but is not limited to, electronic devices such as mobile phones, tablet computers, wearable devices, and personal computers (PCs), and can also be a backend server running a risk warning question-and-answer method based on a large language model. The server can be implemented as a standalone server or a server cluster consisting of multiple servers.

[0080] Professional documents in the oil industry typically consist of structured data and unstructured text. The structured portion covers various real-time monitoring parameters during the drilling process, such as current well depth, drilling fluid density, total pool volume, outlet flow rate, and pump pressure. These parameters are collected by sensors and recorded in detailed numerical values. The documents also contain formation data, lithology data, adjacent well operation data, and various charts and images such as well logging and seismic profiles. The unstructured portion consists of professional text descriptions written by engineering technicians. The content includes drilling accident analysis, anomaly cause determination, construction plan adjustments, and risk warning recommendations. For example, a well loss accident report may state, "When drilling to 3670.62 meters, the pump pressure dropped from the normal 28.4 MPa to 28 MPa. Simultaneously, the well fluid density changed abnormally, accompanied by a decrease in outlet flow rate. The on-site technicians initially determined that the well was lost due to rock fractures." This type of document, combining digital data, image information, and professional descriptions, provides rich context and professional background for risk warning questions and answers, enabling data-driven anomaly detection and accurate warnings.

[0081] First, by deploying a complete set of multi-format document parsing solutions, a variety of data sources such as Word documents, TXT files, CSV data tables, Excel spreadsheets, PDF files, images, and videos are uniformly processed. A dedicated document loader is used to directly read text files and extract text from PDF files. At the same time, optical character recognition technology is used to extract text information from images and videos, thereby converting various types of unstructured and semi-structured data into plain text data that can be understood by large language models. Then, in the text preprocessing module, the extracted content is cleaned, formatted, and noise filtered. Combined with the understanding of professional document content in the field, a semantic-based document slicing algorithm and sliding window strategy are used to block overly long documents. Continuous text is divided into multiple knowledge data blocks with complete context according to logic and themes. The document title, abstract, and key metadata are embedded in each data block to enhance the accuracy and efficiency of subsequent vector retrieval.

[0082] S120, vectorize the risk warning question input by the user, perform similarity matching with the stored vector database, retrieve knowledge data blocks whose similarity meets preset conditions from multiple knowledge data blocks, and construct optimized prompt data in combination with context information.

[0083] In one possible implementation, the risk warning question input by the user is vectorized and similarity matching is performed with a stored vector database, specifically including: separating the real-time monitoring data collected by downhole sensors contained in the risk warning question; performing numerical information semantic processing on the real-time monitoring data to generate a numerical description text; vectorizing the numerical description text to obtain a first sub-vector; performing vector processing on the description text content contained in the risk warning question to obtain a second sub-vector; fusing the first sub-vector with the second sub-vector to obtain a first vector; and calculating the similarity between the first vector and the second vector of the knowledge data block, thereby performing similarity matching between the knowledge data block and the risk warning question.

[0084] Specifically, we first pre-process the user-entered risk warning question using natural language processing and rule matching technology. For example, the risk warning question might be: Well JHW22-12 experienced a loss at 3670.62 m at 8:31 AM on June 27, 2024. The lost drilling fluid density was 1.47 g / cm³, the total pool volume decreased from 79.7 m³ to 179.02 m³, the loss was 0.68 m³, and the leakage rate was 40.8 m³ / h. The outlet flow rate decreased from the normal 19.6% to 13.3%, and the pump pressure decreased from the normal 28.4 MPa to 28 MPa. Other parameters were normal. Based on the above information, please analyze the cause of the well loss.

[0085] The risk warning questions input by the user are preprocessed, and named entity recognition and regular expressions are used to accurately separate the real-time monitoring data collected by downhole sensors from the mixed text, such as the current well depth, drilling fluid density, total pool volume, outlet flow, pump pressure and other numerical information, to ensure that these data can be independently extracted and accurately reflect the monitoring status. Assume that the risk warning question input by the user is:

[0086]

[0087] where q i Represents a text unit input by the user. Use sensor data to extract the function f s To separate:

[0088]

[0089] Where S represents real-time monitoring data extracted from user input, such as well depth, pump pressure, drilling fluid density, etc.

[0090] Secondly, based on the knowledge in the field of oil drilling technology and risk warning, the original numbers of the extracted real-time monitoring data are converted into descriptive text through predefined rules and comparison methods. For example, numerical description text such as "the current well depth is in the critical area" or "the pump pressure is lower than the normal working range" is generated, which intuitively expresses the risk information implicit in the data in a semantic way.

[0091] Next, we use the pre-trained embedding model to vectorize the generated numerical description text, converting the text into a high-dimensional semantic feature representation to obtain the first sub-vector that reflects the semantics of the numerical information, thereby capturing the key risk indicators and abnormal trends in the description. Define the numerical semantic conversion function f t , which converts numerical data into interpretable text descriptions:

[0092]

[0093] Among them, T is a numerical description text generated based on threshold judgment rules, trend analysis, etc., for example:

[0094]

[0095] where θ low ,θ high is the preset threshold.

[0096] The numerical description text T is vectorized through the pre-trained embedding model E to obtain the first sub-vector:

[0097]

[0098] Among them, E(t i ) is converted into a high-dimensional vector through a large language model or a domain-specific embedding model:

[0099]

[0100] At the same time, the descriptive text part of the risk warning problem other than sensor data Vectorization is also performed, and a second sub-vector reflecting background information and contextual semantics is generated through a language model adapted to the professional field to ensure that the user's semantic needs can be fully expressed.

[0101]

[0102] Subsequently, vector fusion techniques (such as vector concatenation or weighted averaging) are used to combine the first and second sub-vectors to generate a comprehensive first vector. This vector combines the semantic features of the real-time monitoring data and the contextual information of the user description text, providing a complete and accurate semantic representation for subsequent matching. Finally, the cosine similarity between the comprehensive first vector and the second vector corresponding to each knowledge data block stored in the vector database is calculated using the following formula:

[0103]

[0104] Among them, α tis the weight corresponding to the text similarity, α s is the weight corresponding to the numerical similarity, α ts is the weight corresponding to the text-value cross-modal similarity, α st is the weight corresponding to the value-text cross-modal similarity, where the text similarity is calculated using the following formula:

[0105]

[0106] Among them, d t is the dimension of the text vector or the first sub-vector. The text vector is the vector obtained by vectorizing the description text of the knowledge data block security. w ti It is the weight of the i-th dimension in the text vector or the first subvector, which is used to enhance the influence of professional terms in similarity calculation. For example, "leakage" and "crack" have higher weights.

[0107] The numerical similarity is calculated using the following formula:

[0108]

[0109] Where: d s is a numerical description of the dimension of the vector or the second subvector, w si It is the weight of the i-th dimension in the numerical description vector or the second sub-vector, which can be set according to the importance of the drilling parameters. For example, key parameters such as pump pressure and well depth have higher weights.

[0110] The text-value cross-modal similarity and value-text cross-modal similarity are calculated using the following formulas:

[0111]

[0112]

[0113] in, and is the cross-modal cross-weight, which is used to measure the impact of numerical information on textual reasoning and the complementary role of textual description on numerical data.

[0114]

[0115] in, is the first subvector of the first vector, is the second subvector of the first vector, is the numerical description vector part of the second vector, is the text vector portion of the second vector.

[0116] Knowledge data blocks that meet the preset similarity threshold are filtered out to achieve accurate matching with risk warning questions and provide high-quality contextual support for subsequent intelligent question and answer.

[0117] In one possible implementation, before performing semantic processing of numerical information on real-time monitoring data and generating numerical description text, the method also includes: analyzing historical downhole monitoring data and industry standards of the oil industry, and calculating the relative deviation of the historical downhole monitoring data based on the downhole operation process parameters and warning thresholds corresponding to the historical downhole monitoring data to obtain the deviation rate; extracting the change trend, fluctuation amplitude and mutation point of the historical downhole monitoring data through statistical methods to obtain the trend characteristics of the historical downhole monitoring data; constructing a text generation template to generate descriptive text based on the deviation rate and trend characteristics; establishing a mapping relationship between historical downhole monitoring data and descriptive text to obtain numerical conversion rules.

[0118] Specifically, we first extract key process parameters from historical downhole monitoring data, including well depth, drilling pressure, pump pressure, drilling fluid density, and outlet flow rate, from industry standards and historical drilling data. These parameters are then used to define warning thresholds. The relative deviation formula is used to calculate the deviation between the current measurement value and the normal operating range. For example, for a process parameter X, the relative deviation rate is calculated as follows:

[0119]

[0120] Among them, X normal It represents the average normal value of the parameter in historical data. It will automatically determine whether the parameter is abnormal based on the size of the deviation rate and mark it as a slight deviation, significant deviation, or severe deviation.

[0121] Next, we use statistical methods to analyze the time series trend of historical data, including calculating the fluctuation range of parameters, trend slope and mutation point. The fluctuation range can be calculated using the standard deviation:

[0122]

[0123] in, is the mean of historical data. If the standard deviation is too large, it indicates that the parameter has a sharp fluctuation and there may be potential risks. In addition, the trend slope m is calculated by linear regression:

[0124]

[0125] When m exceeds the set threshold, it indicates that the parameter has a clear upward or downward trend, and it is marked as different trend types such as "steady state", "slow growth", "rapid rise", etc. In addition, the mutation point detection adopts the Z-score method based on standard deviation:

[0126]

[0127] When | Z i When the set threshold is exceeded, the point is considered a mutation point. For example, a sudden drop in bit pressure may indicate the risk of well collapse.

[0128] After obtaining the deviation rate and trend characteristics, a text generation template is constructed based on this numerical information. For example, if the relative deviation of drilling fluid density is detected to be 8%, and trend analysis shows a continuous decline, a descriptive text can be generated according to the template: \The current drilling fluid density is 8% lower than the normal level and is showing a downward trend. There may be a risk of lost circulation. \

[0129] By combining industry terminology, numerical calculation results, and trend analysis results, this text makes the description more in line with the cognitive habits of engineers. It can also serve as input for large language models to improve the ability of question-and-answer systems to understand risks.

[0130] Finally, a mapping relationship between historical downhole monitoring data and descriptive text is established, and the deviation rate, fluctuation characteristics, and trend characteristics of different numerical intervals are mapped to corresponding text descriptions, so that future real-time data input can quickly match and generate corresponding text descriptions. For example:

[0131] Deviation rate 0-5% corresponds to "parameters slightly deviate, operation is stable"

[0132] Deviation rate of 5-15% + downward trend corresponds to "the parameter has dropped significantly, and there may be risks"

[0133] Deviation rate > 15% + increased fluctuation corresponds to "dramatic parameter changes, and serious failures may occur"

[0134] This mapping relationship is optimized through multiple iterations, making it possible to more accurately convert numerical data into readable text information and provide precise input for risk warning questions and answers.

[0135] In one possible implementation, the real-time monitoring data is semantically processed for numerical information to generate a numerical description text, specifically including: matching the real-time monitoring data with the historical downhole monitoring data to determine the target historical monitoring data that is closest to the real-time monitoring data among multiple historical downhole monitoring data; determining the descriptive text corresponding to the target historical monitoring data according to the numerical conversion rules to obtain the numerical description text corresponding to the real-time monitoring data.

[0136] Specifically, the real-time monitoring data matching algorithm is first used to find the target historical data that is closest to the current real-time data in the historical downhole monitoring data set. During the matching process, the Euclidean distance between each historical data point and the real-time data is calculated based on multivariate similarity calculations, taking into account key parameters such as well depth, drilling pressure, pump pressure, drilling fluid density, and outlet flow rate:

[0137]

[0138] Among them: H i represents the i-th historical data, R represents real-time data, H i,j and R j are the values ​​of historical data and real-time data at the jth parameter, w j is the weighting coefficient of each parameter, ensuring that the similarity matching of key parameters such as drilling fluid density, pump pressure, etc. has a greater impact.

[0139] Traverse all historical data and select H with the smallest Euclidean distance * As target historical monitoring data:

[0140]

[0141] Next, according to the numerical conversion rules, the target historical data is obtained from the historical database Corresponding descriptive text. Numeric conversion rules are based on pre-established mapping relationships, converting deviation rates, fluctuation characteristics, and trend characteristics across different numerical ranges into engineering terminology. For example, a well depth change of <2% and normal drilling pressure corresponds to "bottomhole stable, drilling pressure remains within the normal range." A 10% drop in drilling fluid density and abnormal outlet flow rate correspond to "possible well leakage; it is recommended to check the mud pump and wellbore stability." A pump pressure fluctuation of >15% and historical data showing a similar trend correspond to "violent pump pressure fluctuations, which may result in well collapse or stuck drill."

[0142] Based on the matched target historical data H * Directly search for the corresponding descriptive text T(H * ):

[0143]

[0144] Thus, the numerical description text of the real-time monitoring data is obtained.

[0145] Finally, the descriptive text is automatically supplemented and formatted with the specific numerical information of the real-time data to ensure that the generated text conforms to the cognitive mode of engineers. For example: real-time data R: well depth 3670.62m, pump pressure drop 1.5MPa, outlet flow rate drop 19.6%; target historical data H *: Matching the historical record of a depth of 3675m, the pump pressure dropped by 1.4 MPa and the outlet flow rate decreased by 18%. The final numerical description text generated is: "The current drilling depth is 3670.62m. The pump pressure dropped by 1.5 MPa and the outlet flow rate dropped by 19.6%. Historical data shows that there may be a risk of lost circulation in similar situations. It is recommended to check the drilling fluid density and wellbore stability."

[0146] This method matches the most similar historical data and combines it with preset numerical conversion rules to ensure that the generated descriptive text not only has industry knowledge background but can also be personalized according to real-time data, providing more accurate risk warning input for large language models.

[0147] In one possible implementation, knowledge data blocks whose similarity meets preset conditions are retrieved from multiple knowledge data blocks, and optimized prompt data is constructed in combination with context information, specifically including: performing structured analysis on the risk warning problem, extracting multiple first modules through named entity recognition and dependency syntax analysis, and the first module includes at least one of key entities, abnormal descriptions, time information and core parameters; performing structured analysis on the target knowledge block to obtain multiple second modules, and the second module includes at least one of key entities, abnormal descriptions, time information and core parameters, and the target knowledge block is a knowledge data block whose similarity meets preset conditions is retrieved from multiple knowledge data blocks; aligning the multiple first modules with the multiple second modules, and using a templated construction method to generate initial prompt data through the aligned multiple first modules and the multiple second modules; introducing a thinking chain reasoning strategy, and obtaining prompt data by adding step-by-step reasoning guidance statements to the initial prompt data.

[0148] Specifically, the system first performs a structured analysis of the risk warning question input by the user. Using named entity recognition (NER) and dependency parsing techniques, it extracts multiple first modules from the question text, including key entities (such as well number, well area, and operation type), anomaly descriptions (such as lost circulation, well collapse, and stuck pipe), time information (such as occurrence time and duration), and core parameters (such as well depth, drilling pressure, pump pressure, and outlet flow rate). A pre-trained NER model is first used to annotate the text with entities, and a rule-based parsing algorithm is used to extract key parameters for specific fields. Dependency parsing is then used to identify grammatical relationships and extract the subject-verb-object structure of the abnormal behavior from the sentence for effective matching with the knowledge data block.

[0149] Next, the target knowledge block undergoes structured parsing. This involves performing the same entity extraction and dependency parsing on the multiple retrieved knowledge blocks to obtain the second module, which also includes key entities, anomaly descriptions, time information, and core parameters. Because knowledge blocks may contain different industry standards, historical cases, and experience summaries, they are first denoised and summarized to ensure that the extracted information is consistent with the logic of the user's input question. Furthermore, text semantic similarity is calculated to filter out the knowledge blocks most relevant to the question and sort them in descending order of relevance to ensure the quality of the aligned data.

[0150] Then, the first module and the second module are aligned, and the closest structural counterparts are found based on semantic matching and feature mapping algorithms. For example, if the user's question involves a specific well number and drilling pressure anomaly, and the knowledge data block contains historical well leakage cases with the same well number, the corresponding historical data will be matched first. Using a templated construction method, after aligning the first and second modules, the initial prompt data is generated according to the preset prompt word structure. This structure usually adopts the "role-target-input format-output format" framework to ensure that the large language model can accurately understand the problem. For example, the input format may use "well number + current anomaly parameters + historical matching cases", while the output format requires the model to reason based on case data.

[0151] Finally, we introduce a Chain-of-Thought (CoT) reasoning strategy, which adds step-by-step reasoning guidance to the initial prompt data to guide the large language model in hierarchical reasoning. For example, the prompt data first guides the model to analyze the factors affecting the current abnormal data, then conducts pattern matching based on historical cases, and finally generates a reasonable conclusion based on existing treatment recommendations. This strategy can significantly improve the professionalism and logical coherence of answers, allowing them to not only provide direct answers but also explain the reasoning process, thereby enhancing the credibility and interpretability of question and answering.

[0152] For example, a user enters a risk warning question: Well JHW22-12 experienced lost circulation at 3670.62 m at 8:31 AM on June 27, 2024. The drilling fluid density was 1.47 g / cm³, the total pool volume decreased from 79.7 m³ to 179.02 m³, the leakage was 0.68 m³, the leakage rate was 40.8 m³ / h, the outlet flow rate decreased from 19.6% to 13.3%, and the pump pressure decreased from 28.4 MPa to 28 MPa. Analyze the cause of the lost circulation based on historical data.

[0153] Parse the text entered by the user and extract key entities, exception description, time information, and core parameters to form the first module: Key entity: Well number JHW22-12, time 2024-06-278:31; exception description: Well leakage; time information: 2024-06-278:31; core parameters: Well depth 3670.62m, drilling fluid density 1.47g / cm³, total pool volume reduction 0.68m³, leakage rate 40.8m³ / h, outlet flow rate decreased from 19.6% to 13.3%, pump pressure decreased from 28.4MPa to 28MPa

[0154] The vector database was searched for the historical knowledge data block with the highest similarity, matched with historical drilling records, and parsed to extract the second module. Knowledge data block 1 (92% match) was retrieved: Well JHW22-11 experienced lost circulation at a depth of 3700 m, with a pump pressure drop of 27-31 MPa. Curvature attributes of the superimposed seismic profile indicated the development of fractures near the bottom of the well. Three loss risk points existed in the Jurassic and Triassic formations, and historical cases have shown that similar formations are prone to loss. Knowledge data block 2 (88% match) was retrieved: A similar lost circulation occurred within a depth of 3680 m in a certain oilfield. Cause analysis indicated that drilling through a highly porous fracture zone resulted in large-scale loss of drilling fluid.

[0155] The knowledge data block is structured and parsed to extract the second module: key entity: well number JHW22;11, well depth 3700m; anomaly description: lost circulation; time information: historical case; core parameters: pump pressure drop of 27-31MPa, development of bottom hole fractures, three leakage risk points in the Jurassic and Triassic systems, and high-porosity fracture zones causing lost circulation.

[0156] Align the first module with the second module to generate initial prompt data:

[0157] 1. Well number matching: JHW22-12 (user input) and JHW22-11 (historical knowledge) have different well numbers but similar well depths (3670.62m and 3700m), and may belong to the same geological structure.

[0158] 2. Anomaly matching: Based on the lost circulation data input by the user and the lost circulation data in historical data (formation fractures, high porosity zones), the alignment conclusion is that the lost circulation data input by the user may be related to formation fractures.

[0159] 3. Pump pressure and flow matching: According to the user input, the pump pressure dropped from 28.4MPa to 28MPa, and the outlet flow rate dropped from 19.6% to 13.3%. The pump pressure of the historical data was 27-31MPa, and the flow rate was abnormal. The alignment conclusion was that the flow rate decline trend was consistent with the historical case.

[0160] Next, construct initial data: Well JHW22-12 experienced lost circulation at 3670.62 m, with a drilling fluid density of 1.47 g / cm³, a pump pressure drop of 28.4 MPa to 28 MPa, and a drop in outlet flow rate of 19.6% to 13.3%. Well JHW22-11 also experienced lost circulation at 3700 m. Historical data indicates that seismic profiles show wellbore fractures. Please analyze the cause of this lost circulation.

[0161] Finally, we introduce a thinking chain reasoning strategy to improve the reasoning ability of the large language model, introduce step-by-step reasoning guidance, and optimize the prompt data:

[0162] Step 1: Analyze whether the current abnormal data is consistent with historical cases. The current well depth is 3670.62m, the pump pressure has dropped by 0.4MPa, and the outlet flow has dropped by 6.3%. Does this conform to historical well leakage cases?

[0163] Step 2: Analyze the bottom hole formation characteristics based on historical cases. Historical data shows that bottom hole fractures are developed at 3700m. Is it possible that this will affect the position at 3670.62m?

[0164] Step 3: Comprehensively analyze the possible causes of lost circulation, combine current drilling parameters and historical cases, and determine the main causes of lost circulation.

[0165] Final optimized prompt data: You are a drilling engineering expert and need to analyze the lost circulation phenomenon occurring in well JHW22-12 at 3670.62 m. The following drilling parameters are provided: drilling fluid density: 1.47 g / cm³, pump pressure: 28.4 MPa to 28 MPa, outlet flow rate: 19.6% to 13.3%, well depth: 3670.62 m. Historical data: Well JHW22-11 experienced lost circulation at 3700 m. Three loss risk points exist in the Jurassic and Triassic strata. Bottomhole fractures are well-developed, and high-porosity fracture zones contribute to fluid loss. Please follow the steps below to analyze the cause of the lost circulation: 1. Based on the current drilling parameters, determine the lost circulation trend. 2. Analyze whether the bottomhole formation structure may be contributing to fluid loss. 3. Based on historical data and drilling parameters, determine the possible cause of the lost circulation and recommend preventive measures.

[0166] S130: Input prompt data to the preset first model, and obtain a reply output of the preset first model.

[0167] After constructing the optimized prompt data, it is input into the pre-set first model to generate the response output for the risk warning question and answer. The specific implementation process includes model adaptation, input format conversion, context management, reasoning optimization, and result analysis. The pre-set first model uses a conventional commercial large model.

[0168] First, prompt data is formatted according to the input requirements of the selected large language model to ensure that the input text structure meets the model's parsing capabilities. For example, complex parameters are converted to JSON or key variables are annotated to enable the model to accurately understand the input. Next, a context management mechanism is used to ensure that information such as user interactions, retrieved knowledge blocks, and real-time monitoring data remains consistent across multiple rounds of conversation, enhancing the model's reasoning capabilities and coherence. Subsequently, dynamic reasoning optimization strategies, such as Chain-of-Thought (CoT) reasoning and ReAct (Reason+Act) strategies, guide the model to analyze risk causes step by step in a logical manner, match historical cases, and propose appropriate preventive measures. Finally, the model's raw output is parsed and structured, such as extracting core insights, checking unit conversions, and ensuring that the output conforms to industry terminology standards. Confidence scoring is used to assess the reliability of responses. If confidence is insufficient, the input prompt data is re-optimized and reasoning is re-performed, generating accurate risk warning Q&A responses that can be used in real-world engineering decisions.

[0169] After inputting the optimized prompt data into the large language model, the expected output might be: Based on current drilling parameters and historical data, the lost circulation in Well JHW22-12 is likely caused by bottomhole fractures. A 0.4 MPa drop in pump pressure and a 6.3% decrease in outlet flow rate indicate the presence of a high-porosity zone at the bottomhole, leading to fluid loss. Historical data indicates a similar occurrence at 3700 m in the adjacent well JHW22-11. Combined with seismic profile analysis, bottomhole fractures may have extended to 3670.62 m. It is recommended to adjust the drilling fluid density and use a plugging agent to improve wellbore stability.

[0170] S140, using the prompt data and the response output, and combining it with the existing question-answer data set, the preset second model is trained, and after the training is completed, a question-answer model for risk warning is obtained.

[0171] In one possible implementation, the preset second model is trained using prompt data and reply output in combination with an existing question-and-answer dataset. After the training is completed, a question-and-answer model for risk warning is obtained, which specifically includes: constructing a question-and-answer dataset based on the prompt data and reply output, as well as the question-and-answer dataset; preprocessing the question-and-answer dataset to obtain a processed dataset; using a lightweight fine-tuning method, in the process of training the preset second model using the processed dataset, training the preselected parameter matrix of the preset second model, and at the same time, using the reply output as a soft label to train the question-and-answer model.

[0172] Specifically, first, a high-quality question-answering dataset is constructed based on the prompt data, model response output, and existing question-answering datasets to enhance the understanding and reasoning ability of the preset second model for risk warning tasks. During the data construction process, the prompt data is paired with the response output, and combined with the existing expert-labeled question-answering data to form a multi-level question-answering dataset that includes input questions, knowledge background, historical cases, reasoning process, and final answers, to ensure that the model can learn the complete decision-making logic during the training process. At the same time, in order to improve the generalization ability of the data, data enhancement techniques such as synonymous substitution, sentence reconstruction, and random loss of some input information are used to construct more diverse question-answering samples to avoid overfitting the model to certain specific expressions.

[0173] Next, the question-answering dataset undergoes data preprocessing to ensure the quality and consistency of the training data. First, the data undergoes text standardization to align terminology (e.g., "pump pressure drop" is consistent with "pump pressure reduction") and convert different units to reduce training errors caused by inconsistent data formats. Second, text cleaning techniques are used to remove redundant information, formatting errors, and low-quality data that could affect training effectiveness. The data is then annotated in layers, categorized by question type (e.g., lost circulation analysis, drilling pressure anomalies, equipment failure prediction) and difficulty level (e.g., direct matching vs. complex reasoning). This allows for a phased learning strategy during training, allowing the model to gradually adapt from simple tasks to complex reasoning tasks.

[0174] During the model training phase, a lightweight fine-tuning method (LoRA or Adapter) is used to train only the pre-selected parameter matrix in the preset second model, avoiding the high computational cost caused by full parameter fine-tuning.

[0175] In one possible implementation, a lightweight fine-tuning method is adopted. During the process of training the preset second model by processing the data set, the preselected parameter matrix of the preset second model is trained, specifically including: setting the preselected parameter matrix, the preselected parameter matrix including a query matrix, a key matrix and a value matrix; adding a matrix decomposition layer to the preselected parameter matrix to obtain a low-rank matrix, thereby training the low-rank matrix during the training process.

[0176] Specifically, we first set the preselected parameter matrix, that is, determine the parameters that need to be fine-tuned in the preset second model (such as the large language model with a Transformer structure). Since full parameter fine-tuning requires large computing resources and is prone to overfitting, this solution only fine-tunes the query matrix (W Q ), KeyMatrix (KeyMatrix, W K ), Value Matrix (ValueMatrix, WV ) for selective training. These matrices are located in the Transformer model's attention mechanism (Self-Attention Layer) and are primarily used to calculate relationships between input tokens. By optimizing these matrices, the model's specificity for risk warning tasks can be enhanced without modifying the entire network structure. Furthermore, when setting the preselected parameter matrix, other model parameters, such as the feedforward network, are frozen, ensuring that training optimizes only the most critical attention weights.

[0177] Next, a matrix decomposition layer is added to the pre-selected parameter matrix to obtain a low-rank matrix, specifically using the LoRA (Low-Rank Adaptation) low-rank adaptation method. LoRA is implemented by using the W Q ,W K ,W V A trainable low-rank decomposition layer is inserted into the matrix, while the original parameters remain frozen, thereby reducing the amount of training calculations and improving the generalization ability of the model. Under the LoRA structure, each original weight matrix W is replaced by:

[0178]

[0179] Where: A and B are trainable low-rank matrices that satisfy , where r is much smaller than d (e.g. r = 4, d = 1024). Only A and B are trained, while W remains frozen, effectively reducing the computational resources required for training.

[0180] Finally, during training, only the low-rank matrix is ​​optimized, and the gradients of A and B are updated using an adaptive gradient optimization algorithm (such as AdamW). At the same time, combined with knowledge distillation, the responses of the first model are used as soft labels to calculate the KL divergence loss:

[0181]

[0182] In addition, the cross entropy loss is used to calculate the hard label error:

[0183]

[0184] The final optimization objective function is:

[0185]

[0186] λ1 and λ2 control the weight ratio of hard and soft labels, ensuring that the model learns both the true answers and the reasoning patterns of the first model. After training, the low-rank matrices A and B are optimized, enabling the fine-tuned question-answering model to provide more professional answers in risk warning tasks. Furthermore, since only the low-rank component is trained, the overall model computational cost is significantly reduced, making it suitable for real-world applications.

[0187] To improve training efficiency and effectiveness, optimization strategies such as gradient accumulation, adaptive learning rate adjustment (CosineAnnealing), and mixed-precision training (FP16) were employed to ensure stable model convergence. Furthermore, to enhance the model's robustness in diverse environments, adversarial training was employed to test the model's adaptability by artificially introducing input perturbations (such as spelling errors and inputs with different formats). Training strategies were then adjusted through error feedback. Finally, after training, the model was evaluated using metrics such as BLEU scores, cosine similarity calculations, and terminology matching rates to measure the performance of the question-answering model. The model was then tested in real-world risk warning scenarios to ensure that it could accurately answer risk questions. The result was an intelligent question-answering model for risk warning in the oil industry.

[0188] This embodiment also discloses a risk warning question-answering device based on a large language model, which is used to execute any of the above-mentioned risk warning question-answering methods based on a large language model. Figure 2 The device includes an acquisition module 201, a processing module 202 and an output module 203, wherein:

[0189] The processing module 202 is used to convert different types of specialized documents into plain text data and perform text block processing to obtain multiple knowledge data blocks.

[0190] The processing module 202 is used to vectorize the risk warning question input by the user, perform similarity matching with the stored vector database, retrieve knowledge data blocks whose similarity meets preset conditions from multiple knowledge data blocks, and construct optimized prompt data based on the risk warning question.

[0191] The acquisition module 201 is used to input prompt data into a preset first model and obtain a reply output of the preset first model.

[0192] The output module 203 is used to use the prompt data and the reply output, and to train the preset second model in combination with the existing question-answer data set. After the training is completed, a question-answer model for risk warning is obtained.

[0193] In a possible implementation, the processing module 202 is used to separate the real-time monitoring data collected by downhole sensors included in the risk warning problem.

[0194] The processing module 202 is used to perform semantic processing on the numerical information of the real-time monitoring data and generate numerical description text.

[0195] The processing module 202 is configured to perform vectorization processing on the numerical description text to obtain a first sub-vector.

[0196] The processing module 202 is configured to perform vector processing on the description text content included in the risk warning question to obtain a second sub-vector.

[0197] The processing module 202 is configured to fuse the first sub-vector and the second sub-vector to obtain a first vector.

[0198] The processing module 202 is configured to calculate the similarity between the first vector and the second vector of the knowledge data block, thereby performing similarity matching between the knowledge data block and the risk warning question.

[0199] In one possible implementation, the processing module 202 is used to analyze the historical downhole monitoring data and the industry standards of the oil industry, calculate the relative deviation of the historical downhole monitoring data based on the downhole operation process parameters and warning thresholds corresponding to the historical downhole monitoring data, and obtain the deviation rate.

[0200] The processing module 202 is used to extract the change trend, fluctuation amplitude and mutation point of the historical downhole monitoring data through statistical methods to obtain the trend characteristics of the historical downhole monitoring data.

[0201] The processing module 202 is used to construct a text generation template and generate a descriptive text according to the deviation rate and trend characteristics.

[0202] The processing module 202 is used to establish a mapping relationship between historical downhole monitoring data and descriptive text to obtain a numerical conversion rule.

[0203] In a possible implementation, the processing module 202 is configured to match the real-time monitoring data with the historical downhole monitoring data, and determine target historical monitoring data that is closest to the real-time monitoring data among multiple historical downhole monitoring data.

[0204] The processing module 202 is used to determine the descriptive text corresponding to the target historical monitoring data according to the numerical conversion rule, and obtain the numerical description text corresponding to the real-time monitoring data.

[0205] In one possible implementation, the processing module 202 is used to perform structured analysis on the risk warning problem, and extract multiple first modules through named entity recognition and dependency syntax analysis. The first modules include at least one of key entities, anomaly descriptions, time information, and core parameters.

[0206] Processing module 202 is used to perform structured analysis on the target knowledge block to obtain multiple second modules, which include at least one of key entities, exception descriptions, time information and core parameters. The target knowledge block is a knowledge data block retrieved from multiple knowledge data blocks whose similarity meets preset conditions.

[0207] The processing module 202 is used to align the plurality of first modules with the plurality of second modules, and generate initial prompt data through the aligned plurality of first modules and the plurality of second modules in a templated construction manner.

[0208] The acquisition module 201 is used to introduce the thought chain reasoning strategy, and obtain prompt data by adding step-by-step reasoning guidance sentences to the initial prompt data.

[0209] In a possible implementation, the processing module 202 is configured to construct a question-answering dataset based on the prompt data and the response output, as well as the question-answering dataset.

[0210] The processing module 202 is used to preprocess the question and answer dataset to obtain a processed dataset.

[0211] The processing module 202 is used to adopt a lightweight fine-tuning method to train the pre-selected parameter matrix of the preset second model in the process of training the preset second model by processing the data set. At the same time, the reply output is used as a soft label to train the question-answering model.

[0212] In a possible implementation, the output module 203 is configured to set a preselected parameter matrix, where the preselected parameter matrix includes a query matrix, a key matrix, and a value matrix.

[0213] The output module 203 is used to add a matrix decomposition layer to the preselected parameter matrix to obtain a low-rank matrix, so as to train the low-rank matrix during the training process.

[0214] It should be noted that the above embodiments provide devices that implement their functions using only the division of the above functional modules as examples. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0215] This embodiment also discloses an electronic device, referring to Figure 3 The electronic device may include: at least one processor 301 , at least one communication bus 302 , a user interface 303 , a network interface 304 , and at least one memory 305 .

[0216] The communication bus 302 is used to implement the connection and communication between these components.

[0217] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.

[0218] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).

[0219] The processor 301 may include one or more processing cores. Using various interfaces and circuits, the processor 301 connects to various components within the server. It executes instructions, programs, code sets, or instruction sets stored in the memory 305, as well as accesses data stored in the memory 305, to perform various server functions and process data. Optionally, the processor 301 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 301 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing content displayed on the display screen; and the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 301 but implemented as a separate chip.

[0220] Memory 305 may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory may include non-transitory computer-readable storage medium. Memory 305 may be used to store instructions, programs, code, code sets, or instruction sets. Memory 305 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, sound playback function, image playback function, etc.), instructions for implementing each of the aforementioned method embodiments, and the data storage area may store data related to each of the aforementioned method embodiments. Memory 305 may also optionally be at least one storage device located remotely from the processor 301. Memory 305, as a computer storage medium, may include an operating system, a network communication module, a user interface 303 module, and an application for a risk warning question-and-answer method based on a large language model.

[0221] exist Figure 3 In the electronic device shown, the user interface 303 is mainly used to provide an input interface for the user and obtain data input by the user; and the processor 301 can be used to call an application program stored in the memory 305 for a risk warning question and answer method based on a large language model. When executed by one or more processors 301, the electronic device executes one or more methods in the above embodiments.

[0222] It should be noted that for the aforementioned method embodiments, for simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for this application.

[0223] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0224] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely schematic, such as the division of units, which is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interface, and the indirect coupling or communication connection of devices or units can be electrical or other forms.

[0225] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0226] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0227] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of this application, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory 305 and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of this application. The aforementioned memory 305 includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a magnetic disk, or an optical disk.

[0228] The present application also discloses a computer-readable storage medium storing instructions, which, when executed by one or more processors 301, enable an electronic device to execute one or more of the methods described in the above embodiments.

[0229] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure. This application is intended to cover any variation, use or adaptive change of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art that are not recorded in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.

Claims

1. A risk warning question-answering method based on a large language model, characterized in that: The method comprises: Convert different types of specialized documents into plain text data and process the text into blocks to obtain multiple knowledge data blocks; Vectorize the risk warning question input by the user, perform similarity matching with the stored vector database, search for knowledge data blocks whose similarity meets preset conditions among the multiple knowledge data blocks, and construct optimized prompt data based on the risk warning question; Input the prompt data into a preset first model, and obtain a reply output of the preset first model; The prompt data and the response output are used, and combined with an existing question-answer data set, to train a preset second model. After the training is completed, a question-answer model for risk warning is obtained; The step of searching for a knowledge data block whose similarity satisfies a preset condition from the plurality of knowledge data blocks and constructing optimized prompt data in combination with context information specifically includes: Performing structured analysis on the risk warning problem, extracting multiple first modules through named entity recognition and dependency syntax analysis, where the first modules include at least one of key entities, anomaly descriptions, time information, and core parameters; Performing structural analysis on the target knowledge block to obtain multiple second modules, each of which includes at least one of a key entity, an anomaly description, time information, and a core parameter, wherein the target knowledge block is a knowledge data block whose similarity satisfies a preset condition after searching the multiple knowledge data blocks; Aligning the plurality of first modules with the plurality of second modules, and generating initial prompt data through the aligned plurality of first modules and the plurality of second modules in a templated construction manner; The thinking chain reasoning strategy is introduced to obtain the prompt data by adding step-by-step reasoning guidance sentences to the initial prompt data.

2. A risk warning question-answering method based on a large language model according to claim 1, characterized in that: The risk warning question input by the user is vectorized and similarity matched with the stored vector database, specifically including: Separate the real-time monitoring data collected by downhole sensors involved in the risk warning problem; Performing semantic processing on the numerical information of the real-time monitoring data to generate numerical description text; Performing vectorization processing on the numerical description text to obtain a first sub-vector; Performing vector processing on the descriptive text content contained in the risk warning question to obtain a second sub-vector; Fusing the first sub-vector and the second sub-vector to obtain a first vector; The similarity between the first vector and the second vector of the knowledge data block is calculated, thereby performing similarity matching between the knowledge data block and the risk warning question.

3. The risk warning question-answering method based on a large language model according to claim 2, characterized in that: Before performing semantic processing on the numerical information of the real-time monitoring data to generate numerical description text, the method further includes: By analyzing historical downhole monitoring data and industry standards of the oil industry, and calculating the relative deviation of the historical downhole monitoring data according to the downhole operation process parameters and warning thresholds corresponding to the historical downhole monitoring data, a deviation rate is obtained; Extracting the change trend, fluctuation amplitude and mutation point of the historical downhole monitoring data by statistical methods to obtain the trend characteristics of the historical downhole monitoring data; Constructing a text generation template to generate a descriptive text according to the deviation rate and the trend characteristics; A mapping relationship between the historical downhole monitoring data and the descriptive text is established to obtain a numerical conversion rule.

4. The risk warning question-answering method based on a large language model according to claim 3, characterized in that: The performing semantic processing of numerical information on the real-time monitoring data to generate numerical description text specifically includes: Matching the real-time monitoring data with the historical downhole monitoring data to determine target historical monitoring data that is closest to the real-time monitoring data among a plurality of historical downhole monitoring data; According to the numerical conversion rule, the descriptive text corresponding to the target historical monitoring data is determined, and the numerical description text corresponding to the real-time monitoring data is obtained.

5. The risk warning question-answering method based on a large language model according to claim 1, characterized in that: The prompt data and the response output are used, and combined with the existing question-answer data set, to train the preset second model. After the training is completed, a question-answer model for risk warning is obtained, which specifically includes: Constructing a question-answering dataset based on the prompt data, the response output, and the question-answering dataset; Preprocessing the question-answer dataset to obtain a processed dataset; A lightweight fine-tuning method is adopted to train the preselected parameter matrix of the preset second model during the training of the preset second model using the processed data set. At the same time, the reply output is used as a soft label to train the question-answering model.

6. The risk warning question-answering method based on a large language model according to claim 5, characterized in that: The lightweight fine-tuning method is used to train the preselected parameter matrix of the preset second model during the training of the preset second model using the processed data set, specifically including: Setting the preselected parameter matrix, the preselected parameter matrix includes a query matrix, a key matrix, and a value matrix; A matrix decomposition layer is added to the preselected parameter matrix to obtain a low-rank matrix, so as to train the low-rank matrix during the training process.

7. A risk warning question-answering device based on a large language model, characterized in that: The device is used to execute the risk warning question-answering method based on a large language model according to any one of claims 1 to 6, and the device includes an acquisition module, a processing module, and an output module, wherein: The processing module is used to convert different types of specialized documents into plain text data and perform text block processing to obtain multiple knowledge data blocks; The processing module is configured to vectorize the risk warning question input by the user, perform similarity matching with the stored vector database, search for knowledge data blocks whose similarity meets preset conditions from the plurality of knowledge data blocks, and construct optimized prompt data in combination with the risk warning question; The acquisition module is used to input the prompt data into the preset first model and obtain the reply output of the preset first model; The output module is used to use the prompt data and the reply output, and combine them with the existing question and answer data set to train the preset second model. After the training is completed, a question and answer model for risk warning is obtained.

8. An electronic device, characterized in that: The electronic device comprises a processor, a communication bus, a user interface, a network interface and a memory, wherein the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, the communication bus is used to realize connection and communication between components in the electronic device, and the processor is used to execute the instructions stored in the memory so that the electronic device executes the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 6 is executed.

Citation Information

Patent Citations

  • Multi-modal knowledge question and answer retrieval method and system for specific professional field

    CN119621921A