Village and town residential structure safety evaluation system based on large language model and map retrieval enhanced generation
By using large language models and graph retrieval to enhance generation, a knowledge base and relation graph are constructed, which solves the problems of low efficiency and insufficient interaction in the existing technology for structural safety assessment of rural and urban residential buildings. This enables efficient and reliable intelligent assessment and accurate acquisition of regulatory clauses, thereby improving the reliability of the assessment and the user interaction experience.
Patent Information
- Application Number
- CN202511954883.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-23
- Publication Date
- 2026-01-30
AI Technical Summary
In the process of assessing the structural safety of rural residential buildings, existing technologies rely on manual review of regulations, which is cumbersome and inefficient, and it is difficult to achieve efficient and reliable intelligent assessment. In particular, there are shortcomings in cross-clause knowledge retrieval with multiple relationships and in interaction with non-professional users.
We employ a method that combines a large language model with graph retrieval to enhance generation, constructing a knowledge base and relation graph module. Through semantic vector and sparse feature retrieval, combined with multi-hop relation expansion, we achieve accurate acquisition of normative clauses, and provide conversational interaction support through an interactive management module.
It improves the reliability and accuracy of structural safety assessments for rural and urban residential buildings, enables precise recall of regulatory clauses and cross-clause reasoning, and enhances the interactive experience and assessment process management capabilities for non-professional users.
Smart Images

