Civil engineering field knowledge large model retrieval enhancement generation method

By establishing a vector database in the field of civil engineering and using large-model search modules, the shortcomings of general large-language models in the field of civil engineering are solved, and efficient and accurate professional knowledge retrieval and answer generation are achieved.

CN119829778APending Publication Date: 2025-04-15CSCEC DIGITAL TECH CO LTD +1
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411924013.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-25
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

The prior art is difficult to efficiently retrieve and understand users' natural language problems in the field of civil engineering, and the general large language model lacks professional knowledge of civil engineering, making it difficult to directly generate professional responses.

Method used

By collecting knowledge data in the field of civil engineering, performing structured processing and establishing a vector database, combining large-scale model retrieval modules and prompt word technology, we can enhance the professional knowledge generation ability of large language models.

Benefits of technology

It has achieved efficient retrieval of professional knowledge in the field of civil engineering, generated fast and accurate professional answers, improved the efficiency of knowledge update, and improved the interpretability of model output.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829778A_ABST
    Figure CN119829778A_ABST
Patent Text Reader

Abstract

The invention provides a civil engineering field knowledge large model retrieval enhancement generation method. The method comprises civil engineering domain knowledge processing and vectorization storage, civil engineering domain knowledge capability evaluation and adaptation of a large language model, a civil engineering domain knowledge vector database efficient retrieval mechanism and knowledge enhancement generation guidance based on retrieval results. According to the method, knowledge in the civil engineering field is encoded and established into a vector database through preprocessing processes such as data cleaning and text segmentation; a general large language model suitable for civil engineering field knowledge retrieval enhancement generation is selected through a semantic confusion index, target knowledge is retrieved through similarity calculation to form cue words, and the civil engineering field professional knowledge generation ability of the large language model is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of civil engineering and artificial intelligence large models, and in particular relates to a large model retrieval enhancement generation method for knowledge in the field of civil engineering. Background Art

[0002] Due to the complexity of the knowledge system in the field of civil engineering, a large number of practitioners have knowledge query and question-answering needs, which are usually met through online searches, expert inquiries, and literature retrieval. However, civil engineering covers many sub-directions, and there is a certain degree of overlap and duplication in knowledge such as various specifications and standards, academic papers, industry reports, and corporate information, which brings difficulties to users' retrieval and query. Existing knowledge management systems based on knowledge graphs and relational databases have difficulty in handling complex reasoning problems, and have poor generalization capabilities and are difficult to understand users' spoken natural language question input. Therefore, it is necessary to design a parsing model that can accurately understand the semantics of human natural language questions, and accurately and quickly perform knowledge queries and answer generation.

[0003] With the continuous development of artificial intelligence technology, pre-trained large language models learn on massive general data, showing powerful natural language processing and text generation capabilities, and gradually deepening their application in vertical fields. Large language models usually contain billions to trillions of parameters. These parameters have stored a large amount of general knowledge through complex training and optimization processes. They can accurately understand the semantics of user input and quickly generate the most relevant and accurate results, which can not only improve the efficiency of information retrieval, but also help users better understand and apply existing knowledge. However, due to the lack of relevant professional knowledge in the field of civil engineering in the training data of general large language models, it is difficult to directly generate professional responses. At the same time, the specifications and technologies in the field of civil engineering are constantly evolving, new materials, processes and design concepts continue to emerge, and new knowledge needs to be continuously supplemented. Adding civil engineering knowledge to the general large language model through model training methods is not only costly, but may also cause problems such as catastrophic forgetting. In addition, since the knowledge contained in the general large model is stored in its own massive parameters, it is difficult to ensure the interpretability of the model output.

[0004] The large model retrieval enhancement generation method can provide professional knowledge prompt words for the model by efficiently searching the external database, and realize the embedding of civil engineering domain knowledge through the zero training method. Therefore, the present invention uses the large model retrieval enhancement generation method to collect civil engineering domain knowledge for structured processing and establish it as a vector database, realizes domain adaptation by evaluating the civil engineering knowledge of the general large model, combines user questions and retrieves related knowledge as prompt words, enhances the professional knowledge answering ability of the large model and improves the knowledge updating efficiency. Summary of the invention

