A safety specification retrieval method and apparatus

The safety specification retrieval method, which is constructed by multimodal layout analysis and metadata tags, solves the problem of missing key information in existing technologies and achieves high-accuracy retrieval of safety production specifications and identification of potential hazards.

CN122633882APending Publication Date: 2026-08-25SINOSTEEL WUHAN SAFEY&ENVIRONMENT PROTECTION RES
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610645471.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-12
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

Existing technologies suffer from omissions of key information and summarization errors in the retrieval of safety production standards, resulting in a low accuracy rate in identifying potential hazards and failing to meet the application needs of scenarios with high accuracy requirements.

Method used

By using multimodal layout analysis to identify and preserve the original hierarchical structure of the original specification document, adaptive dynamic segmentation is performed, metadata tags are extracted, and text blocks and their associated metadata groups are constructed in semantic blocks and stored in a vector database. The retrieval process is optimized by combining Monte Carlo Dropout and Bayesian ranking.

Benefits of technology

It achieves complete retention and accurate retrieval of key information, avoids confusion in clause attribution and loss of key information, and improves the accuracy of hazard identification and the reliability of safety specification retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122633882A_ABST
    Figure CN122633882A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of safety production, and provides a safety specification retrieval method and device. The present application performs multi-modal layout analysis on an original specification document, identifies and retains the original hierarchical structure of the original specification document, and performs adaptive dynamic blocking, each block maintaining the atomic semantic integrity of safety clauses to obtain a semantic block sequence; metadata tags of semantic blocks in each semantic block sequence are extracted; the metadata tags are concatenated with the corresponding semantic blocks at the feature level to construct data tuples of the semantic block text blocks and their associated metadata tags; the vectorized data tuples are stored in a vector database to perform safety specification retrieval based on the vectorized data tuples, solving the problem of rough data preprocessing means of the prior art, which leads to easy omission or aggregation errors of key information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of safety production technology, and in particular to a method and apparatus for retrieving safety regulations. Background Technology

[0002] Safety production standards are the fundamental guidelines for enterprise safety production inspections and the core basis for safety production supervision and law enforcement. The accuracy of the standard's name, number, number of articles, and specific clause content directly determines the legality of hazard identification, the correctness of rectification direction, and is a crucial prerequisite for avoiding penalties for enterprise violations and preventing the recurrence of safety accidents.

[0003] However, small and medium-sized enterprises (SMEs) generally face the practical dilemma of "not learning deeply enough and not being sure" in the application of safety standards. Their hazard identification lacks accuracy and comprehensiveness, standards are often incorrectly cited, and the quality of inspections varies greatly. Furthermore, existing safety standards are stored in a scattered, fragmented manner, lacking a unified, integrated management, and efficient retrieval platform, which hinders their further application.

[0004] In existing technologies, when applying Retrieval-Augmented Generation (RAG) technology to the vertical field of hazard identification, a conventional fixed-length segmentation scheme is often used. However, this approach loses key information such as standard numbers and applicable industries, resulting in a low accuracy rate for hazard identification. It cannot ensure that the accuracy of RAG hazard identification remains at a usable level, thus failing to meet the practical application needs of scenarios with high accuracy requirements for safety regulations, and has poor practicality. Alternatively, a solution using Artificial Intelligence (AI) to build a knowledge graph can be adopted; however, in scenarios where safety hazards are matched with regulations, conventional knowledge graph-generated entities do not cover core elements such as regulation numbers, regulation names, clause numbers, and clause names, easily leading to omissions of key information and summarization errors.

[0005] Therefore, overcoming the shortcomings of the existing technology is an urgent problem to be solved in this technical field. Summary of the Invention

[0006] The technical problem that this invention aims to solve is that the data preprocessing methods of existing technologies are crude, which easily leads to the omission of key information or summary errors, making the RAG hazard identification method unusable and unable to meet the practical application needs of scenarios with high accuracy requirements in safety specifications.

[0007] Firstly, a method for retrieving security standards is provided, including: Multimodal layout analysis is performed on the original specification document to identify and preserve its original hierarchical structure, and adaptive dynamic chunking is performed. Each chunk maintains the atomic semantic integrity of the security clauses to obtain a semantic block sequence. Extract the metadata tags of the semantic blocks in each semantic block sequence; The metadata tags are concatenated with the corresponding semantic blocks to construct a data tuple of the text blocks and their associated metadata tags in the semantic blocks; The vectorized data tuples are stored in a vector database for security specification retrieval based on the vectorized data tuples.

[0008] Furthermore, the method also includes: Extract the set of implicit scenario intent tags from the received user queries; Obtain the metadata tags from the data tuple; Calculate the standard effectiveness weight based on the standard enforcement level label and timeliness status label in the metadata label; The scene matching divergence is calculated based on the set of applicable scope tags of the metadata tags and the set of scene intent tags.

[0009] Furthermore, the expression for the normative effectiveness weight is: ; in, For semantic blocks, The normalization coefficient is... To standardize mandatory levels, It is in a time-sensitive state. This refers to the set of tags applicable to the metadata tags.

[0010] Furthermore, the expression for the scene matching divergence is: ; in, The set of scene intent tags, This refers to the set of labels applicable to the specified scope.

[0011] Furthermore, the method also includes: By performing multiple forward propagations with Dropout on the user query and each candidate text block using Monte Carlo Dropout, a bidirectional embedding sample set is obtained. In each sampling, the scene matching divergence is used as an exponential penalty factor to calculate the similarity subject to prior constraints. Based on prior-constrained similarity from multiple samplings, a similarity distribution is constructed; and the mean of semantic relevance and the standard deviation of semantic uncertainty are calculated.

[0012] Furthermore, the expression for the prior-constrained similarity is: ; in, For single-sample similarity, γ The divergence attenuation coefficient is... To match the divergence for the scene, The query embedding vector obtained from the j-th sampling is... Let be the text block embedding vector obtained from the j-th sampling.

[0013] Furthermore, the method also includes: Construct risk-sensitive parameters that are dynamically adjusted by the power weight of the aforementioned norm; The final Bayesian ranking score is calculated based on the mean of semantic relevance and the standard deviation of uncertainty. The text blocks are sorted in descending order according to the Bayesian ranking score, and the top-k text blocks are selected as search results.

[0014] Furthermore, the expression for the risk-sensitive parameter is: ; in, For fixed parameters, This is a risk amplification factor. The so-called normative effectiveness weight, For semantic blocks; The expression for the Bayesian ranking score is: ; in, The mean of the semantic relevance, Let be the standard deviation of the semantic uncertainty.

