A model knowledge updating and question answering method fusing retrieval enhancement and feedback learning

CN122287844BActive Publication Date: 2026-10-16青岛峻海物联科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610411883.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-03-31
Publication Date
2026-10-16
Estimated Expiration
2046-03-31

AI Technical Summary

Technical Problem

其生成质量依赖于检索片段的优劣,缺乏持续的自我优化能力

Benefits of technology

本发明所提供的融合检索增强与反馈学习的模型知识更新与问答方法,针对智能消防专业领域的特点,实现了多方面的显著有益效果。首先,该方法通过构建与动态维护一个由规范条文、案例、标准等多模态消防数据构成的私有化向量知识库,并利用针对消防领域语义深度优化的嵌入模型进行实时检索,从根本上解决了大模型知识静态滞后的问题。系统能够始终依据最新的、最相关的消防专业知识生成答案,确保了回答的时效性与准确性,有效克服了“事实幻觉”在关键安全领域的潜在风险。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122287844B_ABST
    Figure CN122287844B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of intelligent fire fighting, in particular to a model knowledge updating and question answering method combining retrieval enhancement and feedback learning. According to a fire-related query input by a user, the latest related background information is retrieved from a private vector knowledge base and combined into an enhanced prompt input into a large model fine-tuned by fire corpus to generate a professional answer. Meanwhile, a feedback learning cycle is established, a reward signal is generated through expert evaluation and automatic rule checking, and the model is continuously fine-tuned by using reinforcement learning. The application ensures the timeliness of knowledge through real-time retrieval, ensures the compliance and professionalism of answers by using feedback-driven optimization, and realizes the continuous evolution of the system by means of dynamic updating of the knowledge base and integration of the Internet of Things, effectively improving the accuracy, reliability and self-adaptive ability of professional question answering in the field of intelligent fire fighting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent fire protection technology, specifically to a model knowledge update and question answering method that integrates retrieval enhancement and feedback learning. Background Technology

[0002] With the widespread application of large language models in general domains, applying them to highly specialized and standardized vertical fields such as intelligent fire protection to provide accurate and reliable professional question answering and decision support has become an important technological direction. However, directly applying general large models to the field of intelligent fire protection faces significant challenges. First, the training data of large models is static; their knowledge is limited to the time of training and cannot automatically acquire and integrate the latest regulations, standards, technical specifications, accident cases, and product information within the field. National standards and industry regulations in the field of intelligent fire protection are frequently updated, and new fire risks and response technologies are constantly emerging. The severe lag in model knowledge can lead to outdated or even erroneous recommendations, posing safety hazards. Second, large models may generate "fact illusions," that is, generating content that seems reasonable but does not conform to actual regulations or technical details. In the fire protection field, this inaccuracy can lead to misinterpretations of regulations, incorrect guidance on equipment operation, or inappropriate risk assessments, with serious consequences. Although existing technologies have developed retrieval-enhanced generation methods that combine external knowledge bases, which can alleviate the knowledge freshness problem to some extent, these methods typically only treat the retrieved information as a one-time input; the model itself does not learn from the interaction how to better utilize this information or correct its own errors. Its generated quality depends on the quality of the retrieved fragments and lacks continuous self-optimization capabilities. Furthermore, traditional model updates rely on periodic, costly complete retraining or fine-tuning, making it difficult to rapidly absorb and respond to massive amounts of dynamic new domain knowledge and expert feedback. Therefore, there is an urgent need for an intelligent question-answering solution that can deeply integrate the latest domain knowledge, ensure compliant and reliable output, and autonomously evolve its professional capabilities through continuous feedback, to meet the extreme requirements of accuracy, timeliness, and safety in the field of intelligent fire protection.

[0003] Therefore, existing technologies still need further development. Summary of the Invention

[0004] The purpose of this invention is to overcome the above-mentioned technical deficiencies and provide a model knowledge update and question answering method that integrates retrieval enhancement and feedback learning to solve the problems existing in the prior art.

[0005] To achieve the above technical objectives, this invention provides a model knowledge update and question answering method that integrates retrieval enhancement and feedback learning, comprising: S1. Based on the user's input of fire-related queries, retrieve relevant background information fragments from a private vector knowledge base constructed from intelligent fire protection code provisions, fire accident cases, equipment technical standards, emergency response plans, and fire protection product manuals; S2. Combine the retrieved background information fragments with the fire-related queries to construct an enhanced prompt containing contextual information; input the enhanced prompt into a large model that has been fine-tuned by the intelligent fire-related corpus to generate professional answers related to fire protection; S3. Establish a feedback learning loop, collect evaluation feedback signals for the professional answers, and based on the evaluation feedback signals, iteratively fine-tune the large model through a reinforcement learning algorithm to update the parameter knowledge of the large model.

[0006] Specifically, the construction of the private vector knowledge base includes: Multimodal intelligent fire protection data is collected, including textual fire protection design codes, fire protection acceptance procedures, historical fire investigation reports, fire protection facility maintenance records, and fire fighting and rescue tactical guidelines, as well as structured building fire protection facility system diagrams, fire equipment operation parameter tables, and fire risk quantitative assessment tables. The multimodal intelligent fire protection data is cleaned and standardized, unifying fire protection terminology, equipment model descriptions, and units of measurement, and divided into semantically complete information blocks according to the document structure. Using an embedding model pre-trained for fire protection text semantics and fire protection entity relationships, the information blocks are encoded into high-dimensional vectors. The encoded vectors are stored in a vector database, and an index is established between the vectors and the original information block metadata. The metadata includes at least the information source, publication date, associated fire scenario category, and applicable building type.

[0007] Specifically, the pre-training process of the embedding model includes: A training corpus was constructed by collecting general corpora and a large-scale intelligent fire protection professional corpus. The intelligent fire protection professional corpus covers multiple sub-directions, including building fire prevention, electrical fire prevention and control, hazardous chemical fire protection, smart fire protection IoT, and fire rescue command. The initial Transformer model was pre-trained by masking key fire protection entities, predicting sentence coherence, and constructing a fire scene graph-text comparison learning task, enabling it to learn deep semantic representations and cross-modal alignment capabilities in intelligent fire protection scenarios. After pre-training, the model was fine-tuned by comparative learning using triplet data containing relationships such as "fire protection facilities-functions", "fire causes-disaster factors", and "regulatory provisions-applicable scenarios", optimizing the model's embedding quality of complex relationships in the fire protection professional knowledge network and ensuring that fire protection equipment with similar functions, similar fire risks, and related regulatory provisions are close in distance in the vector space.

[0008] Specifically, the retrieval based on user-inputted fire-related queries includes: The system performs intent recognition and key information extraction on the fire-related queries. It identifies whether the user's query is for fire regulations, fire cause analysis, equipment selection advice, emergency plan development, or fire accident liability determination, and extracts elements such as building type, fire type, fire equipment name, specific regulation number, and time and location from the query. Based on the identified intent and extracted key information, the original query is semantically expanded and reconstructed to generate one or more query expressions for retrieval. These expressions incorporate synonymous fire-related terms, higher or lower-level fire-related concepts, and frequently associated fire-related scenario keywords. The embedded model encodes the query expressions into query vectors. The similarity between the query vector and vectors stored in the vector database is calculated. A preset number of background information fragments are selected based on the similarity score from high to low, and the corresponding metadata is returned for credibility verification.

[0009] Specifically, the enhanced prompts are constructed using a specially designed fire safety-related prompt template. This template defines strict answer generation logic and content constraints, including: The system instructions clearly require the large model to act as an intelligent fire protection expert, and its responses must be strictly based on the provided background information and comply with national fire protection technical standards and safety principles. The context integration section is used to organize and present the retrieved background information fragments and their metadata, instructing the model to prioritize the content in the background information fragments. In the query and task section, clearly restate the user query and require the model to generate an answer. If it involves fire-fighting operations, it should be explained step by step and safety warnings should be emphasized. If it involves laws and regulations, the specific articles and their levels of effectiveness should be specified. If it involves data analysis, the data source and limitations should be explained. The output format requires that the answer be presented in a structured form, including the core conclusions, a summary of the basis, an explanation of the applicable conditions, and relevant suggestions or precautions.

[0010] Specifically, the collection and evaluation feedback signals include two parallel approaches: One approach is through expert evaluation, which involves inviting fire engineers, regulatory reviewers, or fire and rescue command experts to score the professional answers based on a pre-set multi-dimensional scoring table. The scoring dimensions include at least the standardization of the answer, consistency with the latest fire protection standards, completeness of risk warnings, and operability of emergency response suggestions. The scores and written correction opinions are then converted into quantifiable reward signals. The second approach is automated rule verification. A verifier based on fire protection code logic and safety rules is constructed. The verifier parses the professional answer and checks whether it violates mandatory fire protection provisions, ignores the configuration requirements of key fire protection facilities, or suggests the use of outdated fire protection technologies. Based on the severity of the violation, a negative reward signal or correction prompt is generated.