[0005] The purpose of the present invention is to solve the problems in the prior art and meet the actual needs, and propose a method for enhancing the generation of a large model retrieval in the field of civil engineering knowledge. The method is suitable for efficiently searching a knowledge base and generating professional answers based on civil engineering questions raised by users.

[0006] The present invention is implemented by the following technical scheme. The present invention proposes a method for enhancing the generation of a large model retrieval of knowledge in the field of civil engineering, and the method comprises the following steps:

[0007] Step 1: Collect various text knowledge data in the field of civil engineering, clean the data and remove noise preprocessing; obtain the corresponding vector representation through document segmentation and use the encoding model, so that words with similar semantics are close in distance in the vector space; complete the memory and index parameter configuration to build a suitable vector database;

[0008] Step 2: Select a general large language model suitable for knowledge retrieval and enhanced generation in the field of civil engineering through the semantic perplexity index; build a retrieval module, recall the target knowledge through similarity calculation to form prompt words, and use the large model's context learning ability and prompt word engineering to enhance the large language model's ability to generate professional knowledge in the field of civil engineering; judge the professionalism and reliability of the large model output based on the index position of the large model output, and supplement and update the knowledge by continuously improving the vector database.

[0009] Furthermore, in step one, various knowledge data in the field of civil engineering, including professional textbooks, academic literature, specifications and standards, engineering cases, design drawings and industry reports, are collected, sorted and classified; the collected data are cleaned to remove noise and irrelevant information.

[0010] Furthermore, in step 1, vectorization is a process of converting text data into vector encoding; the text is segmented and the text is divided into words or subwords w1, w2, ..., w T ; The goal of the encoding model is to predict the context words based on the central word. The core of its encoding function is to construct a word vector representation so that words with similar semantics are close in distance in the vector space. The calculation formula is as follows:

[0011]

[0012] Among them, w i As the central word, w j is the context word w with window step size i-c ,…,w i-1 ,w i+1 ,…,w i+c , v w is the input word vector, u w To output word vectors, the goal of the large model is to adjust the word vector vw and u w The value of maximises the probability of all central words predicting context words, and encoding vectors with similar spatial distances have similar semantics.

[0013] Furthermore, in step one, a suitable vector database is built, and the memory size, index type, and similarity algorithm parameter configurations are completed.

[0014] Furthermore, in step 2, a general large language model with strong understanding and reasoning capabilities for civil engineering professional knowledge is selected for retrieval enhancement generation; civil engineering domain knowledge text is selected, and the probability of each word in the text appearing given the previous word is calculated based on the parameters of the large language model itself, and the semantic perplexity of the large model is calculated as an evaluation indicator:

[0015]

[0016] Among them, w i is the th word in the text, and the length of the text is N.

[0017] Furthermore, in step 2, a retrieval module based on similarity calculation is designed; the goal of the retrieval module is to find the k documents that are most similar to the user's question, that is, to calculate the similarity score between the query vector and all stored vectors, and return the document records with high scores; the similarity calculation formula is as follows:

[0018]

[0019] Among them, x is the question input, d is the document encoding in the knowledge base, s(x,d) represents the similarity between the question and the knowledge, · represents the vector dot product, and ‖·‖ represents the Euclidean norm of the vector.

[0020] Furthermore, in step 2, the user's question and the retrieved similar knowledge text are merged to form civil engineering prior knowledge prompt words; the splicing method is as follows:

[0021] c=Concat(x,d1,d2,…,d k )

[0022] Concat() is a vector concatenation operation, x is the problem input, and d i is the i-th similar text retrieved, a total of k;

[0023] Input the prompt words into the large model to enhance the generation of civil engineering professional knowledge answers. The objective function is:

[0024]

[0025] Among them, y is the target generated text, D is the knowledge base, and y ′for all output text types.

[0026] Furthermore, in step two, the user judges the professionalism and reliability of the output of the large model according to the index position of the output of the large model through corresponding standard specifications, and supplements and updates the knowledge by continuously improving the vector database.