[0015] Secondly, a security specification retrieval device is provided, the security specification retrieval device comprising: a processor and a memory for storing processor-executable instructions; The processor is configured to execute the security specification retrieval method.

[0016] Thirdly, a non-volatile computer storage medium is provided, the computer storage medium storing computer-executable instructions, which are executed by one or more processors to perform the security specification retrieval method described in the first aspect.

[0017] Fourthly, a computer program product containing instructions is provided that, when executed on a computer or processor, causes the computer or processor to perform the security specification retrieval method as described in the first aspect.

[0018] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention identifies and preserves the original hierarchical structure of the original regulatory document through multimodal layout analysis. It parses spatial coordinates and font features such as titles, chapters, and clause numbers, mapping the original regulatory document into a structured representation carrying a chapter tree and clause hierarchy. Using semantic boundaries (such as a complete clause and its interpretation) as the segmentation unit, it completely preserves the hierarchical topology information of legal documents, avoiding clause attribution confusion caused by simple segmentation. It ensures the logical consistency within each text block, preventing the disassembly of a clause's standard number, content, or applicable conditions into different blocks, thus eliminating the loss of key information such as standard numbers and enforcement levels from the source. Metadata tags cover core dimensions such as regulatory enforcement level, validity period, and scope of application. This information is bound to text blocks and stored in a structured form by constructing data tuples, rather than being discarded during preprocessing as in existing technologies. This achieves refined feature cascading of multidimensional metadata and text blocks. It solves the problem of existing technologies' crude data preprocessing methods and lack of feature binding between the original regulatory topology and key metadata. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating a security specification retrieval method provided in an embodiment of the present invention; Figure 2 This is a flowchart illustrating a specific example of data preprocessing provided in an embodiment of the present invention; Figure 3 This is a general flowchart of a security specification retrieval method provided in an embodiment of the present invention; Figure 4 This is a flowchart illustrating the second security specification retrieval method provided in this embodiment of the invention; Figure 5 This is a flowchart illustrating the third security specification retrieval method provided in this embodiment of the invention; Figure 6 This is a schematic diagram of a process for determining search results provided by an embodiment of the present invention; Figure 7 This is a schematic diagram illustrating a specific example of the energy measurement and evaluation results of four types of models provided in this embodiment of the invention; Figure 8 This is a schematic diagram illustrating a specific example of the accuracy test results for four types of models provided in an embodiment of the present invention; Figure 9 This is a schematic diagram of a security specification retrieval device provided in an embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0022] Unless the context otherwise requires, throughout the specification and claims, the term "comprising" is interpreted as openly inclusive, meaning "including, but not limited to." In the description of the specification, terms such as "one embodiment," "some embodiments," "exemplary embodiment," "example," "specific example," or "some examples" are intended to indicate that a particular feature, structure, material, or characteristic associated with that embodiment or example is included in at least one embodiment or example of this disclosure. The illustrative representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics mentioned may be included in any suitable manner in any one or more embodiments or examples; that is, although they may be incorporated into embodiments or examples using the above terms for reasons such as order and position, it does not limit them to be incorporated in combination by a single embodiment or example.

[0023] In the description of this invention, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of embodiments of this disclosure, unless otherwise stated, "a plurality of" means two or more. Furthermore, for example, the description may use the prefix "A" or "B" to describe the same type of nouns as two independent entities. In this case, the corresponding features defined with "A" and "B" are used only to distinguish between similar entities and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features.

[0024] In describing some embodiments, the terms "coupled," "coupled," and "connected," and their derivative expressions, may be used. For example, the term "connected" may be used in describing some embodiments to indicate that two or more components have direct physical or electrical contact with each other. Similarly, the term "coupled" may be used in describing some embodiments to indicate that two or more components have direct physical or electrical contact. However, the terms "connected" or "coupled" may also refer to two or more components that do not have direct contact with each other but still cooperate or interact with each other, such as "optical coupling," "wireless connection," etc. The embodiments disclosed herein are not necessarily limited to the scope of this invention.

[0025] Furthermore, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0026] To address the challenges of applying specialized knowledge in vertical industries, Retrieval-Augmented Generation (RAG) technology has been implemented and developed into solutions across multiple fields. In coal mine safety, existing technologies construct a knowledge base of gas exceedance hazards and build an intelligent question-answering model based on RAG technology to achieve accurate responses to coal mine safety-related questions. The Baichuan2-13B model, used as the core model, demonstrates excellent performance in key indicators such as answer relevance and fidelity. In fire protection, a dynamic knowledge hub is built based on RAG technology to integrate fragmented fire protection knowledge and regulations, providing support for core scenarios such as intelligent question answering and dynamic emergency plan generation. In medical education, RAG technology is combined with a clinical medical textbook knowledge base, reducing the incidence of AI illusions through a retrieval-augmented generation mechanism and providing accurate knowledge support for medical students. In auditing, RAG technology integrates policy, regulation, and standard knowledge bases to achieve efficient analysis and querying of unstructured audit documents, enhancing the depth and breadth of audit work. The implementation schemes in the above-mentioned fields all confirm that RAG technology can adapt to the professional needs of vertical fields through knowledge base construction and retrieval enhancement mechanisms, ensure the accuracy of answers, and have good domain transferability and interactive friendliness.

[0027] However, research on applying RAG technology to vertical fields in the aforementioned fields is limited to question-and-answer systems. When applying RAG technology to the vertical field of hazard identification, the conventional fixed-length splitting scheme of existing technologies will lose key information such as standard number and applicable industry, resulting in a low accuracy rate of hazard identification. It cannot ensure that the accuracy rate of RAG hazard identification is maintained at an usable level, which makes it impossible to meet the actual application needs of scenarios with high accuracy requirements of safety specifications, and its practicality is poor.

[0028] To improve the accuracy of RAG answers, some studies have used AI to extract ternary arrays to construct knowledge graphs, achieving efficient retrieval of security knowledge, intelligent question answering, and deep association analysis.

[0029] However, current research focuses on general optimization strategies and is not adapted to the specific application scenarios. In scenarios involving security risks and standard matching, the entities generated by conventional knowledge graphs do not cover core elements such as standard number, standard name, clause number, and clause name, which can easily lead to omissions of key information and summary errors.