[0011] Specifically, the validator in the automated rule validation process is constructed in the following way: Safety and compliance rules in the form of "condition-action-constraint" are extracted from fire protection technical standards, safe operating procedures, and typical accident cases to form a rule knowledge base. Natural language processing technology is used to parse the professional answers, identifying the fire protection scenarios described, the entities mentioned, and the suggested measures or judgments. The parsed scenarios, entities, and measures are logically matched and reasoned with the rules in the rule knowledge base to determine whether the answer content triggers any constraint violations. For potential problems detected, feedback information containing specific rule entries that violate the rules, descriptions of the violations, and suggested correction directions is generated, and the verification results are converted into reward values ​​that can be used for reinforcement learning.

[0012] Specifically, the large model is iteratively fine-tuned based on the evaluation feedback signal using a reinforcement learning algorithm, specifically employing a proximal policy optimization algorithm, the process of which includes: The current policy model is treated as the agent to be optimized, and the process of generating the professional answer is regarded as an action in a given fire query and retrieval context. The evaluation feedback signal, after fusion and normalization, is used as the reward obtained for this action. A value network is constructed to evaluate the expected cumulative reward in a given state, where the state includes the semantic representation of the enhanced prompt. In each iteration, the loss function of the policy network and the loss function of the value network are calculated by sampling multiple rounds of fire question-and-answer interaction data. The loss function of the policy network includes a policy gradient term, a pruning term to limit the policy update magnitude, and an entropy regularization term to encourage exploration. The parameters of the policy network and the value network are alternately optimized using gradient descent, so that the policy network tends to generate fire-related professional answers that can obtain higher comprehensive evaluation rewards, thereby achieving a gradual update of the model parameters.

[0013] Specifically, the method also includes a process for adding and updating the private vector knowledge base, specifically as follows: The system continuously monitors updates to standards related to intelligent fire protection, official reports of major fire accidents, patent gazettes for new fire protection technologies, and literature from authoritative fire protection research journals. When new or revised fire protection knowledge documents are detected, the system automatically triggers a knowledge extraction and vectorization process. After quality control, the knowledge is stored in the vector database, and the new vector is tagged with version and timeliness. The system also periodically reviews the timeliness of existing information blocks in the vector database. Based on the repeal of related regulations, the substitution relationship of technical standards, or the diminishing reference value of cases, outdated information is downgraded, archived, or marked to ensure that search results prioritize currently valid information.

[0014] Specifically, the method is further integrated with an intelligent fire protection IoT system. In the expert evaluation approach, the evaluation experts can retrieve real-time or historical IoT monitoring data related to the question-and-answer scenario as an evaluation aid when scoring. The IoT monitoring data includes building fire water system pressure, automatic fire alarm system signal records, electrical fire monitoring residual current values, fire equipment power status, and smart smoke detector location information. The evaluation experts combine the IoT monitoring data to determine whether the model-generated answers regarding equipment status analysis, fault cause inference, or early warning suggestions are consistent with the actual monitoring situation, and incorporate this consistency judgment into the evaluation dimension. This allows the feedback learning loop to integrate real physical system status information into the optimization process of the large model's professionalism.

[0015] Beneficial effects: The model knowledge update and question-answering method based on fusion retrieval enhancement and feedback learning provided by this invention achieves several significant beneficial effects, specifically tailored to the characteristics of the intelligent fire protection professional field. Firstly, this method constructs and dynamically maintains a private vector knowledge base composed of multimodal fire protection data, including regulations, cases, and standards. It then utilizes an embedding model deeply optimized for the semantics of the fire protection domain for real-time retrieval, fundamentally solving the problem of static lag in large-scale model knowledge. The system can consistently generate answers based on the latest and most relevant fire protection professional knowledge, ensuring the timeliness and accuracy of responses and effectively overcoming the potential risks of "fact illusion" in critical safety areas.

[0016] Secondly, the introduced feedback learning loop mechanism, particularly the dual feedback approach combining expert evaluation and automated rule verification, provides high-quality and diverse supervisory signals for continuous model optimization. This allows the model not only to passively receive retrieved information but also to actively learn from the evaluation of each interaction, understanding which answers are superior in terms of standardization, consistency, completeness, and operability. Through reinforcement learning algorithms, this understanding is translated into the incremental adjustment of model parameters, enabling the system's professional judgment ability to continuously improve with experience, much like human experts, achieving a qualitative leap from "possessing knowledge" to "being able to apply knowledge."

[0017] Furthermore, the methodology deeply integrates the professional characteristics of intelligent fire protection. From the domain embedding model based on comparative learning of fire protection triplet data, to the professional prompt templates that include safety warnings and regulatory reference requirements, and to the automated rule validator extracted from fire protection standards, each step is specifically designed for the knowledge system and safety requirements of the fire protection field. This not only significantly improves the accuracy of semantic retrieval and content generation, but also incorporates compliance and security verification checkpoints at the system level.

[0018] Furthermore, this method extends intelligence from the textual level to the physical system level through automated knowledge base monitoring and updating processes, and ultimately, integration with the fire protection IoT system. The knowledge base can keep pace with the times, and model optimization can incorporate real-world data feedback, making the entire system a continuously learning, dynamically evolving, and closely integrated intelligent agent with actual fire protection operations. This provides powerful, reliable, and continuously evolving intelligent support for fire risk prevention and control, facility management, emergency response, and accident analysis, demonstrating extremely high practical value and promising prospects for industry adoption. Attached Figure Description

[0019] Figure 1 This is a flowchart illustrating the model knowledge update and question answering method that integrates retrieval enhancement and feedback learning, provided in a specific embodiment of the present invention. Detailed Implementation

[0020] To enable those skilled in the art to better understand the technical solutions of the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Based on the embodiments in this application, other similar embodiments obtained by those skilled in the art without creative effort should all fall within the scope of protection of this application. Furthermore, directional terms mentioned in the following embodiments, such as "up," "down," "left," and "right," are only for reference to the directions in the accompanying drawings; therefore, the directional terms used are for illustrative purposes and not for limiting the invention.

[0021] The present invention will be further described below with reference to the accompanying drawings and preferred embodiments.

[0022] Please see Figure 1 This invention provides a model knowledge update and question answering method that integrates retrieval enhancement and feedback learning, comprising: S1. Based on the fire-related queries entered by the user, retrieve relevant background information fragments from a private vector knowledge base constructed from intelligent fire protection code provisions, fire accident cases, equipment technical standards, emergency response plans, and fire protection product manuals.

[0023] It should be further explained that the process of this method begins with receiving a user's professional query about intelligent fire protection, such as "What should the normally closed fire doors of a high-rise residential building be in during a fire, and what is the basis for this?" The system first sends the query to the retrieval module, which searches the private vector knowledge base for the most relevant information fragments related to concepts such as "fire door," "high-rise residential building," and "fire status." These fragments may come from specific clauses of the "Code for Fire Protection Design of Buildings," relevant fire accident investigation report summaries, etc.

[0024] S2. Combine the retrieved background information fragments with the fire-related queries to construct an enhanced prompt containing contextual information; input the enhanced prompt into a large model that has been fine-tuned by the intelligent fire corpus to generate professional answers related to fire protection.

[0025] It should be further explained that the retrieved fragments (usually 3-5) will be organized together with the original query according to a pre-defined, structured prompt template to form an enhanced prompt. For example, the prompt template could begin with "You are a smart fire protection expert. Please answer the user's question accurately and safely, strictly according to the following regulations and case information. The relevant information is as follows: [Retrieved fragment 1]...[Retrieved fragment n]. The user's question is:...". This complete prompt is fed into a large model (e.g., a model based on LLaMA, ChatGLM, etc.) that has been supervised and fine-tuned for fire protection texts (such as millions of words of regulations, cases, and papers). The model generates the final professional answer based on its internal parameters and the externally provided retrieval context.

[0026] S3. Establish a feedback learning loop, collect evaluation feedback signals for the professional answers, and based on the evaluation feedback signals, iteratively fine-tune the large model through a reinforcement learning algorithm to update the parameter knowledge of the large model.

[0027] It should be further explained that the system has established a closed-loop feedback learning mechanism. Every question-and-answer interaction and the resulting answer will be sent to the feedback collection module for evaluation. The obtained quantitative reward signal is used to make small and continuous adjustments to the model parameters through reinforcement learning techniques (such as PPO), so that the model can generate better answers to similar questions in the future, thereby realizing dynamic knowledge updates and continuous performance optimization.

[0028] Understandably, the core value of this method lies in the organic integration of three elements: the retrieval of the latest external knowledge, the internal reasoning and generation capabilities of a large language model, and a feedback learning loop based on human experts or rule verification. It solves two major challenges faced by large models in professional fields such as intelligent fire protection: "knowledge staticity" and "fact illusion." Through real-time retrieval, the model can acquire and answer questions based on the latest standards and norms, overcoming the "knowledge lag" caused by the expiration of training data in traditional large models. Through feedback-driven reinforcement learning, the model can learn from each professional assessment, continuously optimizing the accuracy, standardization, and safety of its generated answers. This allows the model's professional judgment capabilities to continuously evolve with time and accumulated feedback, rather than remaining in an initial fine-tuning state.

