Large model-based engineering optimization system and method integrating domain knowledge graph
Through the knowledge graph, a dynamic prompt template is generated and a closed-loop optimization mechanism is established, which solves the problem of lack of professional constraints in oil and gas exploration of large language models, and improves the accuracy of answers and iterative efficiency.
Patent Information
- Application Number
- CN202510685760.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-05-27
AI Technical Summary
The answer accuracy of the large language model in the field of oil and gas exploration is low due to the lack of professional constraints. It is difficult for the existing technology to systematically integrate professional parameter constraints such as reservoir physical properties and geological structure, and there is a lack of a dynamic constraint injection mechanism.
Dynamic prompt templates are generated through the knowledge graph automatically extracting domain parameters, and a feedback-driven closed-loop optimization mechanism is established, including analytical modules, template generation engine modules, large-model interaction interface modules, feedback analysis modules and optimization strategy modules to achieve continuous adaptation of professional constraints and language models.
It improves the accuracy of the answers of large models in the field of oil and gas exploration, solves the problems of poor interpretation and high iteration costs of existing systems in professional scenarios, and realizes the continuous adaptation of professional constraints and language models.
Smart Images

Figure CN120196734B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer image processing technology, and in particular to a large-scale model prompting engineering optimization system and method integrating domain knowledge graphs. Background Art
[0002] In recent years, large language models, such as GPT, have demonstrated powerful natural language processing capabilities in general applications. However, they face significant limitations in specialized fields like oil and gas exploration. Traditional prediction engineering methods rely on manually designed fixed templates, making it difficult to systematically incorporate specialized parameter constraints such as reservoir properties and geological structure. This often leads to numerical deviations or logical errors in model output that are inconsistent with industry standards.
[0003] In existing technologies, although knowledge graphs can store domain knowledge in a structured manner, their interaction with natural language generation models mostly remains at the static knowledge retrieval level and lacks a dynamic constraint injection mechanism. The oil and gas exploration field is characterized by complex parameters and strict rules. For example, reservoir evaluation needs to consider the threshold relationship of multi-dimensional indicators such as porosity, permeability, and oil saturation, and general large models cannot spontaneously understand the inherent relationship between these professional constraints. Current solutions attempt to adapt to professional fields by fine-tuning model parameters, but face problems such as scarce training data and lagging knowledge updates, and are difficult to cope with the evolving decision-making logic in exploration scenarios. On the other hand, although rule-based post-processing verification methods can correct some explicit errors, they destroy the end-to-end consistency of the generation process, resulting in a decrease in semantic coherence.
[0004] Existing patented technologies propose linking knowledge graph entities to question-answering systems, but fail to address the dynamic adaptation of constraints and prompt templates. Reinforcement learning is used to optimize dialogue strategies, but a closed-loop feedback mechanism for knowledge graph verification and template generation has not been established. Industry practice demonstrates that simply expanding the scale of training data or adding manual verification steps cannot fundamentally improve the reasoning reliability of large models in specialized scenarios. These limitations result in existing systems suffering from poor interpretability, high iteration costs, and weak domain adaptability in practical applications of oil and gas exploration, severely restricting the in-depth application of artificial intelligence technology in exploration decision support. Summary of the Invention
[0005] In light of the shortcomings of the prior art, the present invention aims to provide a large-scale model prompting engineering optimization system and method that integrates domain knowledge graphs. This system addresses the low accuracy of large models in oil and gas exploration, often caused by a lack of specialized constraints. This system automatically extracts domain parameters from knowledge graphs to generate dynamic prompting templates, and establishes a feedback-driven closed-loop optimization mechanism.
[0006] The present invention provides a large model prompt engineering optimization system integrating domain knowledge graph, including:
[0007] Parsing module, the parsing module extracts parameterized constraints through entity relationship topology analysis algorithm and forms a constraint coding signal containing entity attribute association matrix;
[0008] Template generation engine module: The template generation engine module uses syntax tree dynamic reorganization technology to process constraint coding signals, injects constraint conditions into the preset template framework, and forms an enhanced prompt text flow with reservoir physical property parameter slots;
[0009] The large model interactive interface module receives the enhanced prompt text stream and synchronously loads the knowledge graph verification rule set to generate a question-and-answer response data stream containing geological professional terms;
[0010] Feedback analysis module: The feedback analysis module receives the question-answer response data stream and uses the semantic error vector calculation algorithm to logically match the model output results with the knowledge graph standard data to form a feedback signal containing semantic deviation measurement;
[0011] The optimization strategy module receives feedback signals and dynamically adjusts the weight coefficients of reservoir physical property parameters in the template generation process based on the reinforcement learning mechanism, forms parameter optimization instruction signals and transmits them to the analysis module to complete the iterative update of constraint conditions.
[0012] In one embodiment of the present invention, the specific implementation method of the entity relationship topology analysis algorithm in the parsing module is: a multidimensional topological network is constructed by combining the attribute similarity calculation of the knowledge graph entity nodes with the relationship path weight allocation, wherein the attribute similarity calculation adopts a vector space model based on cosine similarity to embed the entity description text, and the relationship path weight allocation adopts an attenuation function to dynamically adjust the multi-hop association path; the constraint coding signal includes a sparse coding format of the entity attribute association matrix and a normalized weight coefficient sequence, wherein the sparse coding format adopts a hash mapping table to store the combination relationship between the entity type and the attribute key-value pair, and the normalized weight coefficient sequence is generated by the product calculation of the node centrality index and the path attenuation value in the topological network. The parsing module screens the effective constraint conditions through the dynamic weight threshold filtering mechanism to form a parameterized constraint signal with a hierarchical structure and transmit it to the template generation engine module.
[0013] In one embodiment of the present invention, when the dynamic syntax tree reconstruction technology is performed in the template generation engine module, dependency syntax analysis is performed on the preset template framework to generate an initial syntax tree structure, replaceable nodes in the syntax tree are located according to the parameter slot type in the constraint coding signal, a bidirectional attention mechanism is used to calculate the semantic matching degree between the constraint conditions and the context, the parameter insertion position is dynamically selected and the syntax tree branch is reconstructed; the generation process of the enhanced prompt text stream includes dynamic filling of parameter slots and semantic coherence verification, wherein the dynamic filling adopts a combination of rule-based regular expression matching and neural network-based context prediction, and the semantic coherence verification uses a pre-trained language model to perform a fluency score on the reorganized prompt text. When the score is lower than the set threshold, the syntax tree backtracking mechanism is triggered to reselect the insertion node, and the template generation engine module encapsulates the verified prompt text stream into a structured instruction set and transmits it to the large model interaction interface module.
[0014] In one embodiment of the present invention, a method for constructing a knowledge graph verification rule set in a large model interaction interface module is to extract entity relationship triples from a domain knowledge graph to form atomic verification units, construct composite verification rules by combining atomic units through logical operators, and use a rule engine to perform multi-level verification on the model output. The generation process of the question-and-answer response data stream includes real-time semantic constraint injection and multi-round dialogue state management, wherein the semantic constraint injection is achieved by superimposing the knowledge graph subgraph embedding vector on the model input layer, and the multi-round dialogue state management tracks the evolution path of core parameters by maintaining the context entity relationship stack. The large model interaction interface module adopts a rule-triggered correction mechanism in the output stage. When a response that violates the knowledge graph constraint is detected, the predefined correction template is automatically called to overwrite the key entity attributes.
[0015] In one embodiment of the present invention, when the feedback analysis module performs a semantic error vector calculation algorithm, it performs entity recognition and relationship extraction on the model output text to obtain a structured semantic network, and compares the graph structure with the reference semantic network constructed by the knowledge graph standard data, and calculates the difference measurement value through three dimensions: node matching, edge similarity and path connectivity; the feedback signal of the semantic deviation measurement includes fine-grained error classification information and correction priority tags, wherein the error classification information distinguishes between three types: entity missing, relationship contradiction and numerical value out of bounds, and the correction priority tag is dynamically assigned according to the degree of impact of the error on the business decision. The feedback analysis module traces the source of the deviation by constructing an error propagation graph to form a feedback signal with a causal chain annotation and transmits it to the optimization strategy module.
[0016] In one embodiment of the present invention, the specific implementation method of the reinforcement learning mechanism in the optimization strategy module includes constructing a state space and an action space, as well as a triple model of the reward function, wherein the state space is jointly defined by the semantic deviation type in the feedback signal and the historical optimization record, the action space corresponds to the adjustment direction and amplitude of the weight coefficient of the reservoir physical parameter, and the reward function performs multi-objective optimization based on the improvement amplitude of the question-answering accuracy and the parameter adjustment cost; the generation process of the parameter optimization instruction signal includes policy gradient update and exploration-utilization balance control, the policy gradient update adopts the proximal policy optimization algorithm to prevent training oscillation, and the exploration-utilization balance control adjusts the search range of the parameter space through a dynamic greedy strategy, the optimization strategy module encodes the optimization instruction into a differential signal format, and updates the entity relationship topology analysis algorithm parameters in the parsing module through the backpropagation link.
[0017] In one embodiment of the present invention, a constraint cache pool is set between the knowledge graph parsing module and the template generation engine module to store historically extracted valid constraints and their application effect evaluation data; when the parsing module detects a new knowledge graph entity, it prioritizes matching similar constraint patterns in the constraint cache pool. If the match is successful, the cache constraint coding signal is directly called, otherwise the complete topology analysis process is started; the cache pool adopts the least recently used elimination strategy to maintain storage space, and quickly retrieves constraints through hash fingerprint technology. When the template generation engine module receives the cache constraint coding signal, it synchronously loads the corresponding syntax tree reorganization history record to accelerate the template generation process.
[0018] In one embodiment of the present invention, the template generation engine module includes a multi-version prompt template library, each template version is associated with a constraint condition combination and grammatical structure features under a specific business scenario; when a new constraint coding signal is received, the optimal template version is matched through the scenario classification model, and the template parameters are domain-adapted and fine-tuned based on the transfer learning mechanism; the multi-version template library uses a version control mechanism to manage the template evolution process, and each template version saves a complete grammatical tree structure snapshot and performance evaluation indicators. When the optimization strategy module generates a parameter optimization instruction, the template version rollback test and preferential update mechanism are synchronously triggered.
[0019] In one embodiment of the present invention, the large model interaction interface module includes a real-time update interface for the knowledge graph. When entity attributes are changed or the relationship structure is updated in the domain knowledge graph, the incremental analysis process of the parsing module is automatically triggered; the incremental analysis process identifies the changed area by comparing the differences in the knowledge graph versions, performs local topological analysis only on the affected entity subgraphs, generates a difference constraint coding signal and merges it with the original constraint conditions; the real-time update interface sets a change impact assessment unit, and when a modification of a key entity attribute is detected, the question-and-answer process being executed is immediately paused and the prompt template is regenerated to ensure the timeliness of the output results.
[0020] The present invention also provides a large model prompt engineering optimization method integrating domain knowledge graph, including:
[0021] S1: Extract parameterized constraints through entity relationship topology analysis algorithm to form a constraint coding signal containing entity attribute association matrix;
[0022] S2: Use syntax tree dynamic reorganization technology to process constraint coding signals, inject constraint conditions into the preset template framework, and form an enhanced prompt text flow with reservoir physical property parameter slots;
[0023] S3: Calls the GPT model based on the enhanced prompt text stream and simultaneously loads the knowledge graph verification rule set to generate a question-answer response data stream containing geological terminology;
[0024] S4: Process the question-answer response data stream using a semantic error vector calculation algorithm, logically match the model output with the knowledge graph standard data, and generate a feedback signal containing a semantic deviation metric.
[0025] S5: Process the feedback signal based on the reinforcement learning mechanism, and dynamically adjust the weight coefficients of the reservoir physical property parameters during the template generation process to form a parameter optimization instruction signal and complete the update of the constraint conditions.
[0026] The present invention provides a large-model prompt engineering optimization system and method that integrates domain knowledge graphs. By constructing a closed-loop system for knowledge graph parsing and dynamic prompt generation, it automatically extracts professional parameters in the field of oil and gas exploration (such as reservoir physical property constraints), converts them into dynamic slots for natural language prompt templates, and simultaneously performs knowledge graph rule verification in GPT model interaction. It also optimizes parameter weights through feedback analysis to achieve continuous adaptation of professional constraints and language models, thereby improving answer accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0028] Figure 1 Provides a system architecture diagram for the engineering optimization system for the large model that integrates the domain knowledge graph;
[0029] Figure 2 Flowchart of a method for engineering optimization methods that integrate large models with domain knowledge graphs. DETAILED DESCRIPTION
[0030] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0031] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.
[0032] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it will be apparent to those skilled in the art that the embodiments of the present invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring the embodiments of the present invention.
[0033] See Figure 1 , which shows the large-scale model prompt engineering optimization system integrated with the domain knowledge graph of the present invention. The large-scale model prompt engineering optimization system integrated with the domain knowledge graph of the present invention includes a parsing module, a template generation engine module, a large-scale model interaction interface module, a feedback analysis module, and an optimization strategy module. The parsing module extracts parameterized constraints using an entity relationship topology analysis algorithm, generating a constraint encoding signal containing an entity attribute association matrix. The template generation engine module processes the constraint encoding signal using a syntax tree dynamic reorganization technique, injecting the constraints into a preset template framework to form an enhanced prompt text stream with slots for reservoir physical property parameters. The large-scale model interaction interface module receives the enhanced prompt text stream and synchronously loads the knowledge graph verification rule set to generate a question-and-answer response data stream containing geological terminology. The feedback analysis module receives the question-and-answer response data stream and, using a semantic error vector calculation algorithm, logically matches the model output results with the knowledge graph standard data to generate a feedback signal containing a semantic deviation metric. The optimization strategy module receives the feedback signal and, based on a reinforcement learning mechanism, dynamically adjusts the weight coefficients of the reservoir physical property parameters during the template generation process, generating a parameter optimization instruction signal that is transmitted to the parsing module to complete the iterative update of the constraints.
[0034] like Figure 1As shown, the present invention relates to a large-model prompt engineering optimization system that integrates domain knowledge graphs, which is characterized by including a parsing module, a template generation engine module, a large-model interactive interface module, a feedback analysis module, and an optimization strategy module. The parsing module extracts parameterized constraints from the oil and gas exploration knowledge graph through an entity-relationship topological analysis algorithm, which is specifically manifested in performing attribute similarity calculation and multi-hop relationship path analysis on entity nodes related to reservoir physical properties in the knowledge graph, and constructing an association topological network between entities. The module uses an embedding representation technology based on a graph neural network to convert professional parameters such as porosity and permeability into structured constraints, forming a constraint coding signal containing an entity attribute association matrix, wherein the association matrix uses a sparse tensor form to store entity types, attribute key-value pairs, and their weight coefficients, and screens out a valid constraint subset that meets the current business scenario through a dynamic threshold filtering mechanism. The parsing module transmits the generated constraint coding signal to the template generation engine module through a data bus, triggering the downstream processing flow. After receiving the constraint encoding signal, the template generation engine module uses dynamic syntax tree reconstruction technology to adapt the preset general prompt template to the domain. The core of this process is to naturally integrate structured constraints into the natural language prompt framework. First, the preset template is subjected to dependency syntactic analysis to generate an initial syntax tree, identifying key node locations for inserting professional parameters. Then, based on the parameter type in the constraint encoding signal, a bidirectional attention mechanism is used to calculate the semantic match between the constraints and the context, dynamically selecting the insertion locations for numerical parameters such as porosity threshold and permeability range. Finally, a syntax tree reconstruction algorithm is used to generate an enhanced prompt text stream with dynamic slots. This text stream retains the fluency of natural language while embedding reservoir physical constraints. The template generation engine module encapsulates the processed enhanced prompt text stream into a structured instruction set and transmits it to the large model interaction interface module via an API. After receiving the enhanced prompt text stream, the large model interaction interface module invokes a GPT-like large language model to generate professional question-and-answer responses. It also simultaneously loads a knowledge graph validation rule set to implement dual validation: first, it converts the reservoir physical properties in the prompt text into embedded vector constraints at the model input layer, and second, it uses a rule engine to perform a logical compliance check on the output results. When generating a question-and-answer response data stream containing geological terminology, this module uses multi-turn dialogue state management technology to maintain the contextual entity relationship stack, ensuring that the parameter evolution path conforms to geological laws. The data stream is then transmitted to the feedback analysis module via a message queue.The feedback analysis module deeply analyzes the question-and-answer response data stream and quantifies the deviation between the model output and the knowledge graph standard data using a semantic error vector calculation algorithm. First, using entity recognition and relationship extraction techniques, the natural language response is converted into a structured semantic network. This network is then compared with the reference network constructed from the knowledge graph, generating error metrics based on three dimensions: node matching, edge similarity, and path connectivity. The resulting semantic deviation metric feedback signal not only includes classification information such as missing entities and conflicting relationships, but also includes correction priority tags. By constructing an error propagation graph, the source of the deviation is traced back to the source of the error. Ultimately, the feedback signal, annotated with a causal chain, is transmitted to the optimization strategy module. The optimization strategy module establishes a dynamic optimization model based on reinforcement learning. Its state space is defined by the semantic deviation type in the feedback signal and historical optimization records. The action space corresponds to the adjustment strategy for the weight coefficients of reservoir physical parameters. The reward function integrates the improvement of question-and-answer accuracy with the cost of parameter adjustment to perform multi-objective optimization. The parameter optimization command signal generated by this module uses a differential encoding format and updates the parameters of the entity-relationship topology analysis algorithm in the parsing module through a backpropagation link, forming a closed-loop system from problem discovery to iterative constraint update. The modules form a five-level data transmission channel through constraint coding signals, enhanced prompt text streams, question-and-answer response data streams, feedback signals, and optimization instruction signals, realizing full-link automation of knowledge graph parsing, prompt template generation, large model interaction, result analysis, and system optimization.
[0035] Furthermore, the specific implementation of the entity-relationship topology analysis algorithm in the parsing module involves multi-dimensional feature extraction and dynamic weight assignment for knowledge graph entity nodes. The algorithm first sub-graphs the oil and gas exploration knowledge graph, focusing on entity types relevant to reservoir evaluation (lithologic units, well logs, and physical properties). A TransE-based graph embedding algorithm is used to map entity nodes into a low-dimensional vector space. An entity-attribute association matrix is constructed using cosine similarity, where each matrix element represents the strength of correlation between two entities along dimensions such as porosity distribution and permeability range. For multi-hop relationship path analysis, the algorithm employs a path weight calculation model with a decay factor, setting an exponential decay for each additional hop. Furthermore, node centrality metrics (betweenness centrality and closeness centrality) are incorporated to dynamically adjust the propagation weights of key nodes. During the constraint generation phase, the algorithm implements a three-level filtering mechanism: in the first level, weakly correlated entity pairs are eliminated based on the sparsity threshold of the attribute association matrix; in the second level, significant relationship chains are screened using the accumulated path weights; and in the third level, domain-specific filtering is performed using a business rule library (reservoir classification standards and physical property threshold tables). The resulting constraint encoding signal consists of a structured triple (subject entity, relationship type, constraint strength) and a sequence of dynamic weight coefficients. The weight coefficients are normalized to ensure comparability across different dimensions. The algorithm incorporates a specially designed incremental update mechanism. When new well logging interpretation data or lithologic analysis results are added to the knowledge graph, only a local topological analysis of the affected entity subgraph is performed. This difference comparison generates an incremental constraint encoding signal, which is then weighted and integrated with historical constraints to reduce system computational overhead.
[0036] In one embodiment of the present invention, the operational process and quality control mechanism of the dynamic syntax tree reorganization technology in the template generation engine module are described. This technology first performs deep semantic analysis on a preset general prompt template, constructs an initial syntax tree using a BERT-based dependency parser, and identifies key nodes (typically noun phrase modification positions or conditional clause insertion points) where domain parameters can be inserted. During the constraint injection phase, a bidirectional attention mechanism is used to achieve semantic alignment between structured parameters and natural language templates: reservoir physical property parameters in the constraint encoding signal are converted into feature vectors, similarity-matched with the context embedding vectors of the syntax tree nodes, and the node position with the highest semantic compatibility is selected for insertion into the parameter slot. For numerical parameters (e.g., porosity > 15%), the system automatically generates conditional judgment sentences and embeds them into the syntax tree. For enumerated parameters (e.g., lithology type), enumeration sentences are used to expand the syntax tree branches. During the syntax tree reconstruction process, a dual validation mechanism is implemented: first, static validation, which checks the validity of the tree structure using a pre-set grammatical rule library to prevent missing predicates or misplaced modifiers; second, dynamic validation, which uses a pre-trained language model to score the fluency of the restructured prompt text. When the score falls below a threshold, a backtracking mechanism is triggered to reselect the parameter insertion position. The generated enhanced prompt text stream adopts a layered encapsulation structure: the outer layer is natural language instructions, and the inner layer is embedded with machine-readable constraint parameter markers. This enables the large model to both understand human-readable semantic requirements and accurately parse structured constraints. The module also features multi-version template management, storing optimized template variants based on different business scenarios (such as reservoir evaluation and well location deployment). When a new constraint encoding signal is received, the scenario classification model is used to match the most suitable template version, and parameter fine-tuning is performed based on transfer learning to ensure that the prompt engineering is highly aligned with domain requirements.
[0037] like Figure 1As shown in Figure 2, the specific implementation method of the semantic error vector calculation algorithm in the feedback analysis module focuses on establishing a multi-dimensional error quantification system and a deviation traceability mechanism. The algorithm first deeply analyzes the natural language response output by the GPT model, using a BiLSTM-CRF-based entity recognition model to extract key entities such as reservoir parameters and geological structures. A response semantic network is then constructed using a graph attention network, where nodes represent entity attributes and edges represent the strength of relationships between entities. The generated response semantic network is then aligned with the reference semantic network constructed from standard knowledge graph data. A graph isomorphism detection algorithm is used to calculate difference metrics across three dimensions: node matching, edge similarity, and path connectivity. Node matching is verified using both attribute vector cosine similarity and type consistency; edge similarity is calculated by combining relationship type matching and strength difference; and path connectivity evaluates the integrity of the logical chain between key entities. The calculated error metrics are normalized to generate a semantic error vector. This vector not only contains the overall deviation score but also breaks down into three error components: missing entities (e.g., permeability parameter omitted), conflicting relationships (e.g., logical conflicts between porosity and depth data), and numerical overshoots (e.g., oil saturation exceeding the physical limits of the formation). During the feedback signal generation phase, the system constructs an error propagation map to trace the root causes of the deviation. Backpropagation is used to analyze the propagation paths of error components within the semantic network, identifying the core nodes that trigger cascading errors (typically, misjudgments of key reservoir parameters). Each error component is then assigned a correction priority tag—dynamically adjusting the priority coefficient based on the parameter's importance in exploration decision-making (e.g., the weight of porosity on reserve calculations). The resulting feedback signal employs a hierarchical encoding structure: the bottom layer contains the raw error data, the middle layer stores the traceability analysis results, and the top layer encapsulates the optimization strategy recommendations. Transmission to the optimization strategy module via a message queue automatically triggers the weight adjustment process.
[0038] Specifically, the implementation architecture and dynamic adjustment strategy of the reinforcement learning mechanism in the optimization strategy module are discussed. This module constructs a Markov decision process model, whose state space is composed of multidimensional feature vectors: including the error type distribution in the current feedback signal, the historical optimization instruction execution effect record, the knowledge graph constraint version number, and the real-time load status of the template generation engine. The action space is defined as the adjustment operation of the reservoir physical parameter weight coefficient in the analysis module, specifically including the amplitude gradient of the weight increase / decrease (with 0.1 as the minimum unit) and the coordinated adjustment strategy of the associated parameter group. The reward function is designed as a multi-objective optimization function, which mainly includes three calculation items: the core reward item is based on the improvement in question-answering accuracy (calculated by comparing the change in the error vector modulus before and after optimization); the auxiliary penalty item considers the increase in system computing overhead caused by parameter adjustment (quantified according to CPU / GPU resource consumption indicators); and the stability constraint item evaluates the impact of weight fluctuations on the adaptability of historical templates. The strategy update utilizes the Proximal Policy Optimization (PPO) algorithm, balancing exploration and exploitation through importance sampling and trust region constraints. A curriculum learning mechanism is also introduced to gradually expand the parameter search space. Initially, only fine-tuning of core parameters such as porosity and permeability is permitted. Adjustment of secondary parameters such as sedimentary facies type and formation pressure is gradually expanded with each training round. A safety check mechanism is implemented during the optimization command generation process. When a parameter weight adjustment is detected as potentially causing a constraint conflict (e.g., a porosity threshold exceeding the associated acceptable burial depth range), a constraint satisfaction problem (CSP) solver is automatically triggered for feasibility verification, outputting only optimization commands that comply with all business rules. The resulting parameter optimization command signal, encoded in a differential encoding format, contains the weight adjustment amount, scope, and effective time window. When transmitted to the parsing module via the reverse data channel, the weight matrix in the entity-relationship topology analysis algorithm is simultaneously updated, and a version change log is recorded to facilitate optimization history tracking.
[0039] Furthermore, the conditional cache pool module optimizes data processing efficiency between the knowledge graph parsing module and the template generation engine module. This cache pool utilizes a tiered storage architecture: the first tier is a hotspot constraint library, which stores recently frequently used reservoir property constraints and their associated syntax tree reorganization schemes. Least Recently Used (LRU) is used to manage entry elimination. The second tier is a pattern matching library, which uses cluster analysis to categorize and store historically extracted constraints by business scenario (such as reservoir classification and evaluation, well pattern optimization), with each category associated with a feature vector index. The third tier is a derived rule library, which stores constraint combination rules automatically generated through machine learning (e.g., "Oil-water interface analysis is required when porosity > 12% and permeability > 50 mD"). When the parsing module initiates a new topology analysis task, it first performs a similarity match between the hash fingerprint of the current knowledge graph subgraph and the cache pool. The Hamming distance between the subgraph feature fingerprints is calculated using the SimHash algorithm. If the Hamming distance is within a threshold, the constraint encoding signal and associated template generation record in the cache are directly invoked. Otherwise, the full analysis process is executed. When a cache hit occurs, the template generation engine module will load the historical syntax tree reorganization plan as the baseline template, and then make incremental adjustments based on current business needs. This can reduce the time required for template generation by more than 40%. A data integrity protection mechanism is implemented during cache pool maintenance: each cache entry is associated with a confidence score (calculated based on the number of historical calls and the proportion of successful applications). When the score is lower than the threshold, a revalidation process is automatically triggered to confirm the cache validity by comparing it with the latest knowledge graph data. In addition, an anomaly detection unit is set up. When it is detected that a cache call has caused an abnormal drop in question and answer accuracy, the relevant cache entries are immediately cleared and the constraints are regenerated to ensure the reliability of the system output.
[0040] like Figure 1As shown, the template generation engine module features multi-version template management, building an adaptive template system for diverse business scenarios. This system maintains a dynamically evolving template library, with each template version containing complete metadata: creation time, applicable scenario tags (e.g., lithology identification, production capacity forecasting), associated constraint fingerprints, historical call statistics, and performance evaluation metrics (including generated response accuracy and semantic fluency scores). When a new constraint encoding signal is received, the scenario classification model (trained using the XGBoost algorithm) analyzes the entity type distribution, parameter weight configuration, and business objective description contained in the signal, and matches the most suitable existing template version as the base framework. For scenarios with insufficient matching, a template transfer learning process is initiated: An old template with a similar topology is selected, its syntax tree trunk structure is retained, and parameter slots in the leaf nodes are replaced to accommodate the new constraints. A generative adversarial network (GAN) is then used to perform natural language polishing on the restructured template. Template versioning utilizes a Git-style management mechanism, recording diff patches for each syntax tree modification, allowing for rapid rollback to a historical stable version after optimization strategy adjustments. When the optimization strategy module issues a parameter optimization instruction, it simultaneously triggers a template version backtest: The old and new template versions are run side-by-side in a sandbox environment, comparing the quality of the Q&A response. The upgrade is completed only when the new template outperforms all test cases. Furthermore, template lifecycle management rules are established to automatically archive old versions that have not been called for three consecutive months, freeing up storage resources while preserving key syntax tree features for future template reconstruction.
[0041] Furthermore, the real-time knowledge graph update interface and incremental analysis mechanism are integrated to construct a dynamically evolving constraint generation system. When entity attributes are updated or relationship structures are adjusted within the oil and gas exploration knowledge graph, the real-time update interface automatically identifies the changed areas through a version comparison engine. This process employs a three-stage process based on the GraphDiff algorithm. First, node fingerprint matching (using SHA-256 hash values to represent entity attributes) locates newly added / deleted entities. Next, relationship path comparison identifies topological changes. Finally, attribute value fluctuation detection (using a threshold for the rate of change of physical parameters) identifies key parameter modifications. For detected changes, the system initiates an incremental analysis process, performing local topological analysis only on the subgraph containing the affected entities (determining the scope of influence through k-hop neighbor expansion). A lightweight graph neural network (GNN) is then used to rapidly calculate the entity associations in the changed areas, generating differential constraint encoding signals. This signal is integrated with the original global constraints through a weighted fusion algorithm: a decay coefficient is set for historical constraints (the weight is linearly reduced over time), an initial weight is assigned to the newly added constraints, and a conflict detection mechanism is used to resolve logical contradictions between old and new constraints (such as automatically discarding outdated constraints when the porosity threshold is updated). The real-time update interface specifically sets up a change impact assessment unit, which uses a causal reasoning model to predict the impact of knowledge graph modifications on the existing template library: when a change in a key reservoir parameter (such as the permeability baseline value) is detected, a template failure warning is immediately sent to the template generation engine module, triggering the regeneration process of the relevant prompt template; for changes in non-critical parameters, a background asynchronous update method is used to reduce system response delays. This mechanism ensures that in high-frequency scenarios where logging interpretation data is updated every hour, the system can complete the constraint refresh within an average of 300ms, while maintaining the consistency of the prompt template with the latest industry standards.
[0042] like Figure 2As shown in the figure, the optimization strategy module's security assurance system introduces a sandbox testing environment and an exception circuit-breaking mechanism. The sandbox environment uses containerization technology to clone the complete configuration of the current production system (including the weight matrix of the parsing module, the syntax tree library of the template generation engine, and the rule set of the large model interaction interface), creating a virtual test instance isolated from the production environment. When the optimization strategy module generates new parameter optimization instructions, the instructions are first injected into the sandbox environment. A three-month historical question-and-answer interaction dataset (containing over 5,000 annotated cases) is loaded for batch testing. During execution, the changes in semantic error vectors, system resource consumption indicators, and the number of constraint violations for each test case are recorded, and a multi-dimensional performance evaluation report is generated. The test results are analyzed using a difference comparison algorithm to calculate the relative change rate of key indicators (such as average question-and-answer accuracy and maximum response latency) before and after optimization. If the accuracy improvement is less than 5% or the resource consumption increase exceeds 20%, the strategy is marked as suboptimal. During the security verification phase, three levels of circuit breaker thresholds are set: the primary threshold triggers policy fine-tuning (retesting by narrowing parameter adjustments), the intermediate threshold initiates a manual review process (sending exceptions to an expert interface), and the advanced threshold directly discards the current optimization instructions and rolls back to the previous stable version. The sandbox environment is designed with adversarial testing scenarios in mind, using genetic algorithms to generate boundary condition use cases (such as extreme reservoir parameter combinations) to verify the robustness of the optimization strategy under abnormal circumstances. Optimization instructions that pass testing are packaged as versioned update packages, including incremental deployment scripts (modifying only the configuration parameters of the affected modules) and rollback snapshots. These packages are then digitally signed and deployed to the production system through a secure channel. This mechanism ensures 99.9% service availability during the parameter optimization process, while reducing recovery time from faults caused by misconfiguration to less than 2 minutes.
[0043] like Figure 2 The following is a large-scale model prompt engineering optimization method for integrating domain knowledge graphs according to the present invention. The method comprises: S1: extracting parameterized constraints through an entity-relationship topology analysis algorithm to form a constraint encoding signal containing an entity attribute association matrix; S2: processing the constraint encoding signal using a syntax tree dynamic reorganization technique, injecting the constraints into a preset template framework, and forming an enhanced prompt text stream with reservoir physical property parameter slots; S3: invoking a GPT class model based on the enhanced prompt text stream and synchronously loading a knowledge graph validation rule set to generate a question-and-answer response data stream containing geological terminology; S4: processing the question-and-answer response data stream using a semantic error vector calculation algorithm, logically matching the model output results with the knowledge graph standard data, and forming a feedback signal containing a semantic deviation metric; S5: processing the feedback signal based on a reinforcement learning mechanism, and dynamically adjusting the weight coefficients of the reservoir physical property parameters during the template generation process to form a parameter optimization instruction signal, thereby completing the constraint update.
[0044] like Figure 2As shown, the multimodal data fusion processing capability expands the input sources and semantic understanding dimensions of the knowledge graph parsing module. The system has newly added well logging curve parsing units and geological map recognition units. The well logging curve parsing unit uses wavelet transforms to extract characteristic segments of gamma and resistivity curves. It then uses a temporal convolutional network (TCN) to identify reservoir interfaces and physical property anomalies, converting them into event entities in the knowledge graph (e.g., "The GR curve shows a box-shaped mutation at 3150 m"). The geological map recognition unit integrates a pre-trained YOLOv7 model to detect fault lines and trap boundaries on structural maps. Using a graph neural network (GNN), it constructs spatial topological relationships and generates geological structure triplets with coordinate annotations (e.g., "Fault F1 intersects trap T2 at 108.7° east longitude"). Multimodal data is integrated with the text knowledge graph through the cross-modal alignment module: a contrastive learning framework is used to train the shared embedding space, making the logging curve feature vectors, geological map area vectors and text entity vectors comparable, thereby establishing cross-modal associations (such as automatically linking the resistivity curve peak to the "high permeability zone" entity in the knowledge graph). The parsing module is upgraded to a multimodal constraint generation engine, which not only processes text-based knowledge graphs, but also extracts spatial constraints from image data (such as "the distance between the well deployment point and the fault is > 200m") and derives dynamic constraints from time series data (such as "the water content increase rate is < 2% / month"). The generated enhanced constraint coding signal adds a modal tag dimension to guide the template generation engine module to create a multimodal prompt template: embed data reference tags in text instructions (such as "combined with attached Figure 2 The feedback analysis module has been upgraded with multimodal error detection capabilities. This not only verifies the logic of the text response but also checks the spatial consistency of the recommended solution with the geological map (e.g., whether the proposed well location crosses a fault) and the temporal match with the well logging curve (e.g., whether the predicted water cut trend matches the curve morphology). This creates a multidimensional semantic error vector that integrates text, space, and time, enabling the optimization strategy module to precisely adjust parameters based on different modal characteristics.
[0045] The large-model prompt engineering optimization system of the present invention, which integrates domain knowledge graphs, automatically extracts professional parameters in the field of oil and gas exploration (such as reservoir physical property constraints) by constructing a closed-loop system for knowledge graph analysis and dynamic prompt generation, and converts them into dynamic slots for natural language prompt templates. It simultaneously performs knowledge graph rule verification in GPT model interaction, optimizes parameter weights through feedback analysis, and realizes continuous adaptation of professional constraints and language models, thereby improving answer accuracy.
[0046] Therefore, the large-model-integrated domain knowledge graph-based engineering optimization system and method of the present invention can solve the problem of low answer accuracy of large models in the field of oil and gas exploration due to the lack of professional constraints.
[0047] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.
Claims
1. A large model-based engineering optimization system that integrates domain knowledge graphs, characterized by: include: A parsing module, wherein the parsing module extracts parameterized constraints through an entity relationship topology analysis algorithm to form a constraint coding signal including an entity attribute association matrix; The constraint coding signal includes a sparse coding format of an entity attribute association matrix and a normalized weight coefficient sequence, wherein the sparse coding format uses a hash mapping table to store the combination relationship between entity types and attribute key-value pairs, and the normalized weight coefficient sequence is generated by calculating the product of the node centrality index and the path attenuation value in the topological network. The parsing module screens effective constraint conditions through a dynamic weight threshold filtering mechanism to form a parameterized constraint signal with a hierarchical structure and transmits it to the template generation engine module; the entity relationship topology analysis algorithm first sub-graphs the oil and gas exploration knowledge graph, focusing on entity types related to reservoir evaluation: lithologic units, well logging curves, and physical property parameters, and uses a TransE-based graph embedding algorithm to map entity nodes to a low-dimensional vector space, and establishes an entity attribute association matrix through cosine similarity calculation, wherein each matrix element represents the correlation strength between two entities in the dimensions of porosity distribution and permeability range; A template generation engine module, wherein the template generation engine module uses a syntax tree dynamic reorganization technology to process the constraint coding signal, injects the constraint conditions into a preset template framework, and forms an enhanced prompt text stream with reservoir physical property parameter slots. When performing the syntax tree dynamic reorganization technology in the template generation engine module, the preset template framework is subjected to dependency syntax analysis to generate an initial syntax tree structure, replaceable nodes in the syntax tree are located according to the parameter slot type in the constraint coding signal, a bidirectional attention mechanism is used to calculate the semantic matching degree between the constraint conditions and the context, and the parameter insertion position is dynamically selected and the syntax tree branches are reconstructed. The generation process of the enhanced prompt text stream includes dynamic filling of parameter slots and semantic coherence verification, wherein the dynamic filling adopts a combination of rule-based regular expression matching and neural network-based context prediction. The semantic coherence verification uses a pre-trained language model to score the fluency of the reorganized prompt text. When the score is lower than a set threshold, the syntax tree backtracking mechanism is triggered to reselect the insertion node. The template generation engine module encapsulates the verified prompt text stream into a structured instruction set and transmits it to the large model interaction interface module. A large model interaction interface module receives the enhanced prompt text stream and synchronously loads the knowledge graph verification rule set to generate a question-and-answer response data stream containing geological professional terms; A feedback analysis module receives the question-answer response data stream, and through a semantic error vector calculation algorithm, logically matches the model output result with the knowledge graph standard data to form a feedback signal containing a semantic deviation metric; when the feedback analysis module performs the semantic error vector calculation algorithm, it performs entity recognition and relationship extraction on the model output text to obtain a structured semantic network, compares the graph structure with the reference semantic network constructed by the knowledge graph standard data, and calculates the difference metric value through the three dimensions of node matching, edge similarity and path connectivity; the feedback signal of the semantic deviation metric includes fine-grained error classification information and correction priority tags, wherein the error classification information distinguishes between three types: entity missing, relationship contradiction and numerical value out of bounds, and the correction priority tag is dynamically assigned according to the degree of impact of the error on the business decision. The feedback analysis module traces the source of the deviation by constructing an error propagation graph to form a feedback signal with a causal chain annotation and transmits it to the optimization strategy module; An optimization strategy module receives the feedback signal and dynamically adjusts the weight coefficients of the reservoir physical property parameters in the template generation process based on a reinforcement learning mechanism, forms a parameter optimization instruction signal and transmits it to the analysis module to complete the iterative update of the constraint conditions.
2. The large model prompt engineering optimization system integrating domain knowledge graph according to claim 1 is characterized in that: The specific implementation method of the entity relationship topology analysis algorithm in the parsing module is: constructing a multi-dimensional topological network by combining the attribute similarity calculation of the knowledge graph entity nodes with the relationship path weight distribution, wherein the attribute similarity calculation uses a vector space model based on cosine similarity to embed the entity description text, and the relationship path weight distribution uses an attenuation function to dynamically adjust the multi-hop association path.
3. The large model prompt engineering optimization system integrating domain knowledge graph according to claim 1 is characterized in that: The method for constructing the knowledge graph verification rule set in the large model interaction interface module is to extract entity relationship triples from the domain knowledge graph to form atomic verification units, combine atomic units through logical operators to construct composite verification rules, and use a rule engine to perform multi-level verification on the model output. The generation process of the question-answer response data stream includes real-time semantic constraint injection and multi-round dialogue state management, wherein semantic constraint injection is achieved by superimposing knowledge graph subgraph embedding vectors on the model input layer, and multi-round dialogue state management tracks the core parameter evolution path by maintaining the context entity relationship stack. The large model interaction interface module adopts a rule-triggered correction mechanism in the output stage. When a response that violates the knowledge graph constraints is detected, the predefined correction template is automatically called to overwrite the key entity attributes.
4. The large model prompt engineering optimization system integrating domain knowledge graph according to claim 1 is characterized in that: The specific implementation of the reinforcement learning mechanism in the optimization strategy module includes constructing a state space, an action space, and a triple model of the reward function, wherein the state space is jointly defined by the semantic deviation type in the feedback signal and the historical optimization record, the action space corresponds to the adjustment direction and amplitude of the weight coefficient of the reservoir physical parameter, and the reward function performs multi-objective optimization based on the improvement amplitude of the question-answering accuracy and the parameter adjustment cost; the generation process of the parameter optimization instruction signal includes policy gradient update and exploration-utilization balance control, the policy gradient update adopts the proximal policy optimization algorithm to prevent training oscillation, and the exploration-utilization balance control adjusts the search range of the parameter space through a dynamic greedy strategy, the optimization strategy module encodes the optimization instruction into a differential signal format, and updates the entity relationship topology analysis algorithm parameters in the parsing module through the backpropagation link.
5. The large model prompt engineering optimization system integrating domain knowledge graph according to claim 1 is characterized in that: A constraint cache pool is set between the parsing module and the template generation engine module to store historically extracted valid constraints and their application effect evaluation data; when the parsing module detects a new knowledge graph entity, it prioritizes matching similar constraint patterns in the constraint cache pool. If the match is successful, the cache constraint coding signal is directly called, otherwise the complete topology analysis process is started; the cache pool adopts the least recently used elimination strategy to maintain storage space, and quickly retrieves constraints through hash fingerprint technology. When the template generation engine module receives the cache constraint coding signal, it synchronously loads the corresponding syntax tree reorganization history record to accelerate the template generation process.
6. The large model prompt engineering optimization system integrating domain knowledge graph according to claim 1 is characterized in that: The template generation engine module includes a multi-version prompt template library, each template version is associated with a constraint condition combination and grammatical structure features under a specific business scenario; when a new constraint coding signal is received, the optimal template version is matched through the scenario classification model, and the template parameters are domain-adapted and fine-tuned based on the transfer learning mechanism; the multi-version prompt template library uses a version control mechanism to manage the template evolution process, and each template version saves a complete grammatical tree structure snapshot and performance evaluation indicators. When the optimization strategy module generates a parameter optimization instruction, the template version rollback test and preferential update mechanism are synchronously triggered.
7. The large model prompt engineering optimization system integrating domain knowledge graph according to claim 1 is characterized in that: The large model interaction interface module includes a real-time knowledge graph update interface. When entity attributes or relationship structures in the domain knowledge graph are changed, the incremental analysis process of the parsing module is automatically triggered. The incremental analysis process identifies the changed areas by comparing the differences between knowledge graph versions, performs local topological analysis on only the affected entity subgraphs, and generates difference constraint coding signals for merging with the original constraint conditions. The real-time update interface setting change impact assessment unit immediately pauses the ongoing question-and-answer process and regenerates the prompt template to ensure the timeliness of the output results when a modification of a key entity attribute is detected.
8. A method for large-scale model-prompted engineering optimization using a large-scale model-prompted engineering optimization system integrated with a domain knowledge graph according to any one of claims 1 to 7, characterized in that: include: S1: Extract parameterized constraints through entity relationship topology analysis algorithm to form a constraint coding signal containing entity attribute association matrix; S2: using a syntax tree dynamic reorganization technology to process the constraint coding signal, injecting the constraint conditions into a preset template framework to form an enhanced prompt text flow with reservoir physical property parameter slots; S3: calling the GPT model according to the enhanced prompt text stream and synchronously loading the knowledge graph verification rule set to generate a question-answer response data stream containing geological professional terms; S4: Processing the question-answer response data stream using a semantic error vector calculation algorithm, logically matching the model output results with the knowledge graph standard data, and forming a feedback signal containing a semantic deviation measure; S5: Processing the feedback signal based on the reinforcement learning mechanism, and dynamically adjusting the weight coefficients of the reservoir physical property parameters in the template generation process to form a parameter optimization instruction signal and complete the update of the constraint conditions.
Citation Information
Patent Citations
Operation and maintenance alarm processing method and system based on knowledge graph enhanced large model
CN119988154A
Battle document generation method and system based on large language model
CN119990071A