[0030] Existing data preprocessing techniques are crude and lack feature binding to the original topological structure and key metadata of regulations. For example, when processing safety production regulations data, existing RAG technology generally adopts conventional fixed-length or sliding window splitting schemes. This mechanical cutting destroys the original hierarchical tree structure of legal documents (e.g., the relationship between chapters and clauses), resulting in the direct loss of core dimension information such as standard number, applicable industry, enforcement level, and current validity status. Due to the lack of refined feature concatenation between multidimensional metadata and text blocks, the accuracy of subsequent hazard identification is directly low, failing to meet the core requirement of accurate hazard identification in the field of safety production.

[0031] To address the problems of existing technologies, this embodiment proposes a security specification retrieval method. In one embodiment, such as... Figure 1 As shown, it includes: Step 10: Perform multimodal layout analysis on the original specification document, identify and preserve the original hierarchical structure of the original specification document, and perform adaptive dynamic segmentation. Each segment maintains the atomic semantic integrity of the security clauses to obtain a semantic block sequence.

[0032] The security specification retrieval method of this invention includes four stages: data preprocessing, indexing, retrieval, and generation. In order to solve the problems of the prior art, this invention first provides an operation flow for the data preprocessing stage.

[0033] The original specification document is a security specification document, which can be a PDF file or a Word document file. The native hierarchical structure includes chapter heading levels and clause hierarchy.

[0034] For example, such as Figure 2 As shown, the original specification document is converted to a security specification document format standard to obtain structured data with a unified security specification format.

[0035] In one embodiment, during the data preprocessing stage, the structured data preprocessing and multidimensional metadata feature binding system in the security specification retrieval method of this embodiment first calls a multimodal document parsing engine to perform layout analysis on the original unstructured security specification document, preserving the original hierarchical structure. Those skilled in the art then select a multimodal large model based on the specific application scenario, referring to existing technologies, and process the original specification document using the multimodal large model to complete step 10.

[0036] In one embodiment, adaptive dynamic chunking is performed: prior topological rules of the canonical document are injected into the large language model through prompt word engineering, guiding the large language model to perceive semantic boundaries and calculate the optimal cutting point of the text block, and inserting a custom delimiter identifier at the optimal cutting point; wherein, the delimiter identifier is used to mark the boundary of the semantic block and maintain the atomic semantic integrity of the safety clause.

[0037] Step 20: Extract the metadata tags of the semantic blocks in each semantic block sequence.

[0038] For example, such as Figure 2 As shown, semantic segmentation and key information extraction are performed on structured data.

[0039] In one embodiment, adaptive dynamic segmentation is then performed using LLM-aware semantic boundaries, and multidimensional metadata (mi) of each semantic block (ci) is extracted simultaneously, including the level of specification enforcement (e.g., mandatory / recommended), timeliness status (e.g., current / repealed), and scope of application.

[0040] Step 30: Concatenate the metadata tags with the corresponding semantic blocks to construct a data tuple of the text blocks and their associated metadata tags in the semantic blocks.

[0041] For example, such as Figure 2 As shown, metadata tags are automatically annotated, including key information tags, semantic summary tags, and attribute description tags, resulting in a preprocessed security standard specification. The metadata is appended to the end of the text block in a structured format or stored in association with it.

[0042] In one embodiment, the metadata tags are finally concatenated with the original semantic blocks to construct an integrated data tuple Ui=(ci,mi) of "text corpus-metadata features", which serves as the basis for subsequent vector indexing and Bayesian retrieval.

[0043] Step 40: Store the vectorized data tuples in the vector database to perform security specification retrieval based on the vectorized data tuples.

[0044] This invention identifies and preserves the original hierarchical structure of the original regulatory document through multimodal layout analysis. It parses spatial coordinates and font features such as titles, chapters, and clause numbers, mapping the original regulatory document into a structured representation carrying a chapter tree and clause hierarchy. Using semantic boundaries (such as a complete clause and its interpretation) as the segmentation unit, it completely preserves the hierarchical topology information of legal documents, avoiding clause attribution confusion caused by simple segmentation. It ensures the logical consistency within each text block, preventing the disassembly of a clause's standard number, content, or applicable conditions into different blocks, thus eliminating the loss of key information such as standard numbers and enforcement levels from the source. Metadata tags cover core dimensions such as regulatory enforcement level, validity period, and scope of application. This information is bound to text blocks and stored in a structured form by constructing data tuples, rather than being discarded during preprocessing as in existing technologies. This achieves refined feature cascading of multidimensional metadata and text blocks. It solves the problem of existing technologies' crude data preprocessing methods and lack of feature binding between the original regulatory topology and key metadata.

[0045] In existing technologies, the vertical applications of RAG are generally limited to using RAG for question-answering systems. There are few methods to improve RAG accuracy, mainly relying on fine-tuning, knowledge graphs, and data preprocessing. The newly proposed LLM-RAG not only boasts higher accuracy but also significantly reduces costs compared to fine-tuning and knowledge graph solutions. To address this issue, this invention provides a structured LLM-RAG hazard identification and safety specification retrieval method based on metadata prior constraints and Bayesian uncertainty quantification. It addresses the technical problems of traditional RAG technology in safety specification retrieval scenarios, such as the loss of key information, low hazard identification accuracy, and especially the technical issues of "coexistence of old and new specifications and multiple specifications applicable to a single hazard," which can easily lead to AI generating illusions of violations. This method breaks through the limitations of simply combining "hard metadata filtering" and "soft vector retrieval" in existing technologies.

[0046] Specifically, this invention innovatively transforms standardized metadata into prior constraints of probability distributions, deeply integrating it into the underlying logic of Bayesian Monte Carlo uncertainty quantification, thereby achieving collaborative optimization of the entire process from "data preprocessing - vector indexing - joint prior retrieval - precise generation". The specific process is as follows: Figure 5 As shown. This technical solution relies on the existing low-code production-grade LLM application development platform to build an automated processing system. Each module forms a closed-loop system according to the logical relationship of "data flow - logical connection - result feedback". Its core technical features are elaborated layer by layer around the structural design, working principle and execution steps of each module. The following is a further explanation of the security specification retrieval method of this invention embodiment: like Figure 3As shown, the security specification retrieval method of this invention includes four stages: data preprocessing, indexing, retrieval, and generation.