[0029] Specifically, the construction of the private vector knowledge base includes: collecting multimodal intelligent fire protection data, which includes textual fire protection design specifications, fire protection acceptance procedures, historical fire investigation reports, fire protection facility maintenance records, and fire fighting and rescue tactical guidelines, as well as structured building fire protection facility system diagrams, fire equipment operation parameter tables, and fire risk quantitative assessment tables; cleaning and standardizing the multimodal intelligent fire protection data, unifying fire protection professional terminology, equipment model descriptions, and units of measurement, and dividing it into information blocks with semantic integrity according to the document structure; using an embedding model pre-trained for fire protection text semantics and fire protection entity relationships, encoding the information blocks into high-dimensional vectors; storing the encoded vectors in a vector database, and establishing an index between the vectors and the original information block metadata, whereby the metadata includes at least the information source, publication date, associated fire scene category, and applicable building type.

[0030] It should be further explained that this step is the detailed process of building a high-quality private vector knowledge base, and the specific design includes: (1) Data Acquisition and Multimodal Integration: The system collects data extensively from authoritative sources. Text data sources include full texts of national and local fire protection technical standards (such as the GB series), technical specifications for fire protection product certification, official investigation reports of typical fire accidents, templates for annual inspection reports of fire protection facilities, and summaries of fire rescue operations. Structured data includes equipment location and pipeline information tables extracted from the CAD fire protection floor plans of buildings after analysis, statistical tables of historical sensor data exported from the fire protection IoT platform, and risk matrices and score tables from quantitative risk assessment reports. These multi-source heterogeneous data together constitute the raw materials of the knowledge base.

[0031] (2) Data Cleaning, Standardization, and Segmentation: A series of preprocessing operations are performed on the collected raw data. First, terminology is standardized, for example, different expressions such as "smoke detector," "smoke probe," and "smoke sensor" are mapped to the standard term "point-type smoke fire detector." Equipment models are standardized to the format of "manufacturer abbreviation + model." Units of measurement are standardized to the International System of Units (SI). Next, the data is segmented according to its inherent logical structure. For regulatory clauses, the smallest information block is usually a "clause" or "section"; for investigation reports, they are divided into chapters such as "accident overview," "direct cause," "indirect cause," "responsibility determination," and "improvement suggestions"; for structured tables, each row or a data group with complete meaning can be considered as an information block. The goal of segmentation is to give each information block independent semantics, which facilitates accurate retrieval later.

[0032] (3) Vector Encoding: Each text information block is encoded using a specially pre-trained text embedding model (e.g., based on the RoBERTa architecture, further trained on fire corpus). For non-text structured data, it is first converted into descriptive text statements before encoding. For example, a line from the equipment parameter table, “Model: JTY-GD-123, Alarm Threshold: 0.8dB / m, Protection Area: 60 square meters”, is converted into a natural language description: “The model of this point-type smoke detector is JTY-GD-123, its alarm threshold is 0.8 dB / m, and its maximum protection area is 60 square meters.” After encoding, each information block is represented as a 768-dimensional dense vector (this is the preferred dimension because it achieves a good balance between expressive power and computational efficiency, and is a commonly used output dimension of current pre-trained models).

[0033] (4) Vector Storage and Index Construction: Store the vectors of all information blocks in a dedicated vector database (such as Milvus, Pinecone). Simultaneously, create rich metadata records for each information block, including but not limited to: data source (e.g., "GB50016-2014, Clause 6.5.1"), publication date (2014-XX-XX), fire scenario category (e.g., "building fire prevention", "facility management", "electrical fire"), and applicable building type (e.g., "high-rise residential buildings", "commercial complexes", "hazardous chemical warehouses"). Establish an index from the vector to this metadata in the vector database, enabling rapid location of the original information content and related attributes represented by the retrieved vector.

[0034] Understandably, building such a specialized and structured vector knowledge base is the cornerstone of this method's ability to achieve enhanced precision retrieval. Its beneficial effects include: First, by integrating multimodal data, the knowledge base covers the entire lifecycle of intelligent fire protection, from design, construction, and acceptance to operation and maintenance and rescue, providing comprehensive information support for question answering.

[0035] Secondly, in-depth data cleaning and standardization greatly improve the accuracy and consistency of subsequent searches, avoiding search failures caused by ambiguity in terminology.

[0036] Third, the use of a dedicated embedding model for vectorization allows for a more precise mapping of the semantics of fire protection concepts (such as "fire resistance limit" and "mechanical smoke exhaust") in the vector space. Similar concepts are clustered together, while different concepts are separated, thus significantly improving the recall and precision of semantic retrieval. Fourth, the rich metadata not only facilitates the verification of the reliability of the results but also provides possibilities for subsequent retrieval strategy optimization (such as scene-based filtering).

[0037] Specifically, the pre-training process of the embedding model includes: collecting massive general corpora and large-scale intelligent fire protection professional corpora to form a training corpus, wherein the intelligent fire protection professional corpus covers multiple sub-directions such as building fire prevention, electrical fire prevention and control, hazardous chemical fire protection, smart fire protection IoT, and fire rescue command; pre-training the initial Transformer model by masking key fire protection entities, predicting sentence coherence, and constructing a fire scene graph-text comparison learning task, so that it learns deep semantic representation and cross-modal alignment capabilities in intelligent fire protection scenarios; after pre-training, using triplet data containing the relationships of "fire protection facilities-function", "fire cause-disaster factor", and "legal provisions-applicable scenarios" to perform comparative learning fine-tuning of the model, optimizing the embedding quality of the model for complex relationships in the fire protection professional knowledge network, and ensuring that fire protection equipment with similar functions, similar fire risks, and related legal provisions are close in distance in the vector space.

[0038] It should be further explained that this step aims to train a text embedding model that deeply understands the language of fire protection, and the training is divided into two main stages.

[0039] Phase 1: Domain-Adaptive Pre-training. A general Chinese pre-trained language model (e.g., RoBERTa-wwm-ext) is used for initialization. The training corpus consists of a mixture of general Chinese corpus (approximately 40%) and intelligent fire protection specialized corpus (approximately 60%). The specialized corpus is categorized and organized according to the aforementioned sub-directions. In this phase, an improved Masked Language Model (MLM) task is employed. Instead of randomly masking words, key fire protection entities (such as "automatic sprinkler system," "Class C liquids," and "smoke exhaust fan") are strategically masked, forcing the model to predict these entities and understand the context of these technical terms. Simultaneously, a Next Sentence Prediction (NSP) task is used, but sentence pairs are replaced with "condition-requirement" pairs from fire protection regulations or "phenomenon-cause" pairs from accident reports to enhance the model's grasp of the logical coherence of fire protection texts. Furthermore, for image and text data including diagrams of fire protection facilities and fire scene images, an image-text comparison learning task is constructed, enabling the model to learn to bridge image features with corresponding text descriptions in vector space, thus initially establishing cross-modal understanding capabilities. The training parameters for this stage are set as follows: batch size is 256, initial learning rate is 5e-5, Adam W optimizer is used, linear learning rate decay is used, and training is performed for 3 epochs (this is the preferred value, experience shows that continuing training can easily lead to overfitting, and the loss tends to stabilize on the validation set after 3 epochs).

[0040] Phase Two: Relationship-Aware Contrastive Learning Fine-Tuning. Based on the pre-trained model, we fine-tuned the model using carefully constructed fire safety knowledge triplet data through contrastive learning. The triplet format is (head entity, relation, tail entity), for example: ("wet alarm valve", "function is", "connects or shuts off water flow in the pipe network and activates the hydraulic alarm"), ("lithium battery thermal runaway", "is the cause of", "electric vehicle fire"), ("GB50016-2014 Article 8.4.1", "applies to", "shops with a building area greater than 1500 square meters on any floor"). We used these triples to construct positive and negative sample pairs. For a given anchor entity (e.g., "wet alarm valve"), entities connected to it in the same triplet via the relation ("connects or shuts off water flow in the pipe network and activates the hydraulic alarm") constitute positive samples; entities randomly selected from other entities constitute negative samples. The goal of contrastive learning is to make the cosine similarity of positive sample pairs in the vector space significantly higher than that of negative sample pairs. The loss function adopted is the InfoNCE loss function, which has the following form: in, Represents the query vector With key vector cosine similarity, It is a temperature overparameter (preferred value set at 0.05, relatively small). It can enhance the model's ability to distinguish difficult negative examples. It is a positive sample key vector. It is the first negative sample key vectors This refers to the number of negative samples (ideally 15, striking a balance between computational cost and discriminative power). Training parameters for this stage: batch size 64, learning rate 1e-5, training for 1 epoch.

[0041] It is understandable that the embedding model obtained through the above two-stage training has the following significant beneficial effects: First, its semantic representation space is highly customized for the fire protection field, which can accurately distinguish the functional differences between "fireproof roller shutter" and "fireproof door", and can also understand the conceptual connection between "flash point" and "ignition point", which is something that general embedding models cannot do.