Figure CN121434367A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of civil engineering and artificial intelligence, and more specifically, relates to a rural residential structure safety assessment system based on large language models and graph retrieval enhancement generation. Background Technology
[0002] The structural safety of rural and urban residential buildings is directly related to the safety of people's lives and property. As a crucial link in ensuring residential safety, structural safety assessments of rural and urban residential buildings typically rely on professionals manually reviewing and interpreting fragmented regulatory clauses. This process is cumbersome, inefficient, and easily influenced by subjective experience. Therefore, how to achieve efficient analysis and intelligent application of rural and urban residential building structural safety regulations has become an urgent technical problem to be solved.
[0003] In recent years, artificial intelligence technology has made rapid progress in the fields of natural language processing and knowledge retrieval. Large Language Models (LLMs) possess strong natural language understanding and generation capabilities, supporting intelligent question answering and text reasoning; Graph Retrieval Augmented Generation (GraphRAG) methods combine relational graphs and retrieval mechanisms to achieve structured management and reasoning of complex knowledge. However, when directly applied to the scenario of structural safety assessment of rural and urban residential buildings, existing methods still have certain limitations: on the one hand, large language models lack precise constraints on building codes, especially those related to rural and urban residential buildings, which may generate content that does not meet the requirements of the codes, resulting in insufficient reliability of the assessment results; on the other hand, traditional retrieval methods are difficult to handle cross-clause knowledge retrieval needs based on multi-hop relationships, resulting in incomplete retrieval results; in addition, existing systems generally remain at the simple question-and-answer level at the interaction level, lacking the ability to manage the assessment process and engage in conversational follow-up questions, making it difficult to meet the systematic and low-threshold interactive support needs of non-professional users.
[0004] Therefore, there is an urgent need for a rural residential structure safety assessment system to provide efficient and reliable technical support for the analysis of rural residential structure safety standards, knowledge retrieval, and intelligent assessment. Summary of the Invention
[0005] In view of the above-mentioned defects or improvement needs of the existing technology, the present invention provides a rural residential structure safety assessment system based on large language model and graph retrieval enhancement, the purpose of which is to improve the reliability and accuracy of rural residential structure safety assessment.
[0006] To achieve the above objectives, this invention proposes a rural residential structure safety assessment system based on large language models and graph retrieval enhancement, comprising: The knowledge base and relation graph module includes a knowledge base and a relation graph. The building safety assessment code clauses are converted into semantic vectors to form a knowledge base, and then an undirected relation graph is constructed with clauses as nodes and relationships as edges. The interaction management module is used to manage user interactions and schedule the main security assessment technology module based on user input; The security assessment technology main module is used to parse and process user input, call the knowledge retrieval module to perform retrieval based on the parsed user input, and encapsulate the retrieval results; The knowledge retrieval module is used to perform retrieval in the knowledge base and relationship graph modules. Specifically, it first performs a retrieval in the knowledge base to obtain the matching terms, and then performs an extended retrieval in the relationship graph based on the matching terms to obtain the final retrieval results. The large language model service module provides large language model support for the security assessment technology mainline module and the interaction management module.
[0007] As a further preferred embodiment, the construction of the knowledge base includes: A professional text embedding model is used to convert the clause text into a high-dimensional dense semantic vector; a sparse representation algorithm based on word frequency features is used to convert the clause text into a sparse matrix, and a backoff mechanism is set up so that when the professional text embedding model is unavailable, a dimensionality reduction algorithm is used to perform dimensionality reduction on the sparse matrix to generate an alternative semantic vector.
[0008] As a further preferred option, the professional text embedding model is obtained by performing domain-adaptive fine-tuning on the basic model ritrieve_zh_v1. Specifically, the fine-tuning involves filling unused vocabulary slots in the model with commonly used numerical unit symbols in the field of building safety, and adding normative terms in the field of building safety as new vocabulary to the model's vocabulary.
[0009] As a further preferred embodiment, the knowledge retrieval module includes: Multi-channel retrieval and fusion unit: used to perform parallel retrieval of different strategies in the knowledge base, and to uniformly sort the retrieval results of different strategies through a fusion ranking algorithm to obtain the hit terms; Multi-hop relation extension unit: Used to take the hit terms as seed nodes, start from the seed nodes in the relation graph, use a search algorithm to obtain related nodes within a specified number of hops, and optimize the search results through appending or weighting strategies.
[0010] As a further preferred embodiment, the retrieval strategy in the multi-channel retrieval and fusion unit includes semantic vector retrieval based on cosine similarity and sparse feature retrieval based on word frequency features; then, the semantic vector retrieval results and sparse feature retrieval results are uniformly sorted by the reverse order fusion algorithm RRF or the Z-score normalized weighted fusion algorithm.
[0011] As a further preferred embodiment, in the multi-hop relationship extension unit, the search algorithm adopts a breadth-first search algorithm to obtain the associated nodes, i.e., the extension terms; the append strategy refers to appending the extension terms as independent results to the search results without changing the order of the hit terms; the weighted strategy refers to weighting and integrating the relationship score of the extension terms with the score of its original search results, and sorting them together with the hit terms.
[0012] As a further preferred embodiment, the security assessment technology mainline module includes: User input triage unit: used to perform intent recognition and triage of user input, determine whether the user input belongs to the evaluation branch or the chatter branch. When it belongs to the chatter branch, the interaction is directly realized through the large language model. When it belongs to the evaluation branch, it is transferred to the user input structured expression unit. User-input structured representation unit: used to convert natural language input by users into structured information; The retrieval triggering and retrieval result encapsulation unit is used to combine structured information and historical information to form a retrieval request, then call the knowledge retrieval module to perform the retrieval, and trigger a relaxation strategy when the retrieval results are insufficient, and encapsulate and output the final retrieval results to the retrieval result rule expression unit; Search Result Rule Representation Unit: Used to convert the final search results into rule-based result representations, including extracting conditions and requirements from the retrieved terms to generate rule skeletons, and, if necessary, calling a large language model to fill in the rule skeletons to obtain rule-based result representations; Information Comparison and Security Assessment Unit: This unit compares the structured information input by the user with the rule-based result expression item by item to determine whether the user input information is sufficient. When the information is deemed sufficient, a security assessment conclusion is output; otherwise, the user is guided to provide the missing information through the interactive management module, and the user input is parsed, processed, and retrieved again.
[0013] As a further preferred embodiment, the user input triage unit performs intent recognition and triage on the user input, including: extracting and matching key fields, symbols, etc. in the user input based on a predefined set of regular expressions to obtain regular expression matching results; calling a large language model to perform semantic judgment on the natural language statements input by the user to identify whether they belong to evaluation-related content; and fusing the regular expression matching results and the semantic judgment results of the large language model according to preset weights to determine whether the user input belongs to the evaluation branch or the casual conversation branch.
[0014] As a further preferred embodiment, the user input structured representation unit employs a dual-channel key-value extraction strategy. Specifically, regular expression extraction is performed first, using a predefined key-value table and alias dictionary to extract corresponding fields from the user input through rule matching. If the regular expression extraction does not cover the missing fields, a large language model is invoked to generate the complete content for the missing fields. Finally, the extracted or completed results are compared and constrained with the key-value table to ensure that the output structured information meets expectations.
[0015] As a further preferred embodiment, the interaction management module includes: Session State Management Unit: Used to maintain the running state of the evaluation session, including storing user input, system response and evaluation state information, and maintaining session continuity after entering the evaluation branch; Follow-up question generation unit: used to generate and issue follow-up questions when insufficient user input is detected, to guide the user to provide missing information, and to trigger fallback processing when the user clearly cannot provide more information, returning evidence-based suggestive prompts; Process scheduling unit: used to schedule each unit of the security assessment technology main line module to perform assessment tasks according to a preset process, including calling the follow-up question generation unit to issue supplementary questions when the information received from the information comparison and the information output by the security assessment unit is insufficient, and restarting the security assessment technology main line module after the user provides missing information input, and continuing to execute the assessment process from the user input structured expression unit. Results Display Unit: Used to call the large language model to convert the security assessment conclusions or suggestions into natural language reports, present them to users in a readable form, and provide assessment report output.
[0016] In summary, compared with the prior art, the above-described technical solutions conceived by this invention mainly possess the following technical advantages: 1. This invention combines a large language model with graph retrieval enhancement based on building safety assessment standard clauses. It can fully utilize knowledge retrieval and graph reasoning to accurately obtain relevant standard clauses for rural and urban housing, and improve semantic parsing and interactive experience through the large language model, taking into account both automated processing and interpretability. Thus, it provides efficient and reliable technical support for the analysis, knowledge retrieval and intelligent assessment of rural and urban housing structural safety standards.
[0017] 2. Enhance the comprehensiveness and accuracy of retrieval: By integrating semantic vector retrieval and sparse feature retrieval, as well as expanding retrieval based on relation graphs, we can achieve accurate recall of normative clauses and multi-hop reasoning across clauses; when the results are insufficient, we adopt a relaxation strategy to gradually expand the retrieval scope to ensure that the retrieval results are fully covered.
[0018] 3. Significantly improve the reliability of evaluation conclusions: By combining rule-based regular expression matching with semantic judgment of large language models, a weighted voting mechanism is formed to ensure the accuracy of input intent recognition; at the same time, the introduction of rule-based expression and rule auditing mechanism in the security assessment stage effectively reduces the risk of large language models generating erroneous or inconsistent conclusions.
[0019] 4. Improve interaction and process management capabilities: Through session state management and process scheduling mechanisms, the system can continuously track user input and intermediate results, dynamically trigger follow-up questions or fallback processing, and realize conversational interaction for evaluation tasks, rather than being limited to simple question and answer. Attached Figure Description
[0020] Figure 1 This is an architecture diagram of a village and town residential structure safety assessment system generated based on a large language model and graph retrieval enhancement according to an embodiment of the present invention; Figure 2 This is a flowchart illustrating the workflow of the village and town residential structure safety assessment system according to 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. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0022] This invention provides a rural residential structure safety assessment system based on large language models and graph retrieval enhancement, such as... Figure 1 As shown, it includes a knowledge base and relationship graph module, a knowledge retrieval module, a security assessment technology mainline module, an interaction management module, and a large language model service module, among which: (1) Knowledge base and relation graph module: used to construct a multimodal vector expression knowledge base and relation graph based on the current building safety assessment standard clauses, including multimodal text vectorization unit and clause relation graph unit.
[0023] Multimodal text vectorization unit: used to convert the text of building safety assessment specification clauses into a computable vector representation, including using a professional text embedding model to convert the clause text into a high-dimensional dense semantic vector, using a sparse representation algorithm based on word frequency features to convert the clause text into a sparse matrix, and setting a backoff mechanism to use a dimensionality reduction algorithm to perform dimensionality reduction on the sparse matrix to generate alternative semantic vectors when the professional text embedding model is unavailable. Clause Relationship Graph Unit: Used to generate a clause relationship graph based on explicit and implicit relationships in the normative clauses, and supports multi-hop relationship expansion retrieval, including parsing the "related regulations" field to establish explicit associations, inferring implicit relationships based on the clause number hierarchy, and constructing an undirected relationship graph with clauses as nodes and association relationships as edges.
[0024] Furthermore, the specialized text embedding model is specifically obtained by performing domain-adaptive fine-tuning on the basic model ritrieve_zh_v1, which has stronger semantic representation capabilities in the field of building safety. The fine-tuning process includes: filling unused vocabulary slots in the model with commonly used numerical unit symbols in the field of building safety, and adding normative terms in the field of building safety as new words to the model's vocabulary.
[0025] The sparse representation algorithm based on word frequency features specifically adopts the word frequency-inverse document frequency (TF-IDF) algorithm to generate sparse matrix representations; the dimensionality reduction algorithm adopts the singular value decomposition (SVD) algorithm to perform dimensionality reduction on the sparse matrix to generate alternative semantic vectors when the embedding model is unavailable, so as to ensure that the system has a fallback mechanism.
[0026] Furthermore, the knowledge base and relationship graph support independent updates and evolution, and the core evaluation logic of the system is decoupled from the underlying knowledge data, which facilitates the addition, deletion or revision of standard clauses and ensures the scalability, maintainability and long-term applicability of the system.
[0027] (2) Knowledge retrieval module: used for multi-channel hybrid retrieval and multi-hop retrieval in knowledge base and relation graph, including multi-channel retrieval and fusion unit and multi-hop relation expansion unit.
[0028] Multi-channel retrieval and fusion unit: used to execute retrieval results of different strategies in parallel and fuse the results, including semantic vector retrieval and sparse feature retrieval. It also uses a fusion ranking algorithm to uniformly rank the retrieval results of different retrieval channels and take the top-ranked results to determine the hit terms.
[0029] Multi-hop relation extension unit: used for extended retrieval based on the clause relation graph, including using the hit clause as the seed node, starting from the seed node and using a search algorithm to specify the associated nodes (neighbor clauses) within the specified number of hops, and optimizing the retrieval results through an appending strategy or a weighting strategy.
[0030] Furthermore, the fusion ranking algorithm is specifically the reverse order fusion algorithm (RRF) or the Z-score normalized weighted fusion algorithm, which is used to uniformly rank the semantic vector retrieval results and the sparse feature retrieval results; the search algorithm specifically adopts the breadth-first search algorithm (BFS), which is used to obtain neighbor terms within a specified number of hops starting from the hit terms, and optimize the retrieval results through appending strategies or weighting strategies.
[0031] The append strategy adds extended terms as independent results to the search results set without changing the order of the hit terms; the weighted strategy combines the relationship scores of the extended terms with their original search scores and includes them in a unified order along with the hit terms.
[0032] (3) Safety assessment technology main module: used to parse, encapsulate and express user input and retrieval results, and give building safety assessment results based on standards, including user input diversion unit, user input structured expression unit, retrieval trigger and retrieval result encapsulation unit, retrieval result rule-based expression unit, information comparison and safety assessment unit.
[0033] User input triage unit: used to perform intent recognition and triage on received user input, including a weighted voting mechanism based on regular expression matching and semantic judgment of large language model, to determine whether the user input belongs to the evaluation branch or the chat branch; User input structured representation unit: used to convert natural language input into structured key-value pair information. It adopts a dual-channel key-value extraction strategy, including a regular expression extraction channel based on a predefined key-value table and alias dictionary, and a large language model completion channel called when the regular expression extraction does not cover the information. Finally, after legality verification, it outputs structured information. The retrieval triggering and retrieval result encapsulation unit is used to generate retrieval requests based on user input, trigger knowledge retrieval, and encapsulate retrieval results. This includes combining structured information and historical input information to form a retrieval request, calling the knowledge retrieval module to obtain candidate terms (including hit terms and their neighboring terms), triggering a relaxation strategy when the results are insufficient, and finally encapsulating and outputting the candidate terms and related information for subsequent rule-based expression. The retrieval result rule-based expression unit is used to convert the retrieved clause text into a rule-based expression form, including extracting conditions and requirements from the clauses to generate a rule skeleton, calling a large language model to fill in the skeleton when necessary, and ensuring the completeness and consistency of the rule expression through a rule auditing mechanism. Information Comparison and Security Assessment Unit: This unit compares the structured information input by the user with the rule-based expression of the search results item by item and provides a security assessment conclusion. This includes determining whether the user input information is sufficient. When the information is deemed "sufficient", the unit outputs a security assessment conclusion. When the information is deemed "insufficient", the unit triggers a follow-up question generation unit to guide the user to provide the missing information.
[0034] Furthermore, the regular expression matching specifically involves extracting and matching key fields and symbols from the user input based on a predefined set of regular expressions to achieve a fast and deterministic preliminary judgment, resulting in a regular expression matching result. The large language model semantic judgment specifically involves calling a large language model to perform semantic understanding and classification of the natural language sentences input by the user to identify whether they belong to the evaluation-related content. The weighted voting mechanism specifically involves fusing the regular expression matching result and the large language model semantic judgment result according to preset weights, prioritizing the regular expression matching result with a higher weight and the large language model semantic judgment result with a lower weight, and using the fused output to determine the user input routing conclusion.
[0035] The regular expression extraction channel specifically extracts corresponding fields from user input through rule matching using a predefined key-value table and alias dictionary. The large language model completion channel specifically calls the large language model to generate complete content for missing fields when the regular expression extraction does not cover them. The validity verification specifically compares and checks the results obtained from extraction or completion with the key-value table to ensure that the output structured information meets expectations.
[0036] The relaxation strategy specifically involves gradually relaxing search criteria to expand the search scope when initial search results are insufficient, thereby increasing the number of candidate terms. Priority is given to relaxing regional and other limiting conditions to broaden the matching area; if results are still insufficient, other filtering conditions are further reduced or removed to maximize the number of candidate terms. After relaxation, the recalled results are deduplicated and merged, serving as new candidate criteria for subsequent rule-based processing. The output encapsulation specifically involves encapsulating the hit terms, their neighboring terms, and their metadata (including confidence level, source, and search path) into unified structured data for use in subsequent rule-based expression.
[0037] The rule skeleton is a structured representation framework consisting of condition and requirement sections, used to carry the logical content of the normative clauses. The rule auditing mechanism specifically involves checking the logical consistency, completeness, and accuracy of the generated rule expressions, and performing corrections when defects are found.
[0038] (4) Interaction management module, used to manage user interaction process, drive the complete evaluation session cycle, and schedule the security evaluation technology main line module to advance the system process, including session state management unit, follow-up question generation unit, process scheduling unit, and result display unit; Session State Management Unit: Used to maintain the running state of the evaluation session, including storing user input, system response and evaluation state information, and maintaining session continuity after entering the evaluation branch; Follow-up question generation unit: It is used to generate and issue follow-up questions when incomplete user input information is detected, so as to guide the user to supplement the necessary information, and trigger fallback processing when the user clearly cannot provide more supplementary information, returning evidence-based suggestions to ensure that the evaluation process can still output conclusions even when information is insufficient; Process scheduling unit: Used to schedule each unit of the security assessment technology mainline module to perform assessment tasks according to a preset process, including calling the follow-up question generation unit to issue supplementary questions when the information comparison and security assessment unit outputs the "insufficient information" conclusion, and restarting the security assessment technology mainline module after the user inputs supplementary information, continuing to execute the assessment process from the user input structured expression unit, that is, the session information is updated and flows back to the user input structured expression unit, and the system re-triggers the retrieval and judgment process based on the updated information until sufficient information is obtained or the user clearly states that no further supplementation is possible.
[0039] Results Display Unit: This unit presents the security assessment conclusions or recommendations and related evidence to the user in a readable format, and provides an assessment report output.
[0040] (5) Large Language Model Service Module: It is used to provide large language model support in user input parsing and intent determination, user input completion and correction, retrieval result rule filling and correction, and evaluation result report generation. It includes user input parsing and intent determination unit, user input completion and correction unit, retrieval result rule filling and correction unit, and evaluation result report generation unit.
[0041] User Input Parsing and Intent Determination Unit: Assists in user input triage, used to perform semantic parsing and intent determination of user input based on a large language model; User input completion and correction unit: Assists in the structured expression of user input, used to call the large language model for completion and correction when the structured expression of user input is missing or incomplete; Search Result Rule Filling and Correction Unit: This unit assists in the regularization of search results, and is used to call the large language model to fill and correct the rule skeleton of the search results in order to generate a complete regularized expression. Assessment Result Report Generation Unit: An auxiliary result display unit, used to call a large language model to convert the security assessment conclusions into a natural language report, thereby improving the understandability and usability of the results.
[0042] like Figure 2 As shown, the engineering process of the above-mentioned rural residential structure safety assessment system based on large language models and graph retrieval enhancement includes: S1: User input Users can input descriptions of building safety-related issues or potential hazards using natural language.
[0043] S2: User input routing The user input triage unit performs intent recognition and triage on the input information. Through a weighted voting mechanism of regular expression matching and semantic judgment of the large language model, it determines whether the input belongs to the evaluation branch or the chat branch. If the process is determined to be a casual conversation branch, the workflow enters casual conversation mode. If the process is determined to be an evaluation branch, the process proceeds to step S3.
[0044] S3: Structured Representation of User Input The user-input structured representation unit parses the input natural language, uses a dual-channel key-value extraction strategy to convert the input into structured key-value pairs, and calls a large language model to complete missing fields when necessary. After validity verification, it outputs structured information.
[0045] S4: Retrieval Triggering and Execution The retrieval triggering and retrieval result encapsulation unit generates a retrieval request based on structured information and historical input, and calls the knowledge retrieval module to perform multi-channel retrieval and multi-hop relationship expansion to obtain candidate terms. If the retrieval results are insufficient, the system triggers a relaxation strategy to gradually relax the retrieval conditions to expand the retrieval scope and increase the number of candidate terms.
[0046] S5: Encapsulation of Search Results The search trigger and search result encapsulation unit encapsulates the hit clauses and their associated clauses along with contextual information, generating a unified data structure for subsequent use.
[0047] S6: Regularized Expression of Search Results The retrieval result rule expression unit transforms candidate clauses into rule expressions, extracts conditions and requirements to form a rule skeleton, and calls a large language model to fill and correct them when necessary. Finally, the rule auditing mechanism outputs a consistent and complete rule expression.
[0048] S7: Information Comparison and Security Assessment The information comparison and security assessment unit compares the structured user input with the rule-based terms item by item to determine whether the user input information is sufficient. If the information is deemed "sufficient", a security assessment conclusion is output based on the comparison results, and the process proceeds to step S8. If the system determines that "information is insufficient", the process proceeds to step S9.
[0049] S8: Results Display The results display unit presents the security assessment results and their basis in a readable format, and generates a natural language assessment report through a large language model when sufficient information is available, thus completing the assessment process.
[0050] S9: Follow-up questions or fallback solutions The process scheduling unit invokes the follow-up question generation unit to generate supplementary questions, guiding the user to provide missing information: If the user provides supplementary information, the process proceeds to S3; If the user clearly cannot provide the missing information, a fallback mechanism will be triggered.
[0051] The following are specific examples: I. Knowledge Base and Relationship Graph Module The knowledge base and relationship graph module serves as the system's underlying data support and core knowledge organization. Its main function is to convert unstructured building safety code clauses into machine-understandable and efficiently searchable multimodal vector representations, and to construct a semantic and logical relationship network between the clauses. This module achieves deep structured and semantic storage and dynamic, scalable management of code clauses by integrating dense semantic vectors, sparse matrices, and relationship graphs, providing a complete data foundation for upper-level intelligent retrieval and reasoning.
[0052] 1. Implementation of multimodal text vectorization unit: ①Text processing: Read the clause text from the standard database in Excel format, and perform text cleaning and standardization, such as removing redundant spaces, standardizing punctuation, and extracting applicable scope labels.
[0053] ② Generate and save high-dimensional dense semantic vectors: Use the fine-tuned professional text embedding model ritrieve_zh_v2 to generate high-dimensional dense semantic vectors (1792 dimensions) to capture the deep semantic information of the terms and save them as embeddings.npy (a standard NumPy array file that stores the normalized dense semantic vectors of all terms for use in semantic vector retrieval).
[0054] ③ Generate and save the TF-IDF sparse matrix: The TF-IDF algorithm (character level 2~4 gram) is used to generate a sparse matrix, preserving the accurate matching ability of key terms. The matrix is saved as tfidf_docs.npz (SciPy sparse matrix file, storing the TF-IDF feature vectors of all documents for sparse retrieval) and tfidf.pkl (serialized scikit-learnTfidfVectorizer object, containing vocabulary and feature extraction parameters, used for vectorization transformation of subsequent queries).
[0055] ④ Fallback mechanism: When the professional text embedding model is unavailable (e.g., the relevant library is not installed in the environment, or the embedding model is not downloaded to the local machine), the system automatically performs SVD dimensionality reduction on the TF-IDF matrix (the dimension after dimensionality reduction is between 16 and 512) to generate alternative semantic vectors, ensuring that the system can provide computable semantic feature representations in any environment.
[0056] 2. Implementation of the clause relationship diagram unit: The clause relationship graph unit constructs an undirected relationship graph by analyzing the hierarchical structure of the "Related Clauses" column and clause numbers in Excel. Specifically: ① Extract explicit relationships from the “Related Regulations” column: Use regular expressions (such as r“[;;,,、 / \\s]+”) to split multiple related clauses, and generate a unique node identifier UID (such as “GB50011-2010::5.5.2”) through the make_uid function.
[0057] ② Inferring implicit parent-child relationships based on clause numbers: By parsing the period or Chinese period (such as “.”, “.”) in the clause number, hierarchical segmentation is performed, and parent clause edges are automatically added (such as “5.5.1”’s parent nodes are “5.5” and “5”).
[0058] ③ All edge relationships are stored using an adjacency list (a Python dictionary type), with the key being the node's UID and the value being the set of adjacent nodes. Finally, the edge list is saved as relations.json (a JSON file that stores a list of all undirected edges, with each edge represented as a pair of index numbers between two nodes, supporting neighbor queries and relationship reasoning in subsequent multi-hop searches).
[0059] ④ Save the mapping files: Output id_map.json (a JSON mapping file that records the metadata of each clause corresponding to each vector index, including UID, original text, specification number and clause number) and texts.json (a JSON Lines format file that stores the UID and complete text content of a clause in each line, facilitating quick search and debugging), which together constitute a complete knowledge base index system.
[0060] The six output files mentioned above complement each other functionally: embeddings.npy and tfidf_docs.npz provide dense and sparse vector representations, respectively; tfidf.pkl ensures the consistency of query vectorization; id_map.json and texts.json maintain the mapping relationship between metadata and text; and relations.json stores the relationship network between terms. Together, they provide multimodal and multi-relational knowledge support for the knowledge retrieval module.
[0061] II. Knowledge Retrieval Module The knowledge retrieval module, as the core retrieval engine of the system, performs multi-channel retrieval and fusion of user input, as well as multi-hop relationship expansion, to achieve efficient and accurate recall of regulatory clauses. This module significantly improves the recall and precision of the retrieval by fusing semantic vector retrieval and sparse feature retrieval, and combining clause relationship graphs for multi-hop reasoning, providing sufficient regulatory basis for subsequent security assessments.
[0062] 1. Implementation of multi-channel retrieval and fusion unit: ① Retrieval Trigger and Query Construction: When the user inputs a natural language description, the system triggers the retrieval process by loading multimodal vector representation files from the knowledge base, including the embeddings.npy file which stores dense semantic vectors and the tfidf_docs.npz file which stores sparse feature matrices, to ensure that the retrieval components are consistent with the knowledge base version.
[0063] ② Multi-channel parallel retrieval: The system executes two retrieval channels in parallel: semantic vector retrieval based on cosine similarity and sparse matrix retrieval based on word frequency features. Semantic vector retrieval generates a semantic score by calculating the similarity between the query vector and dense vectors in the knowledge base, while sparse feature retrieval generates a sparse score by matching the word frequency of the query with the terms.
[0064] ③ Fusion sorting algorithm: The system uses two fusion algorithms to uniformly sort the parallel retrieval results: - Reverse Rank Fusion Algorithm (RRF): This algorithm is used to calculate the fusion score of each candidate clause. The score of each candidate clause in each retrieval channel is calculated as 1 / (k+rank), where k is the fusion constant with a default value of 60, and rank is the ranking of the candidate clause in a single retrieval channel. The final score of each candidate clause is the sum of its scores in each channel. This algorithm can balance the stability and diversity of ranking. - Z-score standardized weighted fusion algorithm: After standardizing the scores of each channel, the scores are summed according to preset weights, where the semantic vector retrieval weight is 0.6 and the sparse feature retrieval weight is 0.4, highlighting the contribution of high confidence channels; The final scores after fusion are sorted in descending order to generate a preliminary search results list.
[0065] ④ Search result optimization: The system supports search filtering based on conditions such as region and structure type, and automatically relaxes the conditions when there are insufficient results, such as relaxing the city-level region to the provincial, regional and even national level, to ensure that the minimum number of search results is 3.
[0066] 2. Implementation of multi-hop relation extension unit: ① Multi-hop neighbor discovery: The system performs multi-hop neighbor discovery in the relation graph file relations.json based on a breadth-first search algorithm. Starting from the seed clause of the initial search, it traverses the associated nodes within a specified number of hops. The default number of hops is 2, and the number of neighbors per hop is limited to 6.
[0067] ② Relationship extension strategies: The system supports two relationship extension strategies: - Append strategy: Append the neighbor terms discovered through multi-hop discovery as independent results to the search result set without changing the order of the seed terms; - Weighted Strategy: The relationship score of neighboring clauses is weighted and merged with their original search score. The weighting formula is: Final Score = Original Search Score + Relationship Score Base × Decay Coefficient ^ Number of Hops, where the default value for the relationship score base is 0.05 and the default value for the decay coefficient is 0.7. This formula ensures that the contribution weight of neighboring clauses decreases exponentially with the number of hops, thereby strengthening the logical connection between clauses.
[0068] III. Main Module of Safety Assessment Technology The safety assessment technology mainline module, as the core assessment engine of the system, performs full-process parsing, encapsulation, and judgment of user input and retrieval results to achieve building safety assessments based on regulatory standards. This module ensures the rigor of the assessment process and the reliability of the conclusions through a strict traffic diversion mechanism, dual-channel key-value extraction, dynamic retrieval triggering, rule-based expression, and information comparison.
[0069] 1. User input splitting unit implementation: ① Weighted Voting Mechanism: The user input triage unit adopts a weighted voting mechanism based on regular expression matching and semantic judgment by a large language model. Regular expression matching performs rapid matching based on a predefined set of high-frequency words (such as building safety terms like "crack," "settlement," and "tilt"), with a weight of 0.7. Semantic judgment by the large language model involves calling a local large model for intent recognition, with a weight of 0.3. The weighted formula is: Final Score = 0.7 × Regular Expression Matching Result + 0.3 × Large Language Model Judgment Result. When the weighted score exceeds the threshold of 0.6, the user input is determined to belong to the evaluation branch.
[0070] ② Streamlined Execution Process: The system calculates the matching degree between user input and vocabulary in the field of building safety, combines the semantic judgment results of the large language model, and performs a fusion calculation according to a weighted formula. Once the evaluation branch is entered, the system will maintain this state until the evaluation process ends, ensuring the continuity of the evaluation process.
[0071] 2. Implementation of user input structured representation units: ① Dual-channel key-value extraction strategy: The system adopts a strict dual-channel key-value extraction strategy. All key names must come from the predefined building safety code key-value table (building safety code_key-value table.json). The first channel performs deterministic extraction based on regular expressions, generating initial key-value pairs through alias matching; the second channel, in the large language model completion channel, only completes missing items not covered by regular expression extraction, and must not overwrite existing key-value pairs.
[0072] ② Unit Normalization: For numerical key-value pairs, the system normalizes units according to predefined categories: length is standardized to millimeters (mm), angle / ratio to thousandths (‰), and rate to millimeters per month (mm / month). The normalization process intelligently converts values by parsing the numerical values and unit text, combined with dimension hints (value_hint) in the key-value table.
[0073] ③ Validation and Output: After extraction, the system performs validity checks on the results to ensure that all key names exist in the key-value table and that enumerated key values fall within the predefined range. The final output is a structured information template containing only the successfully extracted key-value pairs.
[0074] 3. Implementation of the retrieval trigger and retrieval result encapsulation unit: ① Dynamic Query Construction: The system dynamically constructs retrieval queries based on the extracted key-value pairs in the current information template and the user's input history. The query text consists of the user's natural language input and the Chinese aliases of the key names in the information template. The Chinese aliases are taken from the aliases_cn field in the key-value table, ensuring semantic consistency between the retrieval query and the standard Chinese text.
[0075] ② Multi-round retrieval and relaxation strategy: The system calls the knowledge retrieval module to perform mixed retrieval. When the number of initial retrieval results is less than 3 after applicability filtering, the relaxation strategy is automatically triggered: priority is given to relaxing the regional restrictions (such as relaxing from "Wuhan" to "Hubei", "Central China" and "National"). If the results are still insufficient, the structural type and other conditions are further relaxed to ensure that the minimum number of candidate terms is obtained.
[0076] ③ Result Encapsulation and Context Integration: After the retrieval is completed, the system concatenates the seed clause and its multi-hop neighbor clauses in the order of the vector library to form a clause package containing complete context. Each clause package contains metadata such as the specification number, clause number, concatenated full text, segmented text and identifiers, and scope of application tags, providing sufficient basis for subsequent rule-based expression.
[0077] 4. Implementation of regularized expression units for search results: ① Rule skeleton construction: The system first constructs a rule skeleton from the retrieved clause package. The rule skeleton adopts a strict JSON template structure, including fields such as bundle_id, key, mode, op, limit, conditions, and evidence. The key field must come from the key-value table, and the mode field must be consistent with the value_mode in the key-value table.
[0078] ② Deterministic pre-filling and LLM completion: The system uses regular expressions to deterministically pre-fill the rule skeleton, identifying comparison operators (such as "should not be greater than" and "must not exceed") and numerical units in the clauses, and automatically filling in the op (operator) and limit (threshold) fields. When the pre-filling is incomplete, the large language model is called to fill in the missing items, but rewriting existing content is prohibited.
[0079] ③ Rule Audit Mechanism: After the rules are populated, the system conducts a rigorous audit, checking aspects such as key name validity, enumeration value validity, unit standardization, and the accuracy of evidence citations. Rules that fail the audit will be discarded to ensure the reliability and consistency of the final rules.
[0080] 5. Information comparison and security assessment unit implementation: ① Information sufficiency judgment: The system adopts a key-value completeness check algorithm to traverse all relevant rule condition keys and rule keys and check their existence and validity in the current session structured information; when all necessary key values exist and are valid, the system determines that the information is "sufficient", otherwise it determines that the information is "insufficient" and triggers the missing key identification and follow-up question generation mechanism.
[0081] ② Security Assessment: Under the premise of sufficient information, the system uses deterministic operators to perform specification compliance comparison. By traversing the condition parts of all applicable rules, it checks their matching degree with the structured information of the current session. For matching rules, it further performs numerical comparison operations, including maximum value check, minimum value check, range check, and enumerated value check. Based on the comparison results, the system generates a descriptive summary, which specifically includes compliant specification clauses and their specific requirements, non-compliant specification clauses and their deviations, and comparison details of key specification indicators.
[0082] ③ Evidence Citation and Conclusion Output: The system implements the principle of "no statement without citation", extracting the normative basis from the rules that trigger the comparison, including the normative number, clause number and key original text excerpts; the system binds the descriptive summary with the corresponding normative basis to form a complete evaluation conclusion report, ensuring the traceability and interpretability of the evaluation conclusion.
[0083] IV. Interactive Management Module The interaction management module, serving as the system's process control hub, manages user interaction processes, drives the complete evaluation session cycle, and coordinates collaboration among various modules. This module ensures the systematic nature of the evaluation process and the consistency of the user experience through status maintenance, process scheduling, intelligent follow-up questions, and result display.
[0084] 1. Implementation of the session state management unit: ①State data structure design: The session state management unit maintains a global state object, which contains the following core fields: - mode: Current session mode ("chat" or "eval"); - eval_started: A boolean flag indicating whether the evaluation process has started; - info_template: The dictionary of current information templates, storing the extracted key-value pairs; - history_texts: A list of user input history, recording the complete context of the conversation; - last_filtered: The list of terms filtered after the most recent search; ② State persistence and restoration: The system uses the AppState class to manage state using a singleton pattern, ensuring state consistency throughout the entire session. State data is dynamically updated with user interaction, and historical state is cleared through a reset operation when the user initiates a new round of dialogue.
[0085] ③ Context consistency maintenance: During the evaluation process, the system ensures incremental updates to the information templates. This means that subsequently extracted key-value pairs will be integrated with existing templates but will not overwrite existing values. This mechanism guarantees the accuracy and continuity of information accumulation throughout multi-turn dialogues.
[0086] 2. Follow-up question generation unit implementation: ① Missing key priority calculation: The follow-up question generation unit calculates the priority of missing keys based on multiple strategies: - Missing conditions take precedence: In the rules that have been approved, missing keys in the condition section are given the highest weight; - Rule keys are secondary: keys involved in the rule itself are assigned medium weight; - Bonus points for open keys: Additional weight is added for open key-value pairs (numeric values); - Frequency weighting: Keys that match aliases most frequently in the retrieved terms receive extra points.
[0087] ② Follow-up Question Generation Algorithm: For each key that requires follow-up questions, the system generates different follow-up question templates based on its type: - Open key: Generates a numerical query with unit prompts, such as "Please specify the crack width (unit: mm)"; - Enumerated key: Generates option-based queries, such as "What type of crack direction is it? (options: horizontal, vertical, diagonal)".
[0088] ③ User Termination Judgment and Fallback Handling: The system uses semantic analysis to determine whether the user has explicitly indicated that they cannot provide more information (e.g., detecting keywords such as "don't know" or "no more"). Once user termination is confirmed, the system triggers fallback handling. Based on the currently collected structured information and the last valid search result, it calls the large language model to generate a suggested report, explaining the currently confirmed information, missing key items, and the preliminary investigation direction based on the existing information, while emphasizing the limitations of the conclusion.
[0089] 3. Implementation of the process scheduling unit: ① Evaluate the process state machine: The process scheduling unit implements a state machine-based process control mechanism, and the main state transitions include: - One-way transition from chat mode to evaluation mode (once in evaluation mode, it will not return to chat mode). - In the evaluation mode, the process branches based on the judgment results of the information comparison and security evaluation unit: if the judgment is "sufficient information", the process moves to the result display process; if the judgment is "insufficient information", the process moves to the follow-up question generation process. ② Exception Handling and Rollback Mechanism: When the search result is empty or the rule-based expression fails, the system automatically triggers the rollback mechanism, directly entering the follow-up question generation process to avoid process interruption. Simultaneously, the system is equipped with timeout protection; when a single processing step exceeds the preset time limit, a user-friendly error message is automatically returned.
[0090] ③ Module collaborative scheduling: The process scheduling unit calls each unit of the main security assessment technology module in a preset order: user input diversion unit → user input structured expression unit → retrieval trigger and retrieval result encapsulation unit → retrieval result rule-based expression unit → information comparison and security assessment unit, forming a complete processing pipeline.
[0091] 4. Implementation of the results display unit: ① Multi-view display strategy: The result display unit provides two information display modes: - Concise mode: Displays only the core information of the clause (specification number, clause number, and first line text); - Detailed mode: Displays the full content and structured information of the terms; Users can switch between the two views in real time using interface buttons to meet the information density requirements of different scenarios.
[0092] ② Standardized presentation of evidence citations: For safety assessment results, the system presents the evidence chain in the format of "standard number + clause number + key original text excerpt". Each evidence excerpt is limited to 80 characters to ensure that the core value of the information is highlighted. At the same time, the system provides complete comparative information, such as "crack width: 0.8mm≤1.0mm".
[0093] ③ Interactive Report Generation: The system supports exporting evaluation reports, generating a structured document from the complete evaluation process (including user input, system follow-up questions, retrieval of criteria, judgment logic, and final conclusions). The report uses a combination of natural language and structured data, ensuring both readability and professionalism.
[0094] V. Large Language Model Service Module The large language model service module, as the core of the system's intelligent services, provides large language model capabilities to other modules, ensuring the system's intelligence level in natural language understanding, content completion, and rule processing. This module organically integrates large language model capabilities into the system workflow through professional prompting engineering and strict output constraints.
[0095] 1. User input parsing and intent determination unit implementation: ① Domain-Adapted Intent Recognition: The user input parsing and intent determination unit adopts a prompting engineering strategy optimized for the building safety domain. The prompt template is: "You are a building safety assessment assistant. Please determine whether the following input is related to building safety assessment, provide a decimal fraction between 0 and 1, and output only the number." This design ensures that the large language model focuses on domain-related intent recognition.
[0096] ② Output Normalization: The system performs strict normalization on the model output, ensuring that the output value is within the range of 0-1 through a numerical extraction algorithm. When a valid value cannot be extracted, the system uses a default value processing mechanism to ensure the stability of the subsequent weighted voting mechanism.
[0097] 2. User input completion and correction unit implementation: ① Key-value table constraint extraction mechanism: The user input completion and correction unit adopts a strict key-value table constraint mechanism, with the prompt template explicitly requiring that "keys must come from a given list; values for enumerated keys must be selected from a given enumeration; open keys, if numerical, must retain the original number and include the unit." The system transmits complete key table metadata through a structured data format, including the mode and corresponding value range for each key.
[0098] ② Unit Consistency and Standardization: For numerical key-value pairs, the system explicitly specifies the unit standard in the prompts to ensure that the numerical values output by the large language model are consistent with the system's internal unit system. The extracted results undergo secondary verification and unit consistency through subsequent normalization functions.
[0099] ③ Secure output mechanism: The output adopts strict structured format constraints, extracts valid data objects through pattern matching algorithm, and returns null values for invalid output to avoid erroneous data from polluting the information template.
[0100] 3. Implementation of the search result rule filling and correction unit: ① Skeleton Constraint Patch Mechanism: The retrieval result rule filling and correction unit adopts an innovative "skeleton-patch" working mode. The system first provides a complete rule skeleton template. The large language model only allows filling in missing fields and prohibits rewriting existing content. The fields that can be modified are strictly limited to a predetermined range to ensure the integrity of the rule structure.
[0101] ② Ensuring the accuracy of evidence citation: The system explicitly requires in its prompts that evidence citations must accurately correspond to the original text fragments, and role selection is limited to a predefined range, ensuring that the generated rule-based evidence is accurate and traceable. It also provides fragment context information to assist the model in making accurate citations.
[0102] ③ Batch processing and fault tolerance mechanism: The unit supports batch processing of multiple rule skeletons, distinguishing specific rules through an identifier field. When the model is unavailable or the output is abnormal, the system retains the pre-filled results and adopts a degradation processing strategy, without affecting the main process execution.
[0103] 4. Implementation of the evaluation result report generation unit: ① Multi-scenario response generation: The evaluation result report generation unit supports natural language generation for multiple scenarios: casual conversation scenarios use a friendly and concise response style; evaluation conclusion scenarios use a structured, evidence-driven report format; and follow-up question scenarios use clear, guided question statements. Each scenario has corresponding prompt templates and style constraints.
[0104] ② Evidence Integration and Interpretability: When generating the evaluation report, the system provides the relevant rule evidence as context to the large language model, requiring it to accurately cite this evidence in the report, adhering to the principle of "no statement without citation." Report generation ensures both completeness and conciseness.
[0105] ③ Security Guarantee Mechanism: The system strictly constrains the behavior of the large language model through prompts, prohibiting the fabrication of dialogue turns, the output of specific prefixes, and the provision of unfounded security conclusions. When the output does not meet the format requirements, the system automatically performs post-processing to ensure the standardization and security of the final output.
[0106] In summary, in the rural residential structure safety assessment system based on large language models and graph retrieval enhancement of the present invention, the various modules have the following relationships: The interaction management module is the core of the system architecture, coordinating and driving the collaborative work of various components. This module directly schedules the security assessment technology mainline module, whose assessment process relies on structured data resources provided by the knowledge base and relationship graph modules. During the assessment process, the security assessment technology mainline module calls the knowledge retrieval module to search for regulatory clauses. The retrieval results, after rule-based processing, are returned to the security assessment technology mainline module for security assessment. Simultaneously, the large language model service module provides natural language processing capabilities to both the security assessment technology mainline module and the interaction management module, including intent recognition, key-value completion, rule filling, and report generation.
[0107] This invention system effectively solves the technical problems of insufficient reliability of conclusions, rigid retrieval mechanisms, and weak interactive capabilities of traditional systems by integrating multimodal retrieval, dynamic graph reasoning, dual-channel key value extraction, and intelligent evaluation mechanisms, thus achieving intelligent evaluation of building structure safety with low threshold, high accuracy, and high reliability.
[0108] Those skilled in the art will readily understand that the above description is merely 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 scope of protection of the present invention.
Claims
1. A village and town residential structure safety assessment system based on large language model and atlas retrieval enhanced generation, characterized by, The knowledge base and the relationship graph module includes a knowledge base and a relationship graph, wherein the building safety assessment specification clauses are converted into semantic vectors to form the knowledge base, and then a non-directional relationship graph is constructed with the clauses as nodes and the association relationships as edges. The interactive management module is used for managing user interaction and dispatching the safety assessment technology main line module based on user input. The safety assessment technology main line module is used for analyzing and processing user input, calling the knowledge retrieval module for retrieval based on the analyzed and processed user input, and encapsulating the retrieval result. The knowledge retrieval module is used for retrieval in the knowledge base and the relationship graph module, specifically, the hit clauses are obtained by searching in the knowledge base, and then the hit clauses are used for extended retrieval in the relationship graph to obtain the final retrieval result. The large language model service module is used for providing large language model support for the safety assessment technology main line module and the interactive management module. The construction of the knowledge base includes:
2. The village residential structure safety assessment system based on large language model and graph retrieval enhanced generation of claim 1, wherein, The clause text is converted into a high-dimensional dense semantic vector by using a professional text embedding model; the clause text is converted into a sparse matrix by using a sparse representation algorithm based on word frequency characteristics, and a fallback mechanism is set, so that when the professional text embedding model is unavailable, a dimension reduction algorithm is used to perform dimension reduction on the sparse matrix to generate an alternative semantic vector. The professional text embedding model is obtained by domain adaptively fine-tuning a basic model retrieve_zh_v1, and the fine-tuning specifically includes: filling the numerical unit symbols commonly used in the building safety field into the unused word slots of the model, and adding the specification terms in the building safety field as new words to the word list of the model.
3. The village residential structure safety assessment system based on large language model and graph retrieval enhanced generation according to claim 2, wherein, The knowledge retrieval module includes:
4. The village residential structure safety assessment system based on large language model and graph retrieval enhanced generation of claim 1, wherein, A multi-channel retrieval and fusion unit is used for parallel execution of mixed retrieval in the knowledge base by different strategies, and unified sorting of the retrieval results of different strategies by a fusion sorting algorithm to obtain hit clauses. A multi-hop relationship expansion unit is used to take the hit clauses as seed nodes, use a search algorithm to obtain associated nodes in a specified number of hops from the seed nodes in the relationship graph, and optimize the retrieval results by an appending strategy or a weighting strategy. In the multi-channel retrieval and fusion unit, the retrieval strategies include semantic vector retrieval based on cosine similarity and sparse feature retrieval based on word frequency characteristics.
5. The village residential structure safety assessment system based on large language model and graph retrieval enhanced generation according to claim 4, characterized in that, Then the semantic vector retrieval results and the sparse feature retrieval results are uniformly sorted by an inverse sequence fusion algorithm RRF or a Z-score standardization weighted fusion algorithm. In the multi-hop relationship expansion unit, the search algorithm uses a breadth-first search algorithm to obtain associated nodes, i.e., expanded clauses; the appending strategy means that the expanded clauses are attached to the retrieval results as independent results without changing the sorting of the hit clauses; 6. The village residential structure safety assessment system based on large language model and graph retrieval enhanced generation according to claim 5, characterized in that, The weighting strategy means that the relationship scores of the expanded clauses are weighted and fused with their original retrieval result scores, and are uniformly sorted together with the hit clauses. The safety assessment technology main line module includes:
7. The village residential structure safety assessment system based on large language model and graph retrieval enhanced generation according to claim 1, wherein, A user input shunting unit is used for intent recognition and shunting of user input, determines whether the user input belongs to an evaluation branch or a casual branch, directly realizes interaction through a large language model when it belongs to the casual branch, and enters a user input structured expression unit when it belongs to the evaluation branch. The user input structured expression unit is configured to convert the natural language input by the user into structured information; The retrieval trigger and retrieval result packaging unit is configured to combine the structured information and historical information to form a retrieval request, and then call a knowledge retrieval module to perform retrieval, and trigger a relaxation strategy when the retrieval result is insufficient, and finally package the final retrieval result and output it to the retrieval result regular expression unit; The retrieval result regular expression unit is configured to convert the final retrieval result into a regularized result expression, including extracting conditions and requirements from the clauses obtained from the retrieval to generate a rule skeleton, and calling a large language model to fill the rule skeleton when necessary to obtain a regularized result expression; The information comparison and security evaluation unit is configured to compare the structured information input by the user with the regularized result expression item by item, determine whether the user input information is sufficient, output a security evaluation conclusion when the information is determined to be sufficient, or guide the user to provide missing information through the interactive management module, and analyze and process the user input again and perform retrieval.
8. The village residential structure safety assessment system based on large language model and graph retrieval enhanced generation according to claim 7, wherein, In the user input shunting unit, the user input is subjected to intent recognition and shunting, including: based on a set of predefined regular expressions, extracting and matching key fields, symbols and the like in the user input to obtain regular matching results; calling a large language model to perform semantic judgment on the natural language sentence input by the user to identify whether it belongs to the evaluation related content; fusing the regular matching results and the results of the semantic judgment of the large language model according to a preset weight, so as to determine whether the user input belongs to the evaluation branch or the casual branch.
9. The village residential structure safety assessment system based on large language model and graph retrieval enhanced generation according to claim 8, wherein, In the user input structured expression unit, a double-channel key-value extraction strategy is adopted, specifically, regular extraction is performed first, the pre-defined key-value table and alias dictionary are used to extract the corresponding fields from the user input through rule matching; when the regular extraction is not covered, a large language model is called to generate the completion content of the missing fields; finally, the extracted or completed results are compared and checked with the key-value table to ensure that the output structured information meets the expectations.
10. The village and town residential structure safety assessment system based on large language model and atlas retrieval enhanced generation according to any one of claims 1-9, wherein, The interactive management module includes: The conversation state management unit is configured to maintain the running state of the evaluation conversation, including storing user input, system response and evaluation state information, and maintaining the continuity of the conversation after entering the evaluation branch; The follow-up question generation unit is configured to generate and issue follow-up questions when it is detected that the user input information is insufficient, to guide the user to provide missing information, and trigger a bottom-up process when the user explicitly cannot provide more information, and return a suggested prompt with basis; The flow scheduling unit is configured to schedule the execution of the units of the security evaluation technology main line module according to a preset flow to perform evaluation tasks, including calling the follow-up question generation unit to issue supplementary questions when the information comparison and security evaluation unit outputs information that is insufficient, and re-driving the security evaluation technology main line module after the user provides missing information input, and continuing to perform the evaluation flow from the user input structured expression unit; The result display unit is configured to call a large language model to convert the security evaluation conclusion or the suggested prompt into a natural language report, and present it to the user in a readable form, and provide an evaluation report output.
Citation Information
Patent Citations
Method and system for realizing intelligent outbound call of robot
CN117915002A
Question and answer method and system based on large language model
CN119166767A
Civil engineering field knowledge large model retrieval enhancement generation method
CN119829778A
Knowledge question and answer rapid processing system based on artificial intelligence
CN119903159A
Semantic retrieval method, device and equipment based on reordering and storage medium
CN120123491A