[0047] Firstly, in the data preprocessing stage, addressing the problem of fragmented and semantically lost core structured information such as standard numbers, names, and scope of application that is easily caused by traditional fixed-length or sliding window segmentation strategies in security specification documents, this invention proposes a structured preprocessing algorithm and system architecture based on large language model semantic awareness and multi-dimensional prompt engineering. In one embodiment, this solution can rely on the Dify platform, which is based on Directed Acyclic Graph (DAG) orchestration, to achieve end-to-end data flow and fully automated processing. According to steps 10 to 40 of this invention, a low-level execution logic and specific steps are as follows: First, document structure reconstruction based on multimodal layout analysis. For example... Figure 2 As shown, firstly, for the unstructured raw security specification document Draw (covering formats such as PDF and Word), the system calls a multimodal document parsing engine (such as MinerU) to perform document layout analysis (DLA). This process maps the raw document into Markdown format text Dmd carrying the native topological hierarchy by parsing the spatial coordinates and font features in the document stream.

[0048] This transformation process can be formally represented as: Dmd = FDLA(Draw, Θparse) Here, Θparse is the set of rule parameters for the parsing engine. This step fully preserves the original hierarchy of the specification document (such as #-level headings and clause numbering trees), laying the foundation for subsequent semantic parsing based on logical structure.

[0049] Then, adaptive semantic boundary detection and dynamic chunking based on LLM contextual reasoning are implemented. Specifically, prior topological rules of the specification document are injected through dynamic prompt word templates to guide LLM in calculating the optimal cutting points of text blocks while maintaining the integrity of contextual association information, and delimiters (such as @@@) are dynamically inserted. The document is segmented into multiple highly cohesive semantic block sequences C={c1,c2,...,cn}, ensuring the atomic semantic integrity of specification clauses.

[0050] Finally, multidimensional metadata is automatically extracted and bound to high-dimensional feature vectorization (with automatic labeling). Specifically, after obtaining the independent semantic blocks (ci), the system uses LLM to perform dimensionality reduction extraction of structured multidimensional metadata for each semantic cluster.

[0051] In one embodiment, to support subsequent prior Bayesian retrieval, in addition to conventional entity tags and summary tags, the following core attribute tags that determine the effectiveness of the specification are extracted: (1) Standard Mandatory Level Label: such as mandatory national standards, recommended industry standards, etc.; (2) Time Status Label: such as current, repealed, about to be implemented, etc.; (3) Scenario Applicability Scope Label: such as applicable to specific industries, specific equipment, etc.

[0052] The extracted multidimensional features are serialized into a structured JSON-formatted metadata object Mi.

[0053] Finally, the system performs feature concatenation between the three-dimensional metadata tag Mi and the corresponding original semantic block ci, and places it at the end of the paragraph in an appendix form to construct an integrated data tuple Ui=(ci, mi) of "text corpus-metadata features".

[0054] Following step 40, during the indexing phase, the integrated data tuple Ui is transformed into a high-dimensional vector using a vector embedding model and stored in the vector database. The embedding process uses the BGE-M3-Embedding model, which can effectively capture the semantic features of technical terms and the logical relationships between clauses in security specification texts, providing high-dimensional feature support for subsequent retrieval.

[0055] This invention provides a security-compliant structured preprocessing and metadata binding scheme based on a large language model and prompt word engineering. By calling a multimodal document parsing tool, it completes the standardized conversion of the original document into a structured format while preserving the original topological hierarchy. Through prompt word engineering, it guides the large language model to perceive semantic boundaries and achieves dynamic segmentation that maintains the integrity of atomic semantics using specific delimiters. The system automatically extracts core metadata tags that determine compliance effectiveness, such as the compliance enforcement level, timeliness, and scope of application, and binds them to the corresponding paragraphs to form an integrated data tuple of "paragraph text - high-dimensional metadata features," laying a structured data foundation for the calculation of the aforementioned prior penalty parameters.

[0056] In existing technologies, there is a disconnect between the underlying logic of hard filtering of metadata and soft retrieval of vectors, which can easily lead to the illusion of AI violations due to the coexistence of old and new standards.

[0057] Specifically, current optimization methods for knowledge base retrieval often use metadata as a prerequisite for physical filtering, or rely entirely on large models for pure text vector similarity soft retrieval. In practical applications, security regulations often face the complex reality of "coexistence of old and new regulations, and multiple regulations applicable to a single vulnerability." Traditional physical hard filtering is prone to mistakenly rejecting or omitting high-value supplementary clauses; while pure vector soft retrieval cannot identify the "repealed" or "effective" status of regulations, leading to high-risk interference clauses with highly similar literal meanings but already invalid being adopted by large models, thus causing serious compliance and violation illusions.

[0058] In one embodiment, during the retrieval phase, this invention addresses the problem of traditional RAG deterministic embedding lacking confidence estimation and being prone to illusion. It uses cognitive uncertainty as the quantification object, performing forward propagation with Dropout 10 times each on the query and document blocks using Monte Carlo Dropout to obtain a bidirectional embedding sample set. The cosine similarity of each sample group is calculated to form a distribution, thereby obtaining statistical measures such as the semantic relevance mean, uncertainty standard deviation, and covariance capturing bidirectional associations. Finally, a Bayesian scoring function is used to achieve a balanced ranking of semantic relevance and retrieval reliability, ultimately selecting the optimal result.

[0059] Specifically, in one embodiment, such as Figure 4 As shown, the method further includes: Step 501: Extract the set of implicit scene intent tags from the received user query.

[0060] Step 502: Obtain the metadata tags in the data tuple.

[0061] Step 503: Calculate the standard effectiveness weight based on the standard enforcement level label and timeliness status label in the metadata label.

[0062] In the retrieval phase, to overcome the deficiency of confidence estimation in deterministic embeddings, the system first performs prior quantification mapping of metadata features. m i The prior constraint parameters are transformed into probability distributions.

[0063] First, calculate the normative power weight ( ω meta ( c i This weight directly maps the mandatory nature and timeliness of the standard to numerical characteristics. For example, the weight of current mandatory national standards approaches 1, while the weight of repealed standards approaches 0, which determines the basic importance of the clause in subsequent sampling.

[0064] In one embodiment, the expression for the normative effectiveness weight is: ; in, For semantic blocks, The normalization coefficient is... To standardize mandatory levels, It is in a time-sensitive state. This refers to the set of tags applicable to the metadata tags.

[0065] This invention provides a specific example: Hazard description: The carbon monoxide monitoring device is damaged; the carbon monoxide monitoring device on the converter platform is displaying an inaccurate value of 10 ppm and should be calibrated.

[0066] A typical example of a RAG output result is as follows: Section 7.1.1 of the "Specification for Setting Up Toxic Gas Detection Alarm Devices in the Workplace" (GBZ / T233-2009) states: "Ensure the normal operation of the toxic gas detection alarm device and keep good operation records, including whether the alarm is operating normally, maintenance date and content, etc." (Error reason: semantic matching only; the output result is a recommended standard).

[0067] A specific example of the LLM-RAG output result in this invention is as follows: According to Article 4.10 of the "Safety Regulations for Coal Gas in Industrial Enterprises" (GB6222-2005), the carbon monoxide concentration in coal gas hazard areas (such as basements, pressurization stations, hot blast stoves, and areas near various coal gas generating facilities) should be measured regularly, and carbon monoxide monitoring devices should be installed in critical locations. The maximum permissible concentration of carbon monoxide in the working environment is 30 mg / m³. (Semantic matching + standard validity weighting, correctly outputting mandatory standards).

[0068] Step 504: Calculate the scene matching divergence based on the set of applicable scope tags of the metadata tags and the set of scene intent tags.

[0069] Calculate scene matching divergence ( Δ ( m i , q meta Extracting user queries using a large model. q Implied scene intentions in q meta For example, for specific industries or specific equipment, the degree of mismatch between the data and the metadata of the scope of application of the specification is calculated by Jaccard distance.

[0070] In one embodiment, the expression for the scene matching divergence is: ; in, The set of scene intent tags, This refers to the set of labels applicable to the specified scope.

[0071] This invention provides a specific example: Hazard description: The conference room for the machinery industry is located in the floor area of ​​the hoisting and transporting span for molten iron, molten steel, and liquid slag.

[0072] Standard RAG output result: Classified as a major accident hazard. (Reason for error: Semantic matching is only performed; the criteria for classifying major accident hazards in the metallurgical industry are not applicable to the machinery industry).

[0073] LLM-RAG output: Cannot be determined as a major accident hazard. (Semantic matching + scene matching divergence, industry-limited).

[0074] Next, in order to illustrate the restricted Monte Carlo Dropout sampling (joint distribution construction) of an embodiment of the present invention, in one embodiment, as follows: Figure 5 As shown, the method further includes: Step 601: Perform multiple forward propagation with Dropout on the user query and each candidate text block using Monte Carlo Dropout to obtain a bidirectional embedding sample set.

[0075] Step 602: In each sampling, the scene matching divergence is used as an exponential penalty factor to calculate the similarity subject to prior constraints.

[0076] This invention overcomes the limitation of traditional Bayesian RAG, which relies solely on text vector distribution to construct uncertainty. It utilizes Monte Carlo Dropout to analyze the query... q With document blocks c i Each execution n =10 forward propagations with Dropout to obtain a bidirectional embedding sample set Q ={ q (1) ,…, q (10)}and C i ={ c i (1) ,…, c i (10)}. In the first j In this sampling, the system uses the pre-quantized scene matching divergence as an exponential penalty term, directly injecting it into the similarity calculation formula. In one embodiment, the expression for the prior-constrained similarity is: ; in, For single-sample similarity, γ The divergence attenuation coefficient is... To match the divergence for the scene, The query embedding vector obtained from the j-th sampling is... Let be the text block embedding vector obtained from the j-th sampling.

[0077] Therefore, this invention achieves joint sampling of semantic association and rule compliance at the algorithmic level, ensuring that even highly similar literal semantics but mismatched metadata (e.g., obsolete or non-industry-specific standards) high-risk interference clauses are sampled in a single underlying similarity test. That is, it is significantly suppressed, eliminating contextual noise at its source.

[0078] In one embodiment, this stage completely overcomes the shortcomings of traditional RAG deterministic embedding, such as lack of confidence estimation and susceptibility to illusion, and provides a metadata-driven prior-constrained Bayesian RAG retrieval method. The specific implementation steps are as follows: (1) Metadata Prior Quantization: The system reads the metadata mi of the target data tuple and dynamically calculates two prior parameters: the specification effectiveness weight ωmeta(ci) and the scene matching divergence Δ(mi,qmeta). (2) Constrained Monte Carlo Dropout Sampling (Constructing Joint Distribution): The system performs n=10 forward propagations with Dropout on both the query q and the document block ci using Monte Carlo Dropout to obtain a bidirectional embedding sample set. When calculating the cosine similarity of the j-th sample, the scene matching divergence is injected as a prior penalty term. Through the prior-constrained similarity, high-risk noise from obsolete or industry-mismatched specifications is directly suppressed at the underlying level.

[0079] Step 603: Construct a similarity distribution based on prior constraints from multiple samplings; and calculate the mean of semantic relevance and the standard deviation of semantic uncertainty.

[0080] In one embodiment, the mean semantic relevance is calculated based on the corrected distribution of 10 sets of similarity samples. μ i Standard deviation of semantic uncertainty δ i .

[0081] During the retrieval phase, this invention employs Monte Carlo Dropout to perform multiple forward propagations on queries and document blocks to obtain an embedded sample set. It introduces a scenario-matching divergence constructed from metadata attribute extraction as a low-level penalty term. In the calculation of single-sample similarity, by mathematically weighting the plain text vector similarity with this divergence penalty factor, high-risk interfering clauses with highly similar literal semantics but mismatched metadata features (e.g., obsolete or non-industry standard) are significantly suppressed in the low-level calculation of single-sample similarity, thereby eliminating contextual noise at the source of the probability distribution.

[0082] This invention breaks away from the traditional serial architecture of simply superimposing independent metadata hard filtering and vector soft retrieval in retrieval enhancement generation systems. It transforms the security specification metadata extracted in the preprocessing stage (including but not limited to specification enforcement level, timeliness status, and scope of application) into prior parameters of probability distribution, and directly injects them into the underlying operation logic of Monte Carlo Dropout's forward propagation similarity sampling and adaptive Bayesian confidence assessment. This enables the joint calculation and ranking of semantic relevance and security specification compliance effectiveness from the algorithm's underlying layer.

[0083] In existing technologies, traditional deterministic embedding lacks confidence estimation, and conventional uncertainty quantification lacks dynamic risk perception of normative effectiveness.

[0084] Specifically, traditional retrieval augmentation systems rely on deterministic embeddings without confidence estimation, treating all retrieval results as equally reliable. This poses significant risks in scenarios with high accuracy requirements, such as normative matching, where even minor inaccuracies can lead to violations. Furthermore, even advanced solutions incorporating conventional Bayesian or Monte Carlo sampling fail to incorporate the "level of mandatory compliance" (e.g., the difference between mandatory national standards and recommended industry standards) into risk assessment because their penalty parameters for uncertainty (variance) are fixed. Consequently, the system cannot apply stricter control mechanisms to "mandatory clauses" with extremely low fault tolerance.

[0085] To address this problem, this invention provides an adaptive risk-sensitive Bayesian joint scoring and ranking model, with the following specific operational steps: In one embodiment, such as Figure 6 As shown, the method further includes: Step 701: Construct risk-sensitive parameters that are dynamically adjusted by the power weight of the norm.

[0086] In the field of workplace safety, even minor inaccuracies can lead to significant violations. To address this issue, this invention provides an adaptive risk-sensitive Bayesian joint scoring method; in one embodiment, this is implemented through a sorting module within the system. Therefore, this invention reconstructs the fixed risk-sensitive parameter λ in the traditional scoring function and proposes a risk-sensitive model dynamically adjusted by the weights of normative effectiveness.

[0087] In one embodiment, adaptive risk-sensitive Bayesian scoring and ranking are performed: This invention abandons fixed risk parameters and adopts a risk-sensitive model dynamically adjusted by normative effectiveness weights. In one embodiment, the expression for the risk-sensitive parameter is: ; in, For fixed parameters, This is a risk amplification factor. The weights for the normative effectiveness mentioned above are all determined by those skilled in the art based on the specific application scenario. This is a semantic block.

[0088] Step 702: Calculate the final Bayesian ranking score based on the mean of semantic relevance and the standard deviation of uncertainty.

[0089] Finally, based on the semantic relevance mean and uncertainty standard deviation calculated in step 603, a joint Bayesian ranking score is calculated. In one embodiment, the expression for the Bayesian ranking score is: ; in, The mean of the semantic relevance, Let be the standard deviation of the semantic uncertainty.

[0090] According to the above expression, when the recall has extremely high normative validity (such as mandatory national standards), the system's deterministic requirements are also amplified sharply. Dynamically, λ will impose a more severe penalty on the standard deviation δi, which represents uncertainty.

[0091] Step 703: Sort the text blocks in descending order according to the Bayesian sorting score, and select the top-k text blocks as the search results.

[0092] In one embodiment, the final score is ordered by Bayesian order. The text blocks are sorted in descending order, and the top k (i.e., the top-k) text blocks are selected as search results. This yields the optimal results that satisfy high relevance, high compliance effectiveness, and extremely low uncertainty. The value of k is determined by those skilled in the art based on the specific use case; in one optional embodiment, k can be 3.

[0093] This invention, after statistically calculating the mean (representing semantic relevance) and standard deviation (representing uncertainty) of similarity samples, abandons the fixed risk-sensitive parameters in traditional Bayesian formulas. Instead, it constructs a risk parameter model dynamically adjusted by "normative effectiveness weights" (derived from a joint mapping of normative enforcement level and timeliness). In the final Bayesian ranking and scoring stage, this dynamically adjusted risk parameter is used to apply an adaptive penalty to the standard deviation. This mechanism allows the system to automatically apply a more severe mathematical penalty to variance fluctuations representing uncertainty when the recalled normative effectiveness is extremely high (such as mandatory national standards). This achieves a risk perception-based anti-violation recall mechanism specifically for the extremely low tolerance for error in the field of safe production.

[0094] Finally, the generation module (based on Qwen and other LLM models, with the temperature parameter set to 0.1) structurally concatenates the high-quality, highly reliable evidence text blocks, rigorously filtered by the aforementioned Bayesian joint probability, with the user query. Since the retrieval phase has eliminated logical conflicts and timeliness deviations of multi-source heterogeneous standards through mathematical mechanisms, the LLM can accurately complete autoregressive generation, greatly avoiding AI illusions caused by the absence of industry-specific standards in the pre-training corpus. The generation phase mainly involves the LLM structurally concatenating the relevant text blocks obtained from the retrieval with the user query, generating coherent text through autoregressive generation or an encoder-decoder architecture. In one embodiment, this invention uses the Qwen model as the large model, and to achieve a balance between minimizing illusions and maintaining the rigor of the generated results, the LLM's temperature parameter is set to 0.1.

[0095] This invention contrasts with traditional RAG's hard filtering of metadata. Traditional solutions rely on fixed conditional matching for hard filtering, which easily "inadvertently" rejects other industry or general standards with high-value supplementary reference value, causing the large model to become misleading due to a lack of data to rely on. This patent breaks through this rigid boundary, transforming metadata such as the scope of application into probability penalty parameters for scenario matching. The system does not directly eliminate cross-domain standards, but rather appropriately reduces their similarity score during the underlying calculation. This flexible constraint mechanism of "preserving grayscale" maximizes the recall rate of high-value clauses while ensuring compliance.

[0096] Furthermore, compared to the traditional RAG's pure vector soft search, which cannot identify whether a specification is currently in effect or obsolete due to its similarity, this invention addresses the issue by extracting the specification's validity status and enforcement level, and converting them into dynamic effectiveness weights. At the source of similarity sampling, the system directly suppresses obsolete or ineffective clauses that are extremely similar in wording, thus eliminating contextual noise at its source and completely preventing fatal violations caused by specification updates.

[0097] In addition, although the conventional Monte Carlo method can calculate uncertainty ( However, its risk penalty standards λ It is a constant that remains unchanged, treating mandatory national standards and recommended industry standards with exactly the same tolerance, thus deviating from the risk gradient of actual business operations. This invention introduces a risk-sensitive model that is dynamically adjusted by the weight of normative effectiveness. Its risk penalty standards When recalling standards with high binding force (such as mandatory national standards), the system will automatically and drastically amplify the penalty for its uncertainty, so that the method of this embodiment of the invention has legal ladder and business risk perception capabilities, thereby meeting the extremely low fault tolerance requirements in the field of safe production and is highly practical.

[0098] The following is a specific example of RAG performance evaluation of the security specification retrieval method of this invention: To quantitatively measure the RAG illusion rate, relevance, and usage cost, this RAG performance evaluation focuses on three key metrics to assess knowledge base performance, based on the core architecture of the RAG system. The accuracy of the knowledge base is also tested in engineering practice, as detailed below: (1) Faithfulness (F): Faithfulness measures the consistency between the generated answer and the retrieval context. When the answer as(q) is faithful to the context c(q), it indicates that all descriptions in the answer can be directly or indirectly inferred from the context, and there is no fictitious information. For each extracted statement si∈S(as(q)), the verification function v(si,c(q)) is used to determine whether it can be reasonably inferred from the retrieval context c(q). To ensure the objectivity and interpretability of the verification results, the formula for the faithfulness score F is as follows: ; in, To determine the number of supporting statements for LLM, This represents the total number of statements extracted.

[0099] (2) Answer Relevance (AR): This assesses the degree of fit between the generated answer and the original question, requiring the answer to directly address the core needs. Based on the generated answer as(q), n potential questions qi are generated using LLM. The original query and the generated potential questions are converted into vectors respectively, and the cosine similarity between each pair is calculated. The final score is the average of all cosine similarities. The calculation formula is as follows: ; in, The total number of potential problems generated; For the original problem With the A potential problem The cosine similarity.

[0100] (3) Context Relevance (CR). This metric assesses the information focus of the retrieved context c(q), with the core objective of quantifying the close relationship between the context and the original question. This metric directly impacts the efficiency of subsequent generation modules; a highly focused context reduces LLM processing costs and minimizes interference from irrelevant information in the reasoning. The formula is as follows: ; The following is a brief overview of the knowledge base specifications used in this assessment. This invention preprocessed a total of 498 safety-related laws, regulations, and local regulations, all samples of which were sourced from an online specification library. The library covers mandatory national standards (GB), recommended national standards (GB / T), and industry standards (AQ, XF, AQ / T, etc.), forming a comprehensive specification system encompassing major accident hazard assessment, specialized operation control, equipment and facility safety, and emergency and fire protection. It is suitable for multiple high-risk industries such as steel, petrochemicals, power, mining, construction, and hazardous chemical management. Table 1 below provides the knowledge base specifications involved in this assessment.

[0101] Table 1. Statistics on Knowledge Base Specifications

[0102] The RAG performance evaluation in this embodiment of the invention is completed by calling the RAG knowledge base in DIFY and the application programming interface (API) of Qwen in the RAGAS (v0.1.7) evaluation library on Github. The evaluation consists of 20 simple questions (e.g., which safety regulation is violated by special operations personnel who do not hold a certificate).

[0103] Test results and averages are as follows Figure 7 As shown, in terms of fidelity (F) and answer relevance (AR), the LLM model scores significantly lower than the LLM-RAG and RAG models. This is mainly because LLM has limitations in the domain of professional and normative knowledge, and some safety regulations were not included in its pre-training corpus, resulting in serious "illusions" when the model generates answers. In contrast, the RAG architecture significantly reduces the probability of fabrication by introducing an external knowledge base. In terms of context relevance (CR), all three models maintain scores of 0.9 or above, mainly because the prompt word engineering used in the testing process limits the answer template, effectively constraining the divergence of the model's answers and ensuring the focus of the generated content and a high proportion of effective information.

[0104] Table 2. Average performance evaluation of the four types of models

[0105] The average performance evaluation results are shown in Table 2 above. Overall, in the field of professional and standardized knowledge, the RAG scheme has a significant advantage over LLM alone. Further comparison of the performance of the three RAG models shows that LLM-RAG and KG-RAG in this embodiment of the invention are superior to the basic RAG model in terms of fidelity and answer relevance. This is mainly because LLM-RAG and KG-RAG in this embodiment of the invention perform metadata annotation and knowledge graph preprocessing on the standardized text, which improves the matching accuracy and recall quality of knowledge fragments during the retrieval process, making the generated answers more in line with the user's deeper query needs.

[0106] This invention also provides an application effect example: Taking the publicly available list of potential safety hazards generated by experts from the Ministry of Emergency Management providing specialized assistance and guidance to a steel company as a case study, a systematic review revealed that the list encompasses 92 safety hazards, including 81 general hazards and 11 major accident hazards (the determination of major hazards strictly adheres to the "Standards for Determining Major Accident Hazards in Industrial and Commercial Sectors"). Statistical results show that the safety hazards in the list are associated with 19 different safety regulations, as shown in Table 3 below. The list includes four core modules: hazard description, on-site photos of the hazard, the basis for hazard determination, and targeted rectification suggestions. The basis for hazard determination clearly indicates the standard name, standard number, specific clause number, and clause of the corresponding safety regulation, providing detailed and traceable empirical data support for subsequent research.

[0107] Table 3. Statistics on Standards Referenced for the Hazard List

[0108] To better fit practical application scenarios, this study input 92 hazard descriptions into three types of models. Based on the hazard assessment criteria determined by experts, the accuracy rate was compared from four core information dimensions: standard name, standard number, clause number, and clause content. Typical examples of errors are shown in Table 4 below.

[0109] Table 4. Typical Error Examples in the Model

[0110] The typical output errors of the above three types of models can be summarized into the following three core causes: 1) Retrieval omissions: Due to factors such as missing metadata annotations and the target specification not being included in the knowledge base, the key clause text blocks of matching potential problems did not enter the Top-k (k=3 in this paper) candidate set after sorting, and the core basis could not be called in the subsequent generation stage; 2) Contextual noise: There are cases where old and new specifications coexist in the knowledge base, and the same potential problem corresponds to multiple specifications. Due to the lack of hierarchical priority filtering logic, outdated specifications or non-mandatory specifications are recalled, interfering with the accuracy of the generated results; 3) Limitations of LLM comprehensive capabilities: The retrieval stage has successfully obtained effective information, but the model has shortcomings in structured information parsing, logical integration of multi-source heterogeneous specifications, and accurate adaptation of professional domain expression paradigms, which ultimately leads to deviations between the generated content and the original specification text.

[0111] like Figure 8 The results show the accuracy test results of four types of models. The accuracy of the case studies is consistent with the test results. In terms of overall accuracy, the LLM-RAG model of this invention is approximately equal to the KG-RAG model, which is greater than the RAG model, which is greater than the LLM model. However, there are two key differences between the results in the case study scenarios and the test results: 1) The accuracy of hazard identification is slightly lower than the fidelity (F) index. The core reason for this phenomenon is that although the LLM-RAG model significantly suppresses the generation of "illusions" through the retrieval enhancement mechanism, the case studies face complex real-world constraints, such as a single hazard potentially corresponding to multiple safety specifications or the coexistence of old and new versions of specifications in the database. This can easily lead to model derivation bias, ultimately resulting in a decline in accuracy; 2) The RAG, LLM, and KG-RAG models have higher accuracy in matching specification names and specification numbers than in matching clause numbers and clause content, while the four indicators of the LLM-RAG model show strong consistency. The three models need to recall multiple discrete text segments containing four types of information, and further complete the summarization, integration, and generation of multi-source information. This process is prone to information fragmentation or fusion bias, leading to a significant decrease in the accuracy of matching clause numbers with clause content. In contrast, the LLM-RAG model utilizes metadata annotation technology to achieve precise binding between information tags and text segments. During task execution, it only needs to recall a single related text segment, effectively avoiding the bias problem in multi-source information integration.

[0112] Table 5. Cost Comparison of KG-RAG and LLM-RAG

[0113] As shown in Table 5 above, a further cost comparison analysis is conducted between KG-RAG and the LLM-RAG model in this embodiment of the invention. The token consumption of the KG-RAG model during the knowledge base construction phase is 4.7 times that of the LLM-RAG model, and the average token consumption per question is 8.6 times that of the LLM-RAG model. This is mainly due to: 1) KG-RAG heavily relies on LLM to extract entities and relations during the knowledge base construction phase, requiring semantic parsing and structuring of massive amounts of raw data through LLM; 2) During the retrieval phase, it still needs to continuously call LLM to complete core operations such as query entity extraction, node decision-making for multi-hop traversal of the knowledge graph, and filtering of irrelevant triples. Given that there is no multi-hop reasoning requirement in this application scenario, the full-process LLM calling mechanism designed by KG-RAG for adapting to complex graph reasoning cannot leverage its technical advantages. In contrast, LLM-RAG completes retrieval only through single-round vector similarity matching, without additional LLM calls, resulting in significantly reduced token consumption and stronger scenario adaptability.