[0042] Secondly, the contrastive learning fine-tuning enables the model's encoded vectors to not only contain the semantics of words, but also the structured relationships in the fire protection knowledge graph. This directly improves the retrieval quality based on vector similarity—document fragments that are relevant to the query in terms of "function" or "reason" can be effectively retrieved even if they do not match literally.

[0043] Finally, this model provides a high-quality, domain-relevant text representation foundation for the entire question-answering system, which is a key prerequisite for the superior performance of all subsequent modules.

[0044] Specifically, the retrieval based on user-inputted fire-related queries includes: identifying the intent and extracting key information from the fire-related queries; identifying whether the user's query is for fire regulations, fire cause analysis, equipment selection advice, emergency plan formulation, or fire accident liability determination; and extracting elements such as building type, fire type, fire equipment name, specific regulation number, and time and location from the query; based on the identified intent and extracted key information, semantically expanding and reconstructing the original query to generate one or more query expressions for retrieval, incorporating synonymous fire-related terms, higher or lower-level fire-related concepts, and frequently associated fire-related scenario keywords; encoding the query expressions into query vectors using the embedding model; calculating the similarity between the query vector and vectors stored in the vector database; selecting a preset number of background information fragments based on the similarity score from high to low; and simultaneously returning the corresponding metadata for credibility verification.

[0045] It should be further explained that this step is the core operation for achieving accurate retrieval, and its process is as follows: (1) Query Understanding: When a user queries "What is the minimum vertical distance requirement between a sprinkler head and a stack of goods in a factory?", the query is first processed by a lightweight joint model of intent classification and named entity recognition (NER). This model is based on the BERT architecture and fine-tuned on labeled fire safety question-and-answer data. It identifies the query intent as "fire safety regulations query" and extracts the key entities: building type / scenario as "factory", fire equipment as "sprinkler head" (standard name: sprinkler head), and the positional relationship as "minimum vertical distance from the stack of goods". This step converts the unstructured natural language query into structured information.

[0046] (2) Query Expansion and Reconstruction: Based on the identified intent and entities, the system expands the query from a pre-defined fire safety knowledge dictionary and thesaurus. For example, "sprinkler head" is expanded to "sprinkler head" and "automatic sprinkler system sprinkler head"; considering that a factory building may correspond to scenarios such as "warehouse" and "production workshop". At the same time, the higher-level concept "fire sprinkler head layout" and the lower-level concepts "upright sprinkler head" and "drooping sprinkler head" are introduced. Ultimately, the original query may be reconstructed into several more expressive and comprehensive query expressions, such as: "sprinkler head vertical distance regulations from goods stacks", "automatic sprinkler system sprinkler head installation height requirements in warehouses", and "minimum distance between fire sprinkler heads and combustibles". This helps to overcome the problem of unprofessional user expressions or incomplete information.

[0047] (3) Vector Encoding and Similarity Calculation: Using the previously trained dedicated embedding model, each reconstructed query expression is encoded into a query vector (also 768-dimensional). The system calculates the cosine similarity between each query vector and all information block vectors in the vector knowledge base in parallel. The calculation formula is as follows: in, and These represent the query vector and the knowledge base information block vector, respectively. Represents the dot product. This represents the L2 norm of the vectors. Cosine similarity ranges from [-1, 1], with values ​​closer to 1 indicating greater semantic similarity.

[0048] (4) Result Filtering and Return: The system merges the retrieval results of all query expressions and sorts them from high to low similarity scores. A similarity threshold is set (preferably 0.7, which is an empirical value; values ​​below this usually indicate weak semantic relevance and may introduce noise), and only results above this threshold are retained. Then, the top K information fragments with the highest similarity are selected from these results (K is preferably 5, which provides sufficient context while avoiding excessively long prompts that could distract the model). The full text of these 5 information fragments and their associated metadata (such as source standard number, publication date, etc.) are returned.

[0049] Understandably, the beneficial effects of this search process are: First, through intent recognition and entity extraction, the system can more accurately grasp the core of the user's query, providing a clear direction for subsequent expansion and retrieval.

[0050] Second, professional query expansion strategies greatly improve the recall rate of retrieval, ensuring that relevant but differently worded professional documents can be found.

[0051] Third, similarity is calculated using an embedding model optimized for the fire protection field, which is far more accurate than traditional retrieval based on keyword matching and can achieve deep semantic matching.

[0052] Fourth, by setting thresholds and upper limits on the number of answers, the context length of the input model is controlled while ensuring the relevance of the answers, thereby improving the overall efficiency of the system and the focus of the answers.

[0053] Specifically, the enhanced prompts are constructed using a specially designed fire safety-related prompt template. This template defines strict answer generation logic and content constraints, including: The system instructions clearly require the large model to act as an intelligent fire protection expert, and its responses must be strictly based on the provided background information and comply with national fire protection technical standards and safety principles. The context integration section is used to organize and present the retrieved background information fragments and their metadata, instructing the model to prioritize the content in the background information fragments. In the query and task section, clearly restate the user query and require the model to generate an answer. If it involves fire-fighting operations, it should be explained step by step and safety warnings should be emphasized. If it involves laws and regulations, the specific articles and their levels of effectiveness should be specified. If it involves data analysis, the data source and limitations should be explained. The output format requires that the answer be presented in a structured form, including the core conclusions, a summary of the basis, an explanation of the applicable conditions, and relevant suggestions or precautions.

[0054] It should be further explained that this step, through a carefully designed prompt template, organically combines the retrieved "knowledge" (context) with the user's "question" (query), and strictly guides the "behavior" (generation format and constraints) of the large model. A preferred prompt template example is as follows (where {context} and {query} are placeholders): You are a meticulous intelligent fire protection expert assistant. Your responsibility is to answer questions strictly based on the reference materials I provide. If the reference materials contain explicit answers, you must directly quote them and cite the source. If the materials are insufficient, you must truthfully disclose this information. Your answers must comply with current Chinese fire protection technical standards and safety management principles. Safety must always be the top priority, as specifically designed below: "

Reference Materials

[0055] 2. Detailed Basis: Provide a detailed explanation of the conclusion, and be sure to cite the specific content from the above-mentioned [References] (please indicate the source number, such as "Based on Reference 1"). If it is an operational issue, please explain it step by step, and add a [Safety Warning] after key steps. If it is a regulatory issue, please specify the name of the specific regulation, standard number, and clause number, and explain its effect (e.g., mandatory provisions).

[0056] 3. Applicable conditions and exceptions: Explain the applicable scenarios, preconditions, or possible exceptions to this conclusion or recommendation.

[0057] 4. Supplementary suggestions or precautions: Based on the reference materials and your professional knowledge, provide relevant supplementary suggestions, risk warnings, or directions for follow-up actions.

[0058] Please begin your answer: {context}”.

[0059] Understandably, using such a structured and strongly constrained prompt template has multiple beneficial effects: First, the system instruction section sets clear roles and security boundaries, effectively constraining the model's "imagination" and reducing the possibility of generating content that conflicts with existing standards or poses security risks.

[0060] Second, by clearly separating references from user questions and emphasizing "strict adherence," the model significantly increases the probability of following the retrieval context and reduces factual errors (illusions).

[0061] Third, the mandatory requirements for answer format ensure that the generated answers are highly consistent and readable, making it easy for users to quickly obtain the core conclusions and facilitating subsequent automated analysis and evaluation.

[0062] Fourth, the template includes generation guidelines for different types of questions (operations, regulations, data), which guide the model to organize the answer content in a professional and standardized manner, making the output more in line with the professional expression habits in the fire protection field.

[0063] Specifically, the collection and evaluation feedback signals include two parallel approaches: the first is a manual expert evaluation approach, which invites fire engineers, regulatory reviewers, or fire rescue command experts to score the professional answers based on a pre-set multi-dimensional scoring table. The scoring dimensions include at least the standardization of the answer, consistency with the latest fire protection standards, completeness of risk warnings, and operability of emergency response suggestions. The scores and written correction opinions are then converted into quantifiable reward signals. The second approach is an automated rule verification approach, which constructs a verifier based on fire protection code logic and safety rules. The verifier analyzes the professional answers, checks whether there are any violations of mandatory fire protection provisions, omissions of key fire protection facility configuration requirements, or suggestions for using outdated fire protection technologies, and generates negative reward signals or correction prompts based on the severity of the violations.

[0064] It should be further explained that feedback signals are the "fuel" driving the continuous optimization of the model. This method designs a dual feedback collection mechanism combining human and machine input, specifically including: (1) Expert evaluation approach: The system pushes the question-and-answer pairs (user query, retrieved background information, and model-generated answers) to an online expert evaluation platform. Evaluation experts (usually requiring registered fire engineer qualifications or equivalent professional level) receive a standardized evaluation form. This form contains multiple dimensions, each using a 5-point Likert scale (1 - very poor, 5 - excellent). Core dimensions include: a) Standardization: Is the answer expressed professionally and rigorously, and is the logic clear?

[0065] b) Consistency: Whether the answer content is completely consistent with the provided reference materials and the latest (at the time of assessment) fire protection standards.

[0066] c) Completeness: Whether the prompts regarding potential risks, operational prerequisites, and exceptions are comprehensive.