[0027] The present invention also proposes an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method for enhancing the generation of a large model of knowledge in the field of civil engineering when executing the computer program.

[0028] The present invention also proposes a computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the steps of the method for enhancing the generation of a large model of knowledge in the field of civil engineering.

[0029] Beneficial effects of the present invention:

[0030] 1. The present invention can efficiently search external databases of civil engineering, efficiently summarize user questions and professional knowledge based on a large model to form prompt words, and answer professional questions in the field of civil engineering. The model has a fast answering speed and high accuracy.

[0031] 2. The large model can provide the index location of related knowledge through similarity calculation, so that users can verify it based on the corresponding knowledge, enhancing the interpretability and professionalism of the large model's responses.

[0032] 3. The present invention injects civil engineering domain knowledge into the general large model through a zero-training method, solving the problem of difficulty in learning and updating domain knowledge of large models and the easy occurrence of catastrophic forgetting. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0034] Figure 1 The present invention is a flowchart of the method for enhancing the generation of a large model retrieval of knowledge in the field of civil engineering.

[0035] Figure 2 Example schematic diagram for knowledge generation in the civil engineering domain for a general large language model.

[0036] Figure 3 The figure is a schematic diagram of an example of the result generated by the present invention for knowledge retrieval enhancement in the field of civil engineering. DETAILED DESCRIPTION

[0037] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] The purpose of the present invention is to propose a method for quickly and accurately generating civil engineering knowledge by using a large model for retrieval enhancement. First, a vector database is established by processing and encoding civil engineering knowledge data. Then, a large language model for retrieval enhancement generation is selected, and professional knowledge is retrieved by similarity calculation. Prompt words are used to guide the large language model to generate professional knowledge.

[0039] Combination Figure 1-Figure 3 The present invention proposes a method for enhancing the generation of a large model retrieval of knowledge in the field of civil engineering, the method comprising the following steps:

[0040] Step 1: Collect various text knowledge data in the field of civil engineering, and perform preprocessing such as cleaning and noise removal on the data. Obtain the corresponding vector representation through document segmentation and use the encoding model so that words with similar semantics are close in distance in the vector space. Complete the configuration of memory, index and other parameters to build a suitable vector database.

[0041] The step 1 is specifically as follows:

[0042] Step 1.1: Collect various knowledge data in the field of civil engineering, such as professional textbooks, academic literature, specifications and standards, engineering cases, design drawings, industry reports, etc., and organize and classify them. Clean the collected data to remove noise and irrelevant information, such as format errors and repeated content.

[0043] Step 1.2: Vectorization is a process of converting text data into vector encoding. Perform word segmentation on the text and divide the text into words or subwords w1, w2, …, w T The goal of the encoding model is to predict the context words based on the central word. The core of its encoding function is to construct a word vector representation so that words with similar semantics are close in distance in the vector space. The calculation formula is as follows:

[0044]

[0045] Among them, w i As the central word, w j is the context word w with window step size i-c ,…,w i-1 ,wi+1 ,…,w i+c , v w is the input word vector, u w To output word vectors, the goal of the model is to adjust the word vector v w and u w The value of maximises the probability of all central words predicting context words, and encoding vectors with similar spatial distances have similar semantics.

[0046] Step 1.3: Build a suitable vector database and complete the configuration of parameters such as memory size, index type, and similarity algorithm.

[0047] Step 2: Select a general large language model suitable for knowledge retrieval and enhanced generation in the field of civil engineering through the semantic perplexity index. Build a retrieval module, recall the target knowledge through similarity calculation to form prompt words, and use the context learning ability and prompt word engineering of the large model to enhance the ability of the large language model to generate professional knowledge in the field of civil engineering. Judge the professionalism and reliability of the large model output according to the index position of the large model output, and supplement and update the knowledge by continuously improving the vector database.

[0048] The step 2 is specifically as follows:

[0049] Step 2.1: Select a general large language model with strong understanding and reasoning ability of civil engineering professional knowledge for retrieval enhancement generation. Select civil engineering domain knowledge text, calculate the probability of each word in the text given the previous word based on the parameters of the large language model itself, and calculate the semantic perplexity of the model as an evaluation indicator:

[0050]

[0051] Among them, w i is the th word in the text, and the length of the text is N. The model with lower semantic perplexity can more accurately grasp the semantics and language rules of civil engineering texts, making it easier to generate knowledge based on prompt words.

[0052] Step 2.2, design a retrieval module based on similarity calculation. The goal of the retrieval module is to find the k documents that are most similar to the user's question, that is, to calculate the similarity score between the query vector and all stored vectors, and return the document records with high scores. The similarity calculation formula is as follows:

[0053]

[0054] Among them, x is the question input, d is the document encoding in the knowledge base, s(x,d) represents the similarity between the question and the knowledge, · represents the vector dot product, and ‖·‖ represents the Euclidean norm of the vector.

[0055] Step 2.3: Merge the user's question with the retrieved similar knowledge text to form civil engineering prior knowledge prompt words. The splicing method is as follows:

[0056] c=Concat(x,d1,d2,...,d k )

[0057] Concat() is a vector concatenation operation, x is the problem input, and d i is the i-th similar text retrieved, a total of k.

[0058] Furthermore, the prompt words are input into the large model to enhance the generation of civil engineering professional knowledge answers, and the objective function is:

[0059]

[0060] Among them, y is the target generated text, D is the knowledge base, and y ′ for all output text types.

[0061] Step 2.4: The user judges the professionalism and reliability of the output of the large model according to the index position of the large model output and the corresponding standards and specifications, and supplements and updates the knowledge by continuously improving the vector database.

[0062] Example

[0063] This implementation mode is to apply the present invention to knowledge question and answer in the field of civil engineering. Figure 1 A flow chart of the method for diagnosing apparent damage of civil engineering structures based on a multimodal large model according to the present invention is given. Figure 2 An example of knowledge generation in the civil engineering domain using a general large language model is given. Figure 3 An example of the result of the invention being used for enhanced generation of knowledge retrieval in the field of civil engineering is given.

[0064] The step one is specifically as follows: selecting "Concrete Structure Reinforcement Design Code" GB 50367-2013 as the civil engineering field knowledge to be enhanced, segmenting the code text based on the Longchain framework, converting the code into vector-to-vector encoding through the bge-large-zh-v1.5 model, and finally storing it in the vector database.

[0065] The specific step 2 is: through the knowledge evaluation of the general large language model, select the large language model GLM-4 suitable for civil engineering knowledge question answering. Select a component reinforcement single-choice question and input it into the large model, such as Figure 2 As shown in the figure, the answer of the large model without knowledge base retrieval enhancement shows that the large model cannot give the correct answer based on the implicit knowledge of its own parameters. Figure 3The figure shows enhanced generation of knowledge base retrieval. The large model first divides the input question, selects similar knowledge encodings in the vector database by calculating similarity, and outputs the corresponding chapter index in the knowledge base as a reference. Then, the large language model combines user input with similar knowledge as prompt words and generates professional answers through reasoning.

[0066] The present invention also proposes an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method for enhancing the generation of a large model of knowledge in the field of civil engineering when executing the computer program.

[0067] The present invention also proposes a computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the steps of the method for enhancing the generation of a large model of knowledge in the field of civil engineering.

[0068] The memory in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus RAM (DRRAM). It should be noted that the memory of the method described in the present invention is intended to include, but is not limited to, these and any other suitable types of memory.

[0069] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disc (SSD)).

[0070] In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The steps of the method disclosed in conjunction with the embodiment of the present application can be directly embodied as a hardware processor for execution, or a combination of hardware and software modules in a processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in conjunction with its hardware. To avoid repetition, it is not described in detail here.