[0114] The foregoing embodiments provided a security specification retrieval method. In this embodiment, another security specification retrieval device will be proposed, which includes a processor and a memory for storing processor-executable instructions; wherein the processor is configured to execute the security specification retrieval method described in the foregoing embodiments.

[0115] like Figure 9 As shown, the security specification retrieval device includes a processor 21 and a memory 22, wherein the processor 21 and the memory 22 can be connected by a bus or other means.

[0116] Processor 21 can be a CPU. Processor 21 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.

[0117] The memory 22, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the security specification retrieval method in the aforementioned embodiments. The processor executes various functional applications and training processes by running the non-transitory software programs, instructions, and modules stored in the memory.

[0118] The memory 22 may include a program storage area and a training storage area. The program storage area may store the operating system and applications required for at least one function; the training storage area may store training data created by the processor. Furthermore, the memory may include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, the memory 22 may optionally include memory remotely located relative to the processor, which can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. The one or more modules stored in the memory 22, when executed by the processor 21, perform the security specification retrieval method as shown in the embodiments of this invention. Specific details of the security specification retrieval method can be understood by referring to the corresponding descriptions and effects in the embodiments of this invention, and will not be repeated here.

[0119] This embodiment also provides a computer storage medium storing a computer program that can be executed by a processor to perform the security specification retrieval method described in the foregoing embodiments.