[0067] d) Feasibility: Whether the proposed suggestions or steps are specific and feasible. In addition to scoring, experts must provide brief corrections or improvement suggestions. Finally, the system will weight the scores of each dimension (e.g., consistency has the highest weight, set at 0.4; standardization 0.3; completeness 0.2; feasibility 0.1), normalize it to the [-1,1] interval as the human evaluation reward signal for this answer. The experts' written comments are then used to analyze common error patterns in the model.

[0068] (2) Automated Rule Validation Approach: This approach is implemented through a rule-based validator. The validator has a built-in scalable fire safety rule knowledge base, with rules defined in the form of "IF-THEN" or "condition-violation". For example, Rule 1: IF The answer text contains "Foam fire extinguishers can be used to extinguish lithium battery fires" THEN triggers a violation (Level: Severe, Explanation: "Foam fire extinguishers are prohibited from being used in lithium battery fires; dedicated fire extinguishers or large amounts of water should be used for cooling"). Rule 2: IF The answer mentions "evacuation distance" AND does not mention the specific building type (e.g., "high-rise building", "kindergarten") THEN triggers a warning (Level: General, Explanation: "Evacuation distance requirements vary depending on the building type; conditions must be clearly defined"). The validator parses the text of the model-generated answer and matches it against the rule base. Once a rule is triggered, a negative reward signal is generated based on the rule's preset violation level (severe, moderate, minor). For example, a serious violation is -1, a moderate violation is -0.5, and a minor violation is -0.2. If no rule is triggered, then... .

[0069] Understandably, the advantage of this dual-feedback mechanism lies in: First, expert evaluation provides high-quality, highly reliable supervisory signals, which are particularly suitable for judging the depth, logic, and practical application value of answers, something that current automated methods cannot completely replace.

[0070] Second, automated rule validation provides immediate, low-cost, and scalable supervision, enabling it to quickly capture obvious compliance errors and security vulnerabilities, thus achieving the first quality control of model output.

[0071] Third, the combination of the two ensures the authority and accuracy of the feedback signals (from experts) while improving the efficiency and coverage of feedback collection (from rule verification), providing sufficient and diverse training signals for subsequent reinforcement learning training.

[0072] Specifically, the verifier in the automated rule verification pathway is constructed in the following way: Safety and compliance rules in the form of "condition-action-constraint" are extracted from fire protection technical standards, safe operating procedures, and typical accident cases to form a rule knowledge base; natural language processing technology is used to parse the professional answers, identifying the fire protection scenarios described, the entities mentioned, and the suggested measures or judgments; the parsed scenarios, entities, and measures are logically matched and reasoned with the rules in the rule knowledge base to determine whether the answer content triggers any constraint violations; for potential problems detected, feedback information containing specific violation rule entries, descriptions of the violations, and suggested correction directions is generated, and the verification result is converted into a reward value that can be used for reinforcement learning.

[0073] It should be further explained that the construction of the automated rule validator is a process of formalizing knowledge in the field of fire protection. The specific design includes: (1) Rule Knowledge Base Construction: Rules are manually extracted and formalized into computer-processable rules from mandatory national standards (such as the Code for Fire Protection Design of Buildings GB50016), industry standards, product technical specifications, and the "Lessons Learned" section of major accident investigation reports. Each rule contains three core parts: triggering conditions, constraint conditions, and violation actions. For example: Rule ID: R-001 Triggering condition: The answer text contains both the entities {"building", "high-rise residential building"} and {"evacuation stairwell", "natural ventilation"}. Constraint condition: Building height > 54 meters Violation action: If "a mechanical pressurized air supply system should be installed" is not mentioned, a violation is triggered. Violation level: Severe. Correction suggestion: "According to Article 8.5.1 of GB50016-2014, high-rise residential buildings with a building height greater than 54 meters should use a mechanical pressurized air supply system for their smoke-proof stairwells and anterooms. Please provide supplementary explanation." The rule base is stored in JSON or XML format for easy maintenance and expansion.

[0074] (2) Answer Analysis: The verifier receives the answer text generated by the model. First, a Named Entity Recognition (NER) model finely tuned on fire safety text is used to identify all fire-related entities mentioned in the answer, such as building type, fire-fighting facilities, fire type, materials, parameters, etc., and classify them. At the same time, dependency parsing and semantic role labeling (SRL) techniques are used to parse the sentence structure, identify core predicates such as "recommendation", "requirement", and "prohibition" and their associated entities and parameters, forming basic fact units in the form of "(subject, predicate, object, condition)". For example, for the sentence "It is recommended to use carbon dioxide fire extinguishers to extinguish electrical fires in warehouses", the fact units are parsed as: (operator, recommended to use, carbon dioxide fire extinguishers, extinguish electrical fires in warehouses).

[0075] (3) Logical Matching and Reasoning: The parsed list of fact units is matched with the rules in the rule knowledge base. The matching process includes entity matching and conditional logic judgment. The system checks whether the set of entities mentioned in the answer contains the entities required for the triggering condition of a certain rule. If it does, it further attempts to verify the constraint conditions of the rule using the parameters mentioned in the answer or the parameters inferred from the context. For example, if rule R-001 is matched, it is necessary to verify whether "the building height is greater than 54 meters". If the height is not explicitly mentioned in the answer, the verifier will mark it as "condition not met, cannot be verified", and will not directly determine it as a violation, but may generate a warning message. If the condition is met and the answer lacks a description of the key measures required by the rule, it is determined to trigger a violation.

[0076] (4) Feedback Generation and Reward Conversion: For each triggered violation, the validator generates a structured feedback, including the rule ID, violation description, violation level, and correction suggestions. The final automated reward signal... It is calculated by combining the scores of all the violation levels. A simple calculation method is to take the score corresponding to the most severe violation level. A more refined method could be a weighted sum, for example: ,in Indicates the first One triggered violation, It is its rating score (e.g., severe = 1, moderate = 0.5, slight = 0.2). This is the weight (which can be set according to the importance of the rules; the default value is 1).

[0077] Understandably, building such a rule-based automated validator offers significant and efficient benefits: First, it enables rapid, batch compliance screening of model outputs, and can identify problems that clearly violate established safety regulations or technical standards at extremely low cost, which is crucial for ensuring the safety baseline of the intelligent fire-fighting question-and-answer system.

[0078] Second, the rule knowledge base can be updated and maintained independently of the large model. When new regulations or standards are released or old standards are abolished, only the rule base needs to be updated to enable the system to immediately have the ability to verify the new regulations, and the response is rapid.

[0079] Third, the detailed violation feedback it generates not only provides quantifiable reward signals, but its correction suggestions can also serve as high-quality supervisory data for subsequent correction of problematic answers and for supervised fine-tuning of the model, forming another way of knowledge injection.

[0080] Specifically, the large model is iteratively fine-tuned based on the evaluation feedback signal using a reinforcement learning algorithm, specifically employing a proximal policy optimization algorithm. The process includes: treating the current policy model as the agent to be optimized, and considering the process of generating the professional answer as an action within a given fire safety query and retrieval context; using the fused and normalized evaluation feedback signal as the reward for this action; constructing a value network to evaluate the expected cumulative reward in a given state, where the state includes the semantic representation of the enhanced prompt; in each iteration, by sampling multiple rounds of fire safety question-and-answer interaction data, calculating the loss function of the policy network and the loss function of the value network, where the loss function of the policy network includes a policy gradient term, a pruning term to limit the policy update magnitude, and an entropy regularization term to encourage exploration; and alternately optimizing the parameters of the policy network and the value network using gradient descent, so that the policy network tends to generate fire safety professional answers that yield higher comprehensive evaluation rewards, thereby achieving a gradual update of the model parameters.

[0081] It should be further explained that this step utilizes reinforcement learning (RL) to achieve continuous, online optimization of model parameters, specifically employing the stable and efficient algorithm Proximal Policy Optimization (PPO). We consider a complete question-and-answer interaction as a "episode" in RL. State This is the semantic representation of the current enhanced suggestion (including query and retrieval context), and its [CLS]-tagged hidden state vector can be obtained through the encoder of the large model itself. Action It is a large model in state The following is the process of autoregressively generating the entire answer sequence. Strategy That is, the large model itself, whose parameters are .award After the answer is generated, a comprehensive reward signal is obtained by combining human evaluation and automated rule verification. The specific design includes: (1) Reward signal fusion: First, the manually evaluated reward is fused. (Range [-1,1]) and automated verification rewards (Merge within the range [-1, 0]). A simple linear fusion method is as follows: ,in This is the fusion weight, with a preferred value of 0.7. This indicates greater trust in expert evaluation, but serious violations by automated verification have a strong negative impact, acting as a veto. For training stability, the final reward is typically adjusted... Normalization is performed, for example, by subtracting a baseline value (the average reward over several rounds) and dividing by the standard deviation, so that the mean is 0 and the variance is 1, yielding the reward used for PPO training. .