[0071] It should be noted that the processor in the embodiment of the present application can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiment can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to perform, or the hardware and software modules in the decoding processor can be combined and performed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in a memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0072] The above is a detailed introduction to the large model retrieval and enhanced generation method for civil engineering knowledge proposed in the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A large model retrieval enhancement generation method for knowledge in the field of civil engineering, characterized in that: The method comprises the following steps: Step 1: Collect various text knowledge data in the field of civil engineering, clean the data and remove noise preprocessing; obtain the corresponding vector representation through document segmentation and use the encoding model, so that words with similar semantics are close in distance in the vector space; complete the memory and index parameter configuration to build a suitable vector database; Step 2: Select a general large language model suitable for knowledge retrieval and enhanced generation in the field of civil engineering through the semantic perplexity index; build a retrieval module, recall the target knowledge through similarity calculation to form prompt words, and use the large model's context learning ability and prompt word engineering to enhance the large language model's ability to generate professional knowledge in the field of civil engineering; judge the professionalism and reliability of the large model output based on the index position of the large model output, and supplement and update the knowledge by continuously improving the vector database.

2. The method according to claim 1, characterized in that: In step one, various knowledge data in the field of civil engineering are collected, including professional textbooks, academic literature, specifications and standards, engineering cases, design drawings and industry reports, and are sorted and classified; the collected data are cleaned to remove noise and irrelevant information.

3. The method according to claim 2, characterized in that In step 1, vectorization is a process of converting text data into vector encoding; the text is segmented and the text is divided into words or subwords w1, w2, ..., w T ; The goal of the encoding model is to predict the context words based on the central word. The core of its encoding function is to construct a word vector representation so that words with similar semantics are close in distance in the vector space. The calculation formula is as follows: Among them, w i As the central word, w j is the context word w with window step size i-c ,…,w i-1 ,w i+1 ,…,w i+c , v w is the input word vector, u w To output word vectors, the goal of the large model is to adjust the word vector v w and u w The value of maximises the probability of all central words predicting context words, and encoding vectors with similar spatial distances have similar semantics.

4. The method according to claim 3, characterized in that: In step 1, build a suitable vector database and complete the configuration of memory size, index type, and similarity algorithm parameters.

5. The method according to claim 4, characterized in that In step 2, a general large language model with strong understanding and reasoning capabilities for civil engineering professional knowledge is selected for retrieval enhancement generation; civil engineering domain knowledge text is selected, and the probability of each word in the text appearing given the previous word is calculated based on the parameters of the large language model itself, and the semantic perplexity of the large model is calculated as an evaluation indicator: Among them, w i is the th word in the text, and the length of the text is N.

6. The method according to claim 5, characterized in that In step 2, a retrieval module based on similarity calculation is designed; the goal of the retrieval module is to find the k documents that are most similar to the user's question, that is, to calculate the similarity score between the query vector and all stored vectors, and return the document records with high scores; the similarity calculation formula is as follows: Among them, x is the question input, d is the document encoding in the knowledge base, s(x,d) represents the similarity between the question and the knowledge, · represents the vector dot product, and ‖·‖ represents the Euclidean norm of the vector.

7. The method according to claim 6, characterized in that In step 2, the user's question and the retrieved similar knowledge text are combined to form civil engineering prior knowledge prompt words; the splicing method is as follows: c=Concat(x,d1,d2,…,d k ) Concat() is a vector concatenation operation, x is the problem input, and d i is the i-th similar text retrieved, a total of k; Input the prompt words into the large model to enhance the generation of civil engineering professional knowledge answers. The objective function is: Among them, y is the target generated text, D is the knowledge base, and y ′ for all output text types.

8. The method according to claim 7, characterized in that In step two, the user judges the professionalism and reliability of the big model output according to the index position of the big model output and the corresponding standard specifications, and supplements and updates the knowledge by continuously improving the vector database.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.

10. A computer-readable storage medium for storing computer instructions, characterized in that: When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Cited By

  • Building engineering bid risk identification method and system based on RAG-LLM

    CN120765362A

  • Multi-type structure damage intelligent diagnosis and maintenance decision-making method based on large model and knowledge embedding

    CN121169361A

  • Village and town residential structure safety evaluation system based on large language model and map retrieval enhanced generation

    CN121434367A