A rag question and answer method and system driven by document fragmentation optimization in the construction industry
Patent Information
- Application Number
- CN202611264836.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-10-20
AI Technical Summary
通用向量化模型未经过建筑领域语料的适配优化,难以准确捕捉这些专业术语的上下文语义关联,导致检索过程中出现语义偏差,检索结果相关性差,无法满足专业知识查询需求
[0015]经由上述的技术方案可知,与现有技术相比,本发明公开提供了一种建筑行业文档分片优化驱动的RAG问答方法及系统,通过结构边界识别、语义相似度分析、最大语义单元保留及图文联合分片的动态算法,确保建筑文档分片的语义完整性,避免关键信息割裂,为后续流程奠定高质量数据基础。进一步,本发明采用建筑领域语料微调的嵌入模型,搭配重排序模块,大幅提升检索精准性,有效解决行业专业术语语义捕捉不足的问题。同时,支持多模态文档处理,将图像与说明文本绑定分片,实现跨模态问答,拓展应用边界。更进一步,本发明结合建筑场景的Prompt模板,生成专业、简洁且可追溯的答案,满足行业严谨性需求。
Smart Images

Figure FT_1 
Figure FT_2
Abstract
Description
Technical Field
[0001] This invention relates to the field of interdisciplinary technology of artificial intelligence and knowledge engineering, and more specifically to a RAG question-answering method and system driven by document fragmentation optimization in the construction industry. Background Technology
[0002] With the deepening of digital transformation in the construction industry, engineering construction companies have accumulated a large amount of unstructured document data during production management, including construction specifications and standards, quality and safety management systems, technical manuals on processes and methods, and project construction plans. These documents are usually stored in various business departments of the company in the form of PDF, Word, and scanned copies, and have complex structural characteristics such as clause-based expression, multi-level heading hierarchy, and mixed text and graphics. Traditional knowledge management methods mainly rely on manual archiving and keyword matching retrieval mechanisms, which are no longer suitable for the needs of modern construction companies for efficient collaboration and accurate decision-making. Specifically, this manifests as: scattered knowledge resource organization, low information retrieval efficiency, lack of deep semantic understanding capabilities, and inability to quickly respond to the immediate needs of front-line personnel and managers on construction sites for professional technical knowledge.
[0003] In recent years, Retrieval-Augmented Generation (RAG) technology, centered on Large Language Models (LLMs), has been widely applied in enterprise-level intelligent question-answering systems. The RAG architecture combines vectorized retrieval from external knowledge bases with the text generation capabilities of large language models to achieve automated knowledge-based question answering services based on unstructured documents. However, existing general-purpose RAG frameworks face significant challenges when processing professional documents in the construction industry: (1) Architectural documents have distinct structured characteristics, often containing diverse elements such as tables, diagrams, clause-style text, and multi-level headings, and have a rigorous logical hierarchy. The document fragmentation strategy adopted by general RAG, which uses fixed lengths or simple paragraphs, does not fully consider the structural special characteristics of architectural documents, and is very likely to cause semantic breaks, separating key information with complete business meaning, and affecting the effectiveness of subsequent retrieval and generation.
[0004] (2) Construction industry terminology is highly specialized, such as "post-cast strip construction technology" and "deep foundation pit support scheme". The semantic connotation and application scenarios of these terms have distinct industry specificity. The general vectorization model has not been adapted and optimized for the corpus of the construction field, making it difficult to accurately capture the contextual semantic relationship of these professional terms. This leads to semantic bias during the retrieval process, poor relevance of the retrieval results, and failure to meet the needs of professional knowledge query.
[0005] (3) The existing RAG system lacks the ability to model the unique logical structure of architectural documents (such as “chapter-clause-sub-item”), and cannot make full use of the inherent hierarchical relationship and logical association of the document for retrieval optimization. This results in the lack of reasonable basis for the ranking of retrieval results, which in turn affects the accuracy and logic of the generated answers and makes it difficult to output answers that conform to the professional standards of the architectural industry.
[0006] Therefore, how to provide a RAG question-answering method that is specifically optimized for the characteristics of documents in the construction industry, so as to improve the accuracy, practicality and intelligence of knowledge services, is an urgent problem to be solved by those skilled in the art. Summary of the Invention
[0007] In view of this, the present invention provides a RAG question answering method and system driven by document fragmentation optimization in the construction industry. It designs a multi-granularity, semantically coherent, and structure-aware document fragmentation strategy based on the structured features and semantic distribution characteristics of construction industry documents, and combines vector retrieval and large language model generation mechanism to build a high-precision intelligent question answering system.
[0008] To achieve the above objectives, the present invention adopts the following technical solution: On the one hand, this invention provides a RAG question-answering method driven by document fragmentation optimization in the construction industry, including: Acquire multi-source heterogeneous documents from the construction industry, perform structured preprocessing on these documents, and construct a structured document representation. Based on structured document representation, a dynamic segmentation algorithm that integrates structural boundary recognition and semantic similarity analysis is used to optimize and segment the structured document representation, generating semantically complete segmentation units; An embedded model adapted to the construction field is used to vectorize the segmented units and a knowledge vector database for the construction industry is constructed. The system receives user query information, encodes it, and then searches the construction industry knowledge vector database to obtain an initial candidate fragment set. The initial candidate fragment set is then reordered based on the semantic matching degree between the query intent and the initial candidate fragments to obtain optimized search results. The optimized search results are used as context and input into the large language model to generate answers tailored to the user's query information based on the preset prompt template.
[0009] Preferably, based on structured document representation, a dynamic segmentation algorithm integrating structural boundary recognition and semantic similarity analysis is used to optimize and segment the structured document representation, generating semantically complete segmentation units, including: The rule engine is used to identify structural nodes in the structured document representation, and the identified structural boundaries are used as potential fragmentation boundaries. A lightweight semantic model is used to calculate the semantic similarity between adjacent paragraphs. Based on the semantic similarity, potential segmentation boundaries are filtered out, and potential segmentation boundaries within adjacent paragraphs with similarity higher than a preset threshold are removed. By jointly judging the structural boundary and semantic continuity, if a structural boundary causes a semantic unit with complete business meaning to be fragmented, then we fall back to the nearest upper-level structural boundary or merge adjacent segments. Layout analysis technology is used to identify the image-text related areas, and the image and its corresponding upper and lower explanatory text are encapsulated into a segment unit.
[0010] Preferably, the structural boundaries include at least one of chapter titles, clause numbers, list item identifiers, table start and end marks, and figure caption identifiers.
[0011] Preferably, an embedded model adapted to the construction field is used to vectorize the segmented units, and a knowledge vector database for the construction industry is constructed, including: The BERT or bge-base-zh-v1.5 Chinese embedding model, fine-tuned based on the corpus of the construction industry, performs vectorized encoding on the segmented units; The encoded vectors, along with the original fragmented text and metadata, are stored in the vector database.
[0012] Preferably, the vector database is a vector database that supports approximate nearest neighbor retrieval.
[0013] Preferably, the vector database is Milvus, FAISS, or Qdrant.
[0014] On the other hand, this invention provides a RAG question-answering system driven by document fragmentation optimization in the construction industry, comprising: The document acquisition unit is used to acquire multi-source heterogeneous documents from the construction industry, perform structured preprocessing on the multi-source heterogeneous documents, and construct a structured document representation. The segmentation unit is used to optimize the segmentation of the structured document representation based on the structured document representation and to generate semantically complete segmentation units by using a dynamic segmentation algorithm that integrates structural boundary recognition and semantic similarity analysis. The database construction unit is used to vectorize the fragmented units using an embedded model adapted to the construction field, and to build a knowledge vector database for the construction industry. The query unit is used to receive user query information, encode the user query information, retrieve it from the construction industry knowledge vector database, obtain an initial candidate fragment set, and reorder the initial candidate fragment set based on the semantic matching degree between the query intent and the initial candidate fragments to obtain optimized search results. The input unit is used to input the optimized search results as context into the large language model, and generate answers for the user's query information based on the preset prompt template.
[0015] As can be seen from the above technical solutions, compared with existing technologies, this invention discloses a RAG question-answering method and system driven by document fragmentation optimization in the construction industry. Through structural boundary recognition, semantic similarity analysis, maximum semantic unit preservation, and dynamic algorithms for joint image and text fragmentation, it ensures the semantic integrity of construction document fragments, avoids the fragmentation of key information, and lays a high-quality data foundation for subsequent processes. Furthermore, this invention employs an embedding model with fine-tuned corpus in the construction field, coupled with a re-ranking module, significantly improving retrieval accuracy and effectively solving the problem of insufficient semantic capture of industry professional terms. Simultaneously, it supports multimodal document processing, binding images and explanatory text to fragments to achieve cross-modal question answering and expand application boundaries. Even further, this invention combines a construction scene Prompt template to generate professional, concise, and traceable answers, meeting the industry's rigor requirements. Attached Figure Description
[0016] 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 embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0017] Figure 1 This is a schematic diagram of the process provided by the present invention.
[0018] Figure 2 This is a schematic diagram of the structure provided by the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] This invention discloses a RAG question-answering method driven by document fragmentation optimization in the construction industry, such as... Figure 1 As shown, it includes: The system acquires multi-source heterogeneous documents from the construction industry and performs structured preprocessing on these documents to construct a structured document representation. These multi-source heterogeneous documents include construction industry policy documents, process and method manuals, and other documents in PDF, Word, and scanned formats. The preprocessing specifically includes parsing the above documents, extracting text, tables, images, and hierarchical structure information (such as heading levels and numbering systems), and constructing a structured document representation to provide a foundation for subsequent intelligent segmentation.
[0021] Based on structured document representation, a dynamic segmentation algorithm that integrates structural boundary recognition and semantic similarity analysis is used to optimize and segment the structured document representation, generating semantically complete segmentation units; An embedded model adapted to the construction field is used to vectorize the segmented units and a knowledge vector database for the construction industry is constructed. The system receives user query information, encodes it, and then retrieves it from a knowledge vector database for the construction industry to obtain an initial candidate fragment set. The initial candidate fragment set is then reordered based on the semantic matching degree between the query intent and the initial candidate fragments to obtain optimized search results. Specifically, after the user query is encoded using the same embedding model, the top-K (e.g., K=20) most similar fragments are retrieved from the vector database as the initial candidate set. Subsequently, a cross-encoder reordering module (e.g., a reranker based on DeBERTa fine-tuning) is introduced to calculate the fine-grained semantic matching score between the query and each candidate fragment. The fragments are then reordered according to the score, and the top-N (e.g., N=5) fragments are selected as the "optimized search results" for subsequent generation.
[0022] The optimized search results are used as context and input into the large language model to generate answers tailored to the user's query based on a pre-defined prompt template. A specific prompt template could be: "You are a senior architectural engineer. Please answer the question concisely and professionally based on the following references. If the answer comes from the references, please cite the source." The output answer can follow this pattern: References: {retrieved_chunks} Question: {query} answer: Furthermore, based on structured document representation, a dynamic segmentation algorithm integrating structural boundary recognition and semantic similarity analysis is used to optimize and segment the structured document representation, generating semantically complete segmentation units, including: A rule engine is used to identify structural nodes in the structured document representation and to use the identified structural boundaries as potential segmentation boundaries. Specifically, the rule engine can employ regular expression matching and DOM tree analysis. Structural boundaries include structured elements such as chapter titles (e.g., "Chapter X", "Clause XXX"), numbered lists (e.g., "1.1", "(a)", "①"), table start and end markers, and figure captions. For example, in the logical tree obtained after PDF parsing, if a node satisfies the "H1 / H2 level heading" or "numbered paragraph" pattern, it is marked as a strong segmentation point.
[0023] A lightweight semantic model is used to calculate the semantic similarity between adjacent paragraphs. Based on the semantic similarity, potential segmentation boundaries are filtered out, and potential segmentation boundaries within adjacent paragraphs with similarity higher than a preset threshold are removed. The lightweight semantic model can be the bce-embedding-base_v1 model, with the threshold set to 0.75.
[0024] By jointly determining structural boundaries and semantic continuity, if a structural boundary causes a semantic unit with complete business meaning to be fragmented, then the process reverts to the nearest parent structural boundary or merges adjacent segments. Specifically, a "semantic unit" is defined as the smallest block of information with complete business meaning (such as a construction specification clause, a process step, or a management system description). The joint determination of structural boundaries and semantic continuity ensures that each segment contains at least one complete semantic unit. If a structural boundary causes a unit to be fragmented (such as separating step 1 and step 2 of the "post-pouring strip construction process"), then the process reverts to the nearest parent structural boundary or merges adjacent segments.
[0025] Layout analysis techniques are used to identify image-text related regions, encapsulating the image and its corresponding surrounding explanatory text into a single fragment unit. Specifically, for regions containing images (such as construction diagrams or flowcharts) and their adjacent explanatory text, layout analysis techniques (using the PDFMiner library) are employed to identify image-text related regions, and the image and its contextual explanatory text are encapsulated as a joint fragment unit. This unit supports multimodal processing in the subsequent vectorization stage.
[0026] Furthermore, an embedding model adapted to the construction domain is used to vectorize the segmented units, and a knowledge vector database for the construction industry is constructed, including: The BERT or bge-base-zh-v1.5 Chinese embedding model, fine-tuned based on the corpus of the construction industry, performs vectorized encoding on the segmented units; The encoded vectors, along with the original fragmented text and metadata, are stored in a vector database. The metadata includes information such as document source, chapter path, and whether it contains images.
[0027] Furthermore, the vector database is a vector database that supports approximate nearest neighbor retrieval, specifically Milvus, FAISS, or Qdrant.
[0028] In another embodiment, the method of this application is integrated into the intelligent assistant platform of the construction enterprise to support typical scenarios such as system query and process and method guidance. The effect of segmentation optimization on improving indicators such as question and answer accuracy and response time is verified through practical application.
[0029] On the other hand, this invention provides a RAG question-answering system driven by document fragmentation optimization in the construction industry, such as... Figure 2 As shown, it includes: The document acquisition unit is used to acquire multi-source heterogeneous documents from the construction industry, perform structured preprocessing on the multi-source heterogeneous documents, and construct a structured document representation. The segmentation unit is used to optimize the segmentation of the structured document representation based on the structured document representation and to generate semantically complete segmentation units by using a dynamic segmentation algorithm that integrates structural boundary recognition and semantic similarity analysis. The database construction unit is used to vectorize the fragmented units using an embedded model adapted to the construction field, and to build a knowledge vector database for the construction industry. The query unit is used to receive user query information, encode the user query information, retrieve it from the construction industry knowledge vector database, obtain an initial candidate fragment set, and reorder the initial candidate fragment set based on the semantic matching degree between the query intent and the initial candidate fragments to obtain optimized search results. The input unit is used to input the optimized search results as context into the large language model, and generate answers for the user's query information based on the preset prompt template.
[0030] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0031] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A RAG question-answering method driven by document fragmentation optimization in the construction industry, characterized in that, include: Acquire multi-source heterogeneous documents from the construction industry, perform structured preprocessing on these documents, and construct a structured document representation. Based on structured document representation, a dynamic segmentation algorithm that integrates structural boundary recognition and semantic similarity analysis is used to optimize and segment the structured document representation, generating semantically complete segmentation units; An embedded model adapted to the construction field is used to vectorize the segmented units and a knowledge vector database for the construction industry is constructed. The system receives user query information, encodes it, and then searches the construction industry knowledge vector database to obtain an initial candidate fragment set. The initial candidate fragment set is then reordered based on the semantic matching degree between the query intent and the initial candidate fragments to obtain optimized search results. The optimized search results are used as context and input into the large language model to generate answers tailored to the user's query information based on the preset prompt template.
2. The RAG question-answering method driven by document fragmentation optimization in the construction industry according to claim 1, characterized in that, Based on structured document representation, a dynamic segmentation algorithm integrating structural boundary recognition and semantic similarity analysis is used to optimize and segment the structured document representation, generating semantically complete segmented units, including: The rule engine is used to identify structural nodes in the structured document representation, and the identified structural boundaries are used as potential fragmentation boundaries. A lightweight semantic model is used to calculate the semantic similarity between adjacent paragraphs. Based on the semantic similarity, potential segmentation boundaries are filtered out, and potential segmentation boundaries within adjacent paragraphs with similarity higher than a preset threshold are removed. By jointly judging the structural boundary and semantic continuity, if a structural boundary causes a semantic unit with complete business meaning to be fragmented, then we fall back to the nearest upper-level structural boundary or merge adjacent segments. Layout analysis technology is used to identify the image-text related areas, and the image and its corresponding upper and lower explanatory text are encapsulated into a segment unit.
3. The RAG question-answering method driven by document fragmentation optimization in the construction industry according to claim 2, characterized in that, The structural boundaries include at least one of the following: chapter title, clause number, list item identifier, table start and end markers, and figure caption identifier.
4. The RAG question-answering method driven by document fragmentation optimization in the construction industry according to claim 1, characterized in that, An embedded model adapted to the construction field is used to vectorize the segmented units, and a knowledge vector database for the construction industry is constructed, including: The BERT or bge-base-zh-v1.5 Chinese embedding model, fine-tuned based on the corpus of the construction industry, performs vectorized encoding on the segmented units; The encoded vectors, along with the original fragmented text and metadata, are stored in the vector database.
5. The RAG question-answering method driven by document fragmentation optimization in the construction industry according to claim 4, characterized in that, The vector database is a vector database that supports approximate nearest neighbor retrieval.
6. The RAG question-answering method driven by document fragmentation optimization in the construction industry according to claim 5, characterized in that, The vector database is Milvus, FAISS, or Qdrant.
7. A RAG question-answering system driven by document fragmentation optimization in the construction industry, characterized in that, include: The document acquisition unit is used to acquire multi-source heterogeneous documents from the construction industry, perform structured preprocessing on the multi-source heterogeneous documents, and construct a structured document representation. The segmentation unit is used to optimize the segmentation of the structured document representation based on the structured document representation and to generate semantically complete segmentation units by using a dynamic segmentation algorithm that integrates structural boundary recognition and semantic similarity analysis. The database construction unit is used to vectorize the fragmented units using an embedded model adapted to the construction field, and to build a knowledge vector database for the construction industry. The query unit is used to receive user query information, encode the user query information, retrieve it from the construction industry knowledge vector database, obtain an initial candidate fragment set, and reorder the initial candidate fragment set based on the semantic matching degree between the query intent and the initial candidate fragments to obtain optimized search results. The input unit is used to input the optimized search results as context into the large language model, and generate answers for the user's query information based on the preset prompt template.