[0082] (2) Network structure and optimization objective: In PPO, we have a policy network (i.e., a large model). ) and a value network , These are the parameters of the value network. The structure of a value network typically involves adding a fully connected layer on top of the policy network encoder, outputting a scalar representing the current state. The expected cumulative reward is estimated. The goal of the PPO algorithm is to maximize a constrained objective function. Its policy network loss function... It consists of three parts: in, It is the probability ratio of the new strategy to the old strategy. These are the old strategy parameters before the update. It is the advantage function estimate, representing the action. Advantage relative to the average level is typically calculated using generalized advantage estimation (GAE), as shown in the formula: ,in , It is a discount factor (preferred value 0.99). It is the GAE parameter (preferred value 0.95). It is a pruning hyperparameter (preferred value 0.2), used to limit the magnitude of each policy update to prevent excessive updates from causing a crash. Indicates time step The expectation.

[0083] The loss function for value networks typically uses mean squared error: in From time step The initial cumulative discount reward.

[0084] In addition, an entropy regularization term is usually added. This encourages exploration and prevents the strategy from prematurely converging to a local optimum. Therefore, the total policy loss is: in and It is a coefficient, the preferred value. , .

[0085] (3) Training process: In each iteration, the current policy model is used. Interact with the environment (i.e., the user query and retrieval module) to collect a batch of question-and-answer interaction data (e.g., N=1000 question-and-answer pairs) and their corresponding rewards. Using this data, calculate the advantage estimate. and returns Then, over K epochs (K is preferably 3-4), the above methods are alternately optimized using mini-batch gradient descent. To update policy network parameters and value network parameters After the update is complete, replace the old strategy with the new one, continue collecting new data, and begin the next iteration.

[0086] Understandably, using the PPO algorithm for feedback learning and fine-tuning has the following key beneficial effects: First, it can handle sparse, delayed reward signals from the environment (such as human evaluation) and effectively transmit these signals to every decision step (token generation) in the model's answer generation process, guiding the model to optimize towards obtaining higher rewards (i.e., more professional, safer, and more compliant answers).

[0087] Second, the PPO algorithm limits the step size of each policy update through a pruning mechanism, ensuring the stability of the training process and avoiding the performance collapse caused by excessive updates in traditional policy gradient methods. This is especially important for fine-tuning large models with a huge number of parameters.

[0088] Third, this process enables "online" updates to the model's knowledge. As the system continuously collects user queries and expert feedback in real-world applications, the model can learn continuously, and its professional question-answering capabilities can improve with accumulated experience, just like human experts, thus maintaining a high level of quality and timeliness over the long term.

[0089] Specifically, the method also includes a process for adding and updating the private vector knowledge base, which involves: continuously monitoring standard update notices related to intelligent fire protection, official reports of major fire accidents, patent gazettes of new fire protection technologies, and authoritative fire protection research journal articles; when new or revised fire protection knowledge documents are detected, the knowledge extraction and vectorization process is automatically triggered, and after quality control, the knowledge is stored in the vector database, and the new vector is tagged with version and timeliness; the timeliness of existing information blocks in the vector database is reviewed regularly, and outdated information is downgraded, archived, or marked based on the repeal of related regulations, the substitution relationship of technical standards, or the decay of case reference value, to ensure that the search results return currently valid information first.

[0090] It should be further explained that, in order to ensure the timeliness of the knowledge base and thus guarantee the "freshness" of the answers in the question-answering system, this method establishes a continuous operation and maintenance mechanism for the knowledge base, the specific design of which includes: (1) Monitoring and Discovery: The system establishes an automated monitoring list and subscribes to updates from key information sources. This includes: a) The official websites of the National and Local Standardization Management Committees monitor the release, revision, and repeal announcements of national standards (GB) and industry standards (such as XF and JGJ) related to fire protection.

[0091] b) Obtain investigation reports and notifications of major fire accidents from the official websites of the Ministry of Emergency Management, the Fire and Rescue Bureau, etc.

[0092] c) The State Intellectual Property Office's patent database monitors the publication of relevant invention patents and utility model patents through keywords (such as "fire extinguishing", "firefighting", "flame retardant").

[0093] d) Regularly crawl the latest research paper abstracts from mainstream fire protection academic journal websites or databases (such as CNKI, Wanfang data, and core fire protection journals). The monitoring frequency can be set according to the importance of the information source; standard announcements are recommended for daily monitoring, while journal articles can be monitored weekly or monthly.

[0094] (2) Automated Processing Flow: When a new document (such as a newly released GB standard PDF) is detected, the system automatically starts the processing pipeline. First, document parsing and information extraction are performed, similar to the process of building the initial knowledge base, including format conversion, cleaning, standardization, and chunking. Then, the latest domain embedding model (i.e., a model optimized through continuous feedback learning) is used to encode the new information chunks into vectors. Before storing them in the vector database, quality control steps are performed, such as checking whether the extracted text chunks are complete, whether the vector encoding is successful, and comparing them with similar content already in the database to avoid complete duplication. After passing quality control, the new vectors are inserted into the database with metadata tags such as "effective date" (e.g., the implementation date of the new standard), "entry date," "version number" (e.g., V2.0), and "status" (e.g., "currently in effect").

[0095] (3) Timeliness Review and Maintenance: The system periodically (e.g., quarterly) reviews the timeliness of all entries in the knowledge base. The review is based on rules and policies: a) For regulatory and standard entries, the system will check whether their "standard number" appears in the latest monitored list of abolished standards, or whether a new version with the same standard number has been released.

[0096] b) For accident cases, a reference value decay strategy can be set. For example, for cases older than 10 years, the "reference weight" will be automatically reduced by 0.1.

[0097] c) For technical entries, if a clear technical replacement announcement is detected (e.g., "a certain type of fire extinguishing agent has been phased out"), the associated entry is marked. For entries confirmed to be obsolete, replaced, or outdated, the system will not immediately physically delete them, but will instead perform one of the following operations: i) De-weighting: During retrieval, the similarity score of these entries is multiplied by a decay factor less than 1 (such as 0.1), making it difficult for them to rank at the top of the results.

[0098] ii) Archive: Move it to a separate "Historical Knowledge" section for retrieval only when querying historical questions.

[0099] iii) Tagging: Update its status to "obsolete" or "risk of being outdated" in the metadata and display a warning message to users / administrators in the search results.

[0100] Understandably, the core benefit of establishing such a dynamic knowledge base update and maintenance process lies in giving the entire question-and-answer system a continuously evolving vitality, specifically including: First, it ensures that the system's knowledge base is updated synchronously with real-world fire safety knowledge, enabling the model to respond based on the latest regulations and cases, fundamentally overcoming the inherent problem of "outdated" knowledge in static models.

[0101] Second, automated processing greatly reduces the human cost of maintaining the knowledge base, enabling the system to efficiently absorb massive amounts of new information.

[0102] Third, the refined timeliness management strategy ensures both the accuracy and effectiveness of search results (prioritizing current regulations) and the traceability of historical information, meeting the query needs in different scenarios (such as understanding the evolution of historical regulations). Together, these constitute a self-updating and up-to-date intelligent fire protection knowledge infrastructure.

[0103] Specifically, the method is further integrated with an intelligent fire protection IoT system. In the expert evaluation approach, the evaluation experts can retrieve real-time or historical IoT monitoring data related to the question-and-answer scenario as an evaluation aid when scoring. The IoT monitoring data includes building fire water system pressure, automatic fire alarm system signal records, electrical fire monitoring residual current values, fire equipment power status, and smart smoke detector location information. The evaluation experts combine the IoT monitoring data to determine whether the model-generated answers regarding equipment status analysis, fault cause inference, or early warning suggestions are consistent with the actual monitoring situation, and incorporate this consistency judgment into the evaluation dimension. This allows the feedback learning loop to integrate real physical system status information into the optimization process of the large model's professionalism.

[0104] It should be further explained that this is a key extension of the method towards deeper intelligence and scenario-based application. In specific implementation, it is necessary to establish an API interface or data channel between the question-and-answer system and the intelligent fire protection IoT platform. The specific design includes: (1) Data Association and Retrieval: When a user query involves specific buildings, facilities, or historical events, such as "Analyze the possible reasons for the frequent start-up of fire pumps in XX Building last month" or "Assess the fire risk level of the 5th floor of Building 3 based on current data," the system, in the retrieval stage of generating the answer, will not only search the text knowledge base but also attempt to extract key entities from the query (such as "XX Building," "fire pump," and "5th floor of Building 3"). When submitting the question-and-answer pair to experts for evaluation, the system will automatically initiate a data query request to the associated intelligent fire protection IoT platform through the above entity information to obtain monitoring data of relevant equipment within a specified time period. For example, for pump problems, it retrieves the pump's starting current, running time, and historical pipeline pressure curves; for risk assessment, it retrieves the recent status data of smoke detectors, heat detectors, and electrical fire detectors in the area, as well as flame recognition alarm records from video surveillance. These data will be presented to the evaluation experts in a visual form, such as charts and time-series curves, along with a summary of the original data.