[0120] The computer storage medium stores computer-executable instructions, which can execute the security specification retrieval method in any of the above method embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.

[0121] The specific steps of the security specification retrieval method are described in the foregoing embodiments and will not be repeated in this embodiment.

[0122] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for retrieving security specifications, characterized in that, include: Multimodal layout analysis is performed on the original specification document to identify and preserve its original hierarchical structure, and adaptive dynamic chunking is performed. Each chunk maintains the atomic semantic integrity of the security clauses to obtain a semantic block sequence. Extract the metadata tags of the semantic blocks in each semantic block sequence; The metadata tags are concatenated with the corresponding semantic blocks to construct a data tuple of the text blocks and their associated metadata tags in the semantic blocks; The vectorized data tuples are stored in a vector database for security specification retrieval based on the vectorized data tuples.

2. The security specification retrieval method according to claim 1, characterized in that, The method further includes: Extract the set of implicit scenario intent tags from the received user queries; Obtain the metadata tags from the data tuple; Calculate the standard effectiveness weight based on the standard enforcement level label and timeliness status label in the metadata label; The scene matching divergence is calculated based on the set of applicable scope tags of the metadata tags and the set of scene intent tags.

3. The security specification retrieval method according to claim 2, characterized in that, The expression for the normative power weight is: ; in, For semantic blocks, The normalization coefficient is... To standardize mandatory levels, It is in a time-sensitive state. This refers to the set of tags applicable to the metadata tags.