[0105] (2) Enhanced Expert Evaluation: When reviewing the text-based answers generated by the model, evaluation experts can simultaneously examine the IoT monitoring data provided by the system. Based on their extensive professional knowledge and experience, experts judge whether the model's inferences or suggestions align with the system status revealed by the actual data. For example, the model might infer based on general knowledge that "frequent pump starts may be due to minor leaks in the pipe network," but IoT data clearly shows that the pipe network pressure is stable during startup, and each startup is accompanied by a pressure switch activation signal from the end-of-line test device of a fire compartment. Experts can then determine that the real cause is more likely "the end-of-line test device of that compartment is not completely shut off." In this case, experts will give a lower score in the "consistency" or "operability" dimension, and clearly point out the deviation between the model's inferences and the factual data in their correction comments, providing a correct analysis based on the data.

[0106] (3) Enrichment of feedback signals and model optimization: This conformity judgment based on real physical data is quantified into a new evaluation sub-dimension, such as "data conformity", and incorporated into the final manual evaluation reward. In the calculation, the model receives a positive reward when its generated answer closely matches IoT data, and a negative reward otherwise. Through reinforcement learning, the model gradually learns how to combine its "book knowledge" with specific, dynamic "field data" to make analyses and judgments that are more relevant to the actual situation. Essentially, this trains the model to understand and apply fire safety knowledge within the context of a "digital twin."

[0107] Understandably, the deep integration with the smart fire protection IoT has brought unprecedented benefits: First, it elevates model optimization from a purely "text-to-text" or "knowledge-to-text" level to a "physical world data-to-text decision-making" level, greatly enhancing the model's practicality and reliability in complex scenarios such as diagnosis, prediction, and early warning.

[0108] Second, it provides objective and quantitative data support for expert evaluation, making the evaluation no longer based solely on subjective professional knowledge, but incorporating objective facts, thus improving the quality and credibility of feedback signals.

[0109] Third, this represents a new paradigm: the closed-loop linkage between large language models and vertical industry IoT systems. The model continuously calibrates its cognition and understanding of the physical world through feedback learning, and eventually becomes a truly "industry-savvy" intelligent agent that can deeply integrate OT (Operational Technology) and IT (Information Technology), playing an irreplaceable role in the core businesses of intelligent fire protection such as operation and maintenance, diagnosis, early warning, and command.

[0110] Furthermore, to more intuitively demonstrate the specific operation process of this method, the following section uses a typical question-and-answer scenario in the field of intelligent fire protection to explain in detail the data processing, calculation, and interaction of each module: (1) Case background and query input Suppose a fire protection facility operator enters a query into the system interface: "In the atrium area of ​​a large commercial complex, after the fireproof roller shutter descends, should the smoke detectors on both sides of it still participate in the subsequent linkage of the fire alarm system? What is the basis for this?" After the user submits the query, the system initiates the processing flow.

[0111] (2) Query understanding and retrieval process First, the query understanding module performs intent recognition and key information extraction on the query. After processing, the query intent is identified as "fire protection facility linkage logic query," and key entities are extracted: the scenario is "atrium of a large commercial complex," the equipment includes "fireproof roller shutter" and "smoke detector," and the actions are "after descent" and "participate in linkage." Based on this, the query is expanded to: "Large commercial complex atrium fireproof roller shutter descent smoke detector fire automatic alarm system linkage logic regulations."

[0112] Subsequently, this extended query is encoded into a 768-dimensional query vector using a dedicated embedding model. System calculation With all information block vectors in the vector knowledge base cosine similarity The similarity threshold is set to 0.7, and the top 5 most similar information blocks and their metadata are returned. For example, one of the returned fragments reads: "According to Article 4.6.1 of the 'Code for Design of Automatic Fire Alarm Systems' GB50116-2013, when a fireproof roller shutter descends to the floor surface, the smoke detectors located on both sides of the shutter within its fire compartment should cease participating in the subsequent linkage logic of the fire alarm system, but the alarm function should be maintained." Its similarity score is 0.89. The source metadata for this fragment is displayed as "Article 4.6.1 of GB50116-2013".

[0113] (3) Prompt Construction and Answer Generation Five relevant information fragments and their metadata were retrieved and populated into a pre-defined fire safety professional prompt template. The system instruction section emphasized the need for strict adherence to the provided documentation. The context section clearly listed the fragment content and its source. The query and task section restated the user's question, requiring a step-by-step explanation and citation of sources. The final enhanced prompt was input into a finely tuned large model. Based on the retrieved key information, the model generated a structured answer. The core conclusion of the answer was: "After the fireproof roller shutter descends to the floor slab, the smoke detectors on both sides should cease participating in the subsequent linkage of the fire alarm system, but must maintain normal alarm functionality." The detailed basis section cited "Document 1 (i.e., Clause 4.6.1 of GB50116-2013)" and further explained that this measure was to prevent false linkage caused by changes in the smoke diffusion path after the roller shutter descends. The applicable conditions section supplemented the explanation that this regulation applies to situations where the roller shutter is used as a fire compartment. The output format conformed to the template requirements.

[0114] (4) Automated rule verification and feedback signal generation After the answer is generated, the automated rule validator is activated. The validator parses the answer text, identifying the entities "fireproof roller shutter," "smoke detector," and "linkage," as well as the action suggestion "stop participating in linkage." The rule knowledge base has a pre-defined rule: "IF the answer mentions 'fireproof roller shutter descent' and 'smoke detector linkage' AND does not mention 'except in manual control mode in the fire control room' THEN trigger warning (level: minor)." The validator's logic matching reveals that while the answer correctly references the general situation, it does not cover the possible exception of "in manual control mode in the fire control room, the relevant detector can continue to participate in linkage" (referring to the relevant provisions of GB50116). Therefore, this rule is triggered, generating a negative reward signal. Simultaneously, the question-and-answer pair was also submitted to the expert evaluation platform. Experts, based on the provided search fragments, assessed the answers' standardization, consistency, and completeness, and then provided scores for each dimension. These scores were weighted and calculated to obtain the final score. According to the reward fusion formula ,Pick Calculate the comprehensive reward The reward was then normalized and used as the final reward signal for this question-and-answer session. .

[0115] (5) Iterative update of model parameters The data (status) of this Q&A interaction ,action ,award The data is stored in the experience pool. Once enough interaction data has been accumulated, a round of PPO algorithm updates is initiated. The generalized advantage estimation (GAE) is used to calculate the advantage estimate. discount factor GAE parameters Based on the policy loss function and value loss function Gradient descent optimization was performed on the parameters of the policy network (large model) and the value network. In this update, due to minor flaws in the completeness of the answer (excluding manual control exceptions), [the following occurred]. The value is negative, thus affecting the model parameters during policy gradient updates. It will be fine-tuned to better accommodate such exceptions when generating similar answers in the future. Value network parameters It is also updated synchronously to more accurately predict state value.

[0116] (6) Case Result Analysis This case study fully demonstrates the closed loop of the method from query to feedback learning: First, through domain-optimized retrieval, the system accurately locates the latest and most relevant regulatory provisions, ensuring the timeliness and accuracy of the answers and overcoming the problem that static knowledge in the model may become outdated.

[0117] Secondly, the structured prompt template guides the model to generate professional answers with standardized formatting and clear citations.

[0118] Furthermore, based on refined fire protection logic, the automated rule validator discovered the inadequacy of the answer in extreme cases (manual control state) and generated quantitative negative feedback.

[0119] Finally, the feedback signal is fused with the expert evaluation signal, and the PPO algorithm drives iterative optimization of the model. This demonstrates the core advantage of this method: it not only relies on retrieval to provide real-time knowledge, but also enables the model to autonomously identify and correct subtle deviations in professional completeness and compliance rigor through continuous feedback learning cycles, thereby achieving gradual evolution of professional capabilities. This case verifies the effectiveness of the system in providing accurate, reliable, and evolvable responses to complex and professional fire protection technical consultations.

[0120] In a preferred embodiment, this application also provides an electronic device, the electronic device comprising: The computer device includes a memory and a processor, wherein the memory stores computer-readable instructions that, when executed by the processor, implement the model knowledge update and question-answering method of fusion retrieval enhancement and feedback learning. The computer device can be broadly categorized as a server, terminal, or any other electronic device with the necessary computing and / or processing capabilities. In one embodiment, the computer device may include a processor, memory, network interface, communication interface, etc., connected via a system bus. The processor of the computer device can be used to provide the necessary computing, processing, and / or control capabilities. The memory of the computer device may include non-volatile storage media and internal memory. The non-volatile storage media may store an operating system, computer programs, etc. The internal memory can provide an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface and communication interface of the computer device can be used to connect and communicate with external devices via a network. When the computer program is executed by the processor, it performs the steps of the method of the present invention.

[0121] This invention can be implemented as a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, causes the steps of the methods of embodiments of the invention to be performed. In one embodiment, the computer program is distributed across multiple network-coupled computer devices or processors, such that the computer program is stored, accessed, and executed in a distributed manner by one or more computer devices or processors. A single method step / operation, or two or more method steps / operations, may be executed by a single computer device or processor or by two or more computer devices or processors. One or more method steps / operations may be executed by one or more computer devices or processors, and one or more other method steps / operations may be executed by one or more other computer devices or processors. One or more computer devices or processors may execute a single method step / operation, or execute two or more method steps / operations.

[0122] Those skilled in the art will understand that the method steps of this invention can be performed by a computer program instructing related hardware, such as a computer device or processor, to perform the steps of this invention when executed. Depending on the context, any references herein to memory, storage, databases, or other media may include non-volatile and / or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.

[0123] The technical features described above can be combined arbitrarily. Although not all possible combinations of these technical features are described, any combination of these technical features should be considered to be covered by this specification, provided that such combination does not contain contradictions.

[0124] The specific embodiments of the present invention described above do not constitute a limitation on the scope of protection of the present invention. Any other corresponding changes and modifications made in accordance with the technical concept of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A model knowledge update and question answering method integrating retrieval enhancement and feedback learning, characterized in that, include: S1. Based on the user's input of fire-related queries, retrieve relevant background information fragments from a private vector knowledge base constructed from intelligent fire protection code provisions, fire accident cases, equipment technical standards, emergency response plans, and fire protection product manuals; S2. Combine the retrieved background information fragments with the fire-related queries to construct an enhanced prompt containing contextual information; The enhanced prompts are input into a large model that has been fine-tuned with an intelligent fire-fighting corpus to generate professional answers related to fire safety. S3. Establish a feedback learning loop, collect evaluation feedback signals for the professional answers, and based on the evaluation feedback signals, iteratively fine-tune the large model through a reinforcement learning algorithm to update the parameter knowledge of the large model; The construction of the private vector knowledge base includes: Multimodal intelligent fire protection data is collected, including textual fire protection design codes, fire protection acceptance procedures, historical fire investigation reports, fire protection facility maintenance records, and fire fighting and rescue tactical guidelines, as well as structured building fire protection facility system diagrams, fire equipment operation parameter tables, and fire risk quantitative assessment tables. The multimodal intelligent fire protection data is cleaned and standardized, unifying fire protection terminology, equipment model descriptions, and units of measurement, and divided into semantically complete information blocks according to document structure. Using an embedding model pre-trained for fire protection text semantics and fire protection entity relationships, the information blocks are encoded into high-dimensional vectors. The encoded vectors are stored in a vector database, and an index is established between the vectors and the original information block metadata. The metadata includes at least the information source, publication date, associated fire scenario category, and applicable building type. The pre-training process of the embedding model includes: A training corpus was constructed by collecting general corpora and a large-scale intelligent fire protection professional corpus. The intelligent fire protection professional corpus covers multiple sub-directions, including building fire prevention, electrical fire prevention and control, hazardous chemical fire protection, smart fire protection IoT, and fire rescue command. The initial Transformer model was pre-trained by masking key fire protection entities, predicting sentence coherence, and constructing a fire scene graph-text comparison learning task, so that it could learn deep semantic representations and cross-modal alignment capabilities in intelligent fire protection scenarios. After pre-training, the model was fine-tuned by comparative learning using triplet data containing relationships of "fire protection facilities-function", "fire cause-causing factors", and "legal provisions-applicable scenarios", optimizing the model's embedding quality of complex relationships in the fire protection professional knowledge network, and ensuring that fire protection equipment with similar functions, similar fire risks, and related legal provisions are close in distance in the vector space.

2. The method according to claim 1, characterized in that, The retrieval based on user-input fire-related queries includes: The system performs intent recognition and key information extraction on the fire-related queries. It identifies whether the user's query is for fire regulations, fire cause analysis, equipment selection advice, emergency plan development, or fire accident liability determination, and extracts elements such as building type, fire type, fire equipment name, specific regulation number, and time and location from the query. Based on the identified intent and extracted key information, the original query is semantically expanded and reconstructed to generate one or more query expressions for retrieval. These expressions incorporate synonymous fire-related terms, higher or lower-level fire-related concepts, and frequently associated fire-related scenario keywords. The embedded model encodes the query expressions into query vectors. The similarity between the query vector and vectors stored in the vector database is calculated. A preset number of background information fragments are selected based on the similarity score from high to low, and the corresponding metadata is returned for credibility verification.

3. The method according to claim 1, characterized in that, The enhanced prompts are constructed using a specially designed fire safety-related prompt template. This template defines strict answer generation logic and content constraints, including: The system instructions clearly require the large model to act as an intelligent fire protection expert, and its responses must be strictly based on the provided background information and comply with fire protection technical standards and safety principles. The context integration section is used to organize and present the retrieved background information fragments and their metadata, instructing the model to prioritize the content in the background information fragments. In the query and task section, clearly restate the user query and require the model to generate an answer. If it involves fire-fighting operations, it should be explained step by step and safety warnings should be emphasized. If it involves laws and regulations, the specific articles and their levels of effectiveness should be specified. If it involves data analysis, the data source and limitations should be explained. The output format requires that the answer be presented in a structured form, including the core conclusions, a summary of the basis, an explanation of the applicable conditions, and relevant suggestions or precautions.

4. The method according to claim 1, characterized in that, Collecting evaluation feedback signals involves two parallel approaches: One approach is through expert evaluation, which involves inviting fire engineers, regulatory reviewers, or fire and rescue command experts to score the professional answers based on a pre-set multi-dimensional scoring table. The scoring dimensions include at least the standardization of the answer, consistency with the latest fire protection standards, completeness of risk warnings, and operability of emergency response suggestions. The scores and written correction opinions are then converted into quantifiable reward signals. The second approach is automated rule verification. A verifier based on fire protection code logic and safety rules is constructed. The verifier parses the professional answer and checks whether it violates mandatory fire protection provisions, ignores the configuration requirements of key fire protection facilities, or suggests the use of outdated fire protection technologies. Based on the severity of the violation, a negative reward signal or correction prompt is generated.

5. The method according to claim 4, characterized in that, The validator in the automated rule validation process is constructed in the following way: Safety and compliance rules in the form of "condition-action-constraint" are extracted from fire protection technical standards, safe operating procedures, and typical accident cases to form a rule knowledge base. Natural language processing technology is used to parse the professional answers, identifying the fire protection scenarios described, the entities mentioned, and the suggested measures or judgments. The parsed scenarios, entities, and measures are logically matched and reasoned with the rules in the rule knowledge base to determine whether the answer content triggers any constraint violations. For potential problems detected, feedback information containing specific rule entries that violate the rules, descriptions of the violations, and suggested correction directions is generated, and the verification results are converted into reward values ​​that can be used for reinforcement learning.

6. The method according to claim 1, characterized in that, Based on the evaluation feedback signal, the large model is iteratively fine-tuned using a reinforcement learning algorithm, specifically employing a proximal policy optimization algorithm. The process includes: The current policy model is treated as the agent to be optimized, and the process of generating the professional answer is regarded as an action in a given fire query and retrieval context. The evaluation feedback signal, after fusion and normalization, is used as the reward obtained for this action. A value network is constructed to evaluate the expected cumulative reward in a given state, where the state includes the semantic representation of the enhanced prompt. In each iteration, the loss function of the policy network and the loss function of the value network are calculated by sampling multiple rounds of fire question-and-answer interaction data. The loss function of the policy network includes a policy gradient term, a pruning term to limit the policy update magnitude, and an entropy regularization term to encourage exploration. The parameters of the policy network and the value network are alternately optimized using gradient descent, so that the policy network tends to generate fire-related professional answers that can obtain higher comprehensive evaluation rewards, thereby achieving a gradual update of the model parameters.

7. The method according to claim 1, characterized in that, The method also includes a process for adding and updating the private vector knowledge base, specifically: The system continuously monitors updates to standards related to intelligent fire protection, official reports of major fire accidents, patent gazettes for new fire protection technologies, and literature from authoritative fire protection research journals. When new or revised fire protection knowledge documents are detected, the system automatically triggers a knowledge extraction and vectorization process. After quality control, the knowledge is stored in the vector database, and the new vector is tagged with version and timeliness. The system also periodically reviews the timeliness of existing information blocks in the vector database. Based on the repeal of related regulations, the substitution relationship of technical standards, or the diminishing reference value of cases, outdated information is downgraded, archived, or marked to ensure that search results prioritize currently valid information.

8. The method according to claim 4, characterized in that, The method is further integrated with an intelligent fire protection IoT system. In the expert evaluation approach, the evaluation experts can retrieve real-time or historical IoT monitoring data related to the question-and-answer scenario as an evaluation aid when scoring. The IoT monitoring data includes building fire water system pressure, automatic fire alarm system signal records, electrical fire monitoring residual current values, fire equipment power status, and smart smoke detector location information. The evaluation experts combine the IoT monitoring data to determine whether the model-generated answers regarding equipment status analysis, fault cause inference, or early warning suggestions are consistent with the actual monitoring situation, and incorporate this consistency judgment into the evaluation dimension. This allows the feedback learning loop to integrate real physical system status information into the optimization process of the large model's professionalism.

Citation Information

Patent Citations

  • Dynamic adaptation question answering system and method based on hierarchical structure and retrieval enhancement

    CN118193714A

  • Intelligent agent-based big language model retrieval enhancement generation system and method

    CN120470088A