4. The security specification retrieval method according to claim 2, characterized in that, The expression for the scene matching divergence is: ; in, The set of scene intent tags, This refers to the set of labels applicable to the specified scope.

5. The security specification retrieval method according to claim 2, characterized in that, The method further includes: By performing multiple forward propagations with Dropout on the user query and each candidate text block using Monte Carlo Dropout, a bidirectional embedding sample set is obtained. In each sampling, the scene matching divergence is used as an exponential penalty factor to calculate the similarity subject to prior constraints. Based on prior-constrained similarity from multiple samplings, a similarity distribution is constructed; and the mean of semantic relevance and the standard deviation of semantic uncertainty are calculated.

6. The security specification retrieval method according to claim 5, characterized in that, The expression for the prior-constrained similarity is: ; in, For single-sample similarity, γ The divergence attenuation coefficient is... To match the divergence for the scene, The query embedding vector obtained from the j-th sampling is... Let be the text block embedding vector obtained from the j-th sampling.

7. The security specification retrieval method according to claim 5, characterized in that, The method further includes: Construct risk-sensitive parameters that are dynamically adjusted by the power weight of the aforementioned norm; The final Bayesian ranking score is calculated based on the mean of semantic relevance and the standard deviation of uncertainty. The text blocks are sorted in descending order according to the Bayesian ranking score, and the top-k text blocks are selected as search results.

8. The security specification retrieval method according to claim 7, characterized in that, The expression for the risk-sensitive parameter is: ; in, For fixed parameters, This is a risk amplification factor. The so-called normative effectiveness weight, For semantic blocks; The expression for the Bayesian ranking score is: ; in, The mean of the semantic relevance, Let be the standard deviation of the semantic uncertainty.

9. A security specification retrieval device, characterized in that, The security specification retrieval device includes: a processor and a memory for storing processor-executable instructions; The processor is configured to execute the security specification retrieval method according to any one of claims 1 to 8.

10. A non-volatile computer storage medium, characterized in that, The computer storage medium stores computer-executable instructions, which are executed by one or more processors to perform the security specification retrieval method according to any one of claims 1 to 8.