Question answering method and device for distribution network infrastructure project, electronic equipment and storage medium
By building a target vector database and large model, processing distribution network infrastructure information and user inquiries, the problem of low RAG technology retrieval efficiency is solved, and efficient information retrieval and management of distribution network infrastructure projects is realized.
Patent Information
- Application Number
- CN202411134113.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-03
AI Technical Summary
In the existing distribution network infrastructure projects, although RAG technology can retrieve fault cases and emergency solutions, the search efficiency is not high enough to meet the needs of power infrastructure project management.
By building a target vector database and a target model, obtaining distribution network infrastructure information, blocking, vectorization and indexing, and processing and estimating it in combination with user inquiry information, improving retrieval efficiency.
It significantly improves the search efficiency of RAG technology, can provide accurate and well-founded answers more quickly, and improves the efficiency of power infrastructure engineering management.
Smart Images

Figure CN119066170A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a method, device, electronic equipment and storage medium for answering questions in a distribution network infrastructure project. Background Art
[0002] With the development of society and economy, the demand for electric energy in the production process has been increasing, and the investment in power construction has been increasing. Power companies have entered a period of large-scale power infrastructure construction, and power infrastructure project management has received more and more attention. The quality of power infrastructure project management is directly related to the quality of power infrastructure project construction, which is crucial for the later operation and maintenance of various power infrastructure.
[0003] In distribution network projects, RAG technology can be used to build a knowledge base, integrate information from various links, and realize real-time sharing and retrieval of information, thereby optimizing resource allocation and progress management. Although RAG technology can currently be used to retrieve fault cases and emergency plans, the retrieval efficiency is not high enough. Summary of the invention
[0004] The technical problem to be solved by the implementation mode of the present invention is to provide a method, device, electronic device and storage medium for answering questions in distribution network infrastructure projects. By constructing a target vector database and a target large model, the query information of the target user is answered to obtain the target answer, thereby improving the retrieval efficiency of RAG technology.
[0005] In a first aspect, an embodiment of the present application provides a method for answering questions in a distribution network infrastructure project, which is applied to a RAG system. The method includes:
[0006] Obtain distribution network infrastructure information;
[0007] Build a vector database based on the distribution network infrastructure information to obtain a target vector database;
[0008] A large model is constructed based on the distribution network infrastructure information to obtain a target large model; the target vector database and the target large model are both components of the RAG system;
[0009] Obtaining query information of a target user to obtain first query information;
[0010] Inputting the first query information into a target vector database for processing to obtain first target vector information;
[0011] The first target vector information is input into the target large model for calculation to obtain the target answer.
[0012] In a second aspect, an embodiment of the present application provides a question-answering device for a distribution network infrastructure project, which is applied to a RAG system, and the question-answering device includes: an acquisition unit and a processing unit;
[0013] An acquisition unit, used to acquire distribution network infrastructure information;
[0014] A processing unit, used to construct a vector database based on the distribution network infrastructure information to obtain a target vector database;
[0015] A large model is constructed based on the distribution network infrastructure information to obtain a target large model; the target vector database and the target large model are both components of the RAG system;
[0016] Obtaining query information of a target user to obtain first query information;
[0017] Inputting the first query information into a target vector database for processing to obtain first target vector information;
[0018] The first target vector information is input into the target large model for calculation to obtain the target answer.
[0019] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a processor and a memory, the processor being connected to the memory, the memory being used to store a computer program, and the processor being used to execute the computer program stored in the memory, so that the electronic device executes the method of the first aspect.
[0020] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program enables a computer to execute the method of the first aspect.
[0021] In a fifth aspect, an embodiment of the present invention provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and is computer-operable to cause the computer to execute the method of the first aspect.
[0022] The implementation of the present invention has the following beneficial effects:
[0023] The distribution network infrastructure information is obtained, and a vector database is constructed based on the distribution network infrastructure information to obtain a target vector database. A large model is constructed based on the distribution network infrastructure information to obtain a target large model. Both the target vector database and the target large model are components of the RAG system. The query information of the target user is obtained to obtain the first query information. The first query information is input into the target vector database for processing to obtain the first target vector information. The first target vector information is input into the target large model for inference to obtain the target answer, thereby improving the retrieval efficiency of the RAG technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the implementation methods of the present application or the background technology, the drawings required for use in the implementation methods of the present application or the background technology will be described below.
[0025] Figure 1 is a structural schematic diagram of a RAG system provided in an embodiment of the present application;
[0026] Figure 2 It is a flow chart of a method for answering questions about a distribution network infrastructure project provided by an implementation method of the present application;
[0027] Figure 3 It is a structural schematic diagram of a question-answering device for a distribution network infrastructure project provided by an embodiment of the present invention;
[0028] Figure 4 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the implementation mode of the present application will be clearly and completely described below in conjunction with the drawings in the implementation mode of the present application. Obviously, the described implementation mode is only a part of the implementation mode of the present application, not all the implementation modes. Based on the implementation mode in the present application, all other implementation modes obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0030] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0031] Reference to "embodiment" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0032] The following is an explanation of some professional terms involved in this application:
[0033] Retrieval-Augmented Generation (RAG) system is a technical architecture that combines information retrieval with language generation. It can make full use of the large amount of existing data and knowledge to provide more factual basis and background information for the generated content, thereby improving the quality and reliability of the generated results.
[0034] See also Figure 1 , Figure 1 is a schematic diagram of the structure of a RAG system provided in an embodiment of the present application, such as Figure 1 As shown, the RAG system 10 includes a vector database 101 and a large model 102 .
[0035] In this embodiment, the vector database 101 converts a large amount of text data into vector form for storage, which can realize fast information retrieval. For the input query, the vector database 101 can quickly find the relevant vector information. The vector database 101 stores various detailed information related to the distribution network project, providing a basis for generating accurate and well-founded answers. The large model 102 can deeply understand the input query, parse the complex semantic relationships and intentions therein, and can also combine the relevant information obtained from the vector database to perform comprehensive analysis and reasoning to generate coherent and reasonable answers. After training with a large amount of data, the large model 102 can respond to inquiries of various forms and topics and provide high-quality output. In general, the vector database 101 provides a rich knowledge reserve for the RAG system, and the large model 102 is responsible for understanding and applying this knowledge to jointly achieve high-quality information generation and answers.
[0036] See also Figure 2 , Figure 2 This is a flow chart of a method for answering questions about a distribution network infrastructure project provided by the embodiment of the present application. The method is applied to Figure 1 The RAG system shown includes but is not limited to the following steps:
[0037] S201: Obtain distribution network infrastructure information.
[0038] In this embodiment, detailed planning, design, construction and acceptance information of distribution network infrastructure projects can be obtained from the internal systems of power enterprises, such as power engineering management systems and asset management systems. Information on approval, planning and supervision of distribution network infrastructure projects can be obtained from relevant websites and databases of government departments, such as energy authorities and planning departments. Information on actual conditions such as line directions and equipment installation can be obtained through on-site inspections of distribution network infrastructure sites. Distribution network infrastructure information can also be obtained from feasibility study reports, project plans and technical specifications.
[0039] In this embodiment, the distribution network infrastructure information includes basic project information, planning and design information, equipment information, construction information, cost information, technical parameters, safety and environmental protection information, acceptance and evaluation information, etc. The basic project information includes project name, number, location, construction start and end time, etc. The planning and design information includes grid layout planning, line path design, substation site selection and capacity planning, etc. The equipment information includes the model, specification, quantity, etc. of transformers, switch cabinets, cables, poles and towers, etc. The construction information includes the construction unit, construction progress, construction quality control measures, etc. The cost information includes budget, actual expenditure, source of funds, etc. The technical parameters include voltage level, transmission capacity, power factor, etc. The safety and environmental protection information includes safety measures, environmental protection plan and implementation status, etc. The acceptance and evaluation information includes acceptance report, operation effect evaluation, etc.
[0040] S202: construct a vector database based on the distribution network infrastructure information to obtain a target vector database.
[0041] In this embodiment, illustratively, a preset initial vector database is first obtained to lay a good foundation for subsequent processing and storage of distribution network infrastructure information.
[0042] Exemplarily, the distribution network infrastructure information is divided into blocks according to preset rules to obtain multiple infrastructure knowledge blocks. Specifically, the distribution network infrastructure information can be divided into blocks according to project stages, for example, the distribution network infrastructure information can be divided into knowledge blocks of different stages such as planning and design, construction preparation, construction process, and completion acceptance; the distribution network infrastructure information can be divided into blocks according to equipment type, for example, according to the equipment involved, such as transformers, switchgear, cables, etc., the relevant information can be divided separately; the distribution network infrastructure information can be divided into blocks according to geographical location, for example, according to the different areas covered by the distribution network infrastructure project; the distribution network infrastructure information can be divided into blocks according to work processes, for example, according to the information of different work processes such as material procurement, personnel deployment, and quality inspection; the distribution network infrastructure information can be divided into blocks according to technical categories, for example, according to the relevant information such as power transmission technology and automation control technology.
[0043] Exemplarily, multiple infrastructure knowledge blocks are vectorized to obtain multiple infrastructure knowledge vectors, wherein one infrastructure knowledge vector corresponds to one infrastructure knowledge block. Specifically, each of the multiple infrastructure knowledge blocks is converted into a digital vector. A pre-trained word embedding model can be used to convert each word in the infrastructure knowledge block into a corresponding word vector, and then these word vectors are processed by averaging, summing, or using a more complex neural network model to obtain a vector representation of the entire infrastructure knowledge block. A topic distribution vector can also be generated for each infrastructure knowledge block using a topic model. One-hot encoding can also be used to first classify the infrastructure knowledge blocks into a limited number of categories, and a unique binary encoding vector is created for each category. When a knowledge block belongs to a corresponding category, the corresponding encoding vector is the vector representation of the knowledge block.
[0044] Exemplarily, a vectorized index is created based on multiple infrastructure knowledge vectors to obtain multiple vectorized indexes, wherein one vectorized index corresponds to one infrastructure knowledge vector. Specifically, a hash index method can be used to calculate a hash value for each infrastructure knowledge vector. The calculation of the hash value can be based on certain features of the vector, such as performing some combination operation on the vector elements, and vectors with the same hash value are stored in the same hash bucket. In this way, the possible matching vectors can be quickly located through the hash value; a tree index method can be used to insert the infrastructure knowledge vector into a tree structure according to certain rules. When querying, the matching vector can be quickly found by searching in the tree structure; a vector quantization method can also be used to divide the vector space into multiple regions, each region is represented by a representative vector, the infrastructure knowledge vector is mapped to the region to which it belongs, and the identifier of the region can be used as an index.
[0045] Exemplarily, multiple infrastructure knowledge vectors are stored in an initial vector database according to multiple vectorized indexes to obtain a target vector database. Specifically, the format of the vectors and indexes stored in the initial vector database is first determined, and then each vectorized index and its corresponding infrastructure knowledge vector are traversed in turn, and the corresponding storage location is found in the initial vector database using the vectorized index, and then the corresponding infrastructure knowledge vector is stored in the found location. After the storage is completed, ensure that the relevant data of the database is updated, such as the number of records, index information, etc., to obtain the target vector database.
[0046] It can be seen that after the distribution network infrastructure information is divided into blocks, vectorized and indexed, the relevant knowledge blocks can be quickly located and retrieved, which greatly shortens the time of finding information and improves work efficiency. It can make the complex distribution network infrastructure information more structured and standardized, and facilitate effective organization, storage and management. The constructed target vector database can provide a high-quality data foundation for data analysis, large machine learning models, etc.
[0047] S203: Build a large model based on the distribution network infrastructure information to obtain a target large model.
[0048] In this embodiment, illustratively, project data is determined based on distribution network infrastructure information to obtain target project data. Specifically, specific data actually related to the project is screened and extracted from a large amount of information related to the distribution network infrastructure obtained. These data may include but are not limited to the project's budget, progress, material usage, construction personnel information, equipment parameters, etc., so as to obtain the target project data.
[0049] Exemplarily, the target engineering data is preprocessed to obtain a target engineering data set. Specifically, the target engineering data is first cleaned to remove duplicate, erroneous or incomplete data, and then the data is standardized or normalized to unify and standardize the format and dimension of the data for subsequent processing. Then, meaningful features are extracted and constructed, such as calculating statistics of certain data, encoding or converting the data, and finally the data is divided into a training set and a test set to obtain a target engineering data set containing a training set and a test set.
[0050] Exemplarily, a preset big model is obtained. The preset big model may be an existing basic big model with a certain architecture and parameters, such as a common deep learning big model such as a neural network, or a special big model for a specific task.
[0051] Exemplarily, a preset big model is trained and tested based on a target engineering data set to obtain a target big model. Specifically, in the training phase, the preset big model adjusts its own parameters by learning patterns and rules in the data to improve its prediction ability for unknown data. In the testing phase, an independent test set is used to evaluate the performance and accuracy of the preset big model. By continuously adjusting and optimizing the parameters of the big model, ultimately a target big model that can effectively process and analyze distribution network infrastructure project data is obtained.
[0052] It can be seen that accurately determining the target engineering data from the distribution network infrastructure information and conducting targeted preprocessing can remove noise and outliers, making the data more representative and accurate, thereby improving the performance of the large model in training and testing, and ultimately obtaining a more accurate target large model. The data that has been reasonably screened and processed can enable the large model to learn more general and essential laws, so that it has better prediction and generalization capabilities when faced with new and unseen data. By acquiring data, processing data and training models through a clear process, when the model effect is not ideal, it is possible to more clearly analyze whether it is a data problem or a model architecture problem, so as to make targeted optimization and adjustments.
[0053] It should be noted that the target large model can also be connected to the intelligent storage module, and the target engineering data set in the target large model can be updated through the intelligent storage module. Specifically, first, the target large model is connected to the intelligent storage module, which means that a data path and communication mechanism between the target large model and the intelligent storage module are established at the technical level, so that they can interact with each other and transmit information, and then the target engineering data set in the target large model is updated through the intelligent storage module. The intelligent storage module may continue to collect new distribution network infrastructure project data, or correct, supplement and improve existing data. When new data or updated data is available, the intelligent storage module will pass this data to the target large model. After receiving the updated data, the target large model will perform corresponding update operations on the target engineering data set used by itself according to the new data, which may include replacing old data, adding new data records, or modifying and adjusting the characteristics and labels of the data. Through such updates, the target large model can maintain an understanding and adaptation to the latest distribution network infrastructure project conditions, thereby improving the accuracy and reliability of its analysis and prediction.
[0054] S204: Acquire the query information of the target user to obtain first query information.
[0055] In this embodiment, the target vector database corresponds to a knowledge base interface, and a user query window can be constructed on the knowledge base interface. The user query window provides a text input area so that users can clearly enter their query information. Some prompt information will be displayed on the user query window, such as input format requirements and examples of common problems, to help users express their needs more accurately. After the user has finished entering, the query operation is triggered by clicking the search button.
[0056] After obtaining the query information of the target user through the user query window, the first query information can be obtained.
[0057] It should be noted that users can intuitively see part or all of the data structure and content summary in the target vector database on the knowledge base interface. At the same time, a search box or filter conditions are provided so that users can quickly find specific information. The content in the knowledge base can also be classified according to different topics, project stages, equipment types, etc., and presented in the form of clear menus or labels on the knowledge base interface, so that users can choose the corresponding category to browse according to their needs. When a user clicks or selects a knowledge base entry, it can expand to display more detailed information, including related data, documents, charts, etc. For users with corresponding permissions, the knowledge base interface can provide editing functions, allowing them to modify, add or delete the content in the knowledge base to ensure the accuracy and timeliness of the data. Different users may have different access and operation permissions, and the interface will control the visible content and executable operations based on the user's identity authentication.
[0058] S205: Input the first query information into the target vector database for processing to obtain first target vector information.
[0059] In this embodiment, exemplarily, keywords are extracted from the first query information through a target vector database to obtain multiple keywords. Specifically, the first query information input by the user is analyzed to find out the words that are of great significance and representativeness, thereby obtaining multiple keywords. Then, the part of speech of each keyword in the multiple keywords is determined to obtain multiple parts of speech, including nouns, verbs, adjectives, etc. Understanding the parts of speech helps to understand and process these keywords more accurately.
[0060] Exemplarily, multiple keywords are assembled according to multiple parts of speech to obtain a first query statement. Specifically, the keywords are combined into a sentence that better meets the query requirements and has a complete structure according to certain grammatical rules and logical relationships to obtain the first query statement.
[0061] Exemplarily, the first query statement is segmented into multiple word segments through the target vector database. Specifically, the segmentation can be performed based on a dictionary method, and a dictionary containing common words is pre-stored in the target vector database. The first query statement is matched with the words in the dictionary from left to right to obtain multiple word segments. The segmentation can also be performed based on a statistical method, analyzing a large amount of text data, calculating the probability of combination between words, and when segmenting the first query statement, selecting appropriate segmentation points according to the probability to segment the statement into word segments. Learning can also be performed based on machine learning methods, for example, using a deep learning model, such as a recurrent neural network or a long short-term memory network, training the deep learning model with a large amount of segmented text data, and then inputting the first query statement into the trained deep learning model to obtain a word segmentation result.
[0062] Exemplarily, a word vector corresponding to each of the multiple word segments is searched in the target vector database to obtain multiple word vectors, and the multiple word vectors are combined to obtain the first target vector information. Specifically, the database will perform an exact match in the stored target vector database according to the input word segmentation to obtain multiple word vectors. After obtaining multiple word vectors, the multiple word vectors can be combined by simple concatenation operation, weighted average operation, convolution operation, etc. to obtain the first target vector information.
[0063] In this embodiment, taking the weighted average operation as an example, the first target vector information is determined. Specifically, the reference weight corresponding to each word vector in a plurality of word vectors is first determined to obtain a plurality of reference weights, and then the target weight corresponding to each word vector in a plurality of word vectors is determined in the following manner to obtain a plurality of target weights: the frequency of the first word vector appearing in the target vector database is obtained to obtain the target frequency, wherein the first word vector is any word vector in the plurality of word vectors. Exemplarily, the optimization factor corresponding to the target frequency is determined. Specifically, a mapping relationship between a preset frequency and an optimization factor can be pre-stored, and the optimization factor corresponding to the target frequency is determined based on the mapping relationship. Exemplarily, the first reference weight is optimized according to the optimization factor to obtain a first weight, wherein the first reference weight is the reference weight corresponding to the first word vector, and the first weight is the target weight corresponding to the first word vector. Specifically, the first weight can be adjusted according to the optimization factor, and the specific calculation formula is as follows:
[0064] Target weight = first weight × (1 + optimization factor);
[0065] The target weight can be obtained according to the above formula.
[0066] After obtaining the multiple target weights, a weighted calculation is performed based on the multiple word vectors and the target weight corresponding to each word vector in the multiple word vectors to obtain first target vector information.
[0067] It can be seen that by determining the weights by considering the frequency of word vectors in the target vector database, it is possible to highlight concepts that are more common and more important in related fields. Word vectors with high frequencies may play a more critical role in understanding and answering user inquiries. Giving them higher weights can allow the model to pay more attention to these important information. Reasonable allocation of weights can help the model learn and process data more effectively, thereby improving the performance of the model and the quality of the output results. Considering the frequency and performing corresponding weight optimization can enable the model to have better generalization capabilities when facing new and similar inquiries, and to understand and answer them more accurately.
[0068] It can be seen that extracting keywords from the first query information and assembling and segmenting them can more accurately grasp the core needs of users and reduce the interference of irrelevant information, thereby improving the accuracy of subsequent queries and processing. After a series of processing steps, complex queries are converted into multiple word vectors, which facilitates the computer to perform rapid parallel processing and calculation, improves the computer's response speed, determines the part of speech of keywords and assembles them reasonably, helps to better understand the grammatical structure and semantic relationship of the query, makes the generated first query statement more in line with language logic, and thus improves the rationality and accuracy of subsequent word vector combinations.
[0069] S206: Input the first target vector information into the target large model for calculation to obtain the target answer.
[0070] In this embodiment, exemplarily, the reference text sequence corresponding to the first target vector information is determined by the target large model. Specifically, after training and learning, the target large model can infer or generate the corresponding reference text sequence based on the input first target vector information. This reference text sequence is a preliminary answer or related information to the user's inquiry. Then, a logical judgment is performed on the reference text sequence to obtain a logical judgment result. Specifically, a natural language processing tool or a natural language processing library is used to check whether the vocabulary collocation and sentence structure in the text conform to grammatical rules, and analyze whether the semantic relationship between words and sentences in the text is reasonable and coherent. Then, based on the specific knowledge and rules in the field of distribution network infrastructure, the description of the technology, process, specifications, etc. involved in the text is checked to be accurate, and the text is examined to see whether it has reasonable connection and echo in the context of the entire inquiry and answer, and to verify whether the statements in the text conform to basic logical reasoning. After performing these operations, a logical judgment result is obtained.
[0071] Exemplarily, after obtaining the logical judgment result, the error rate of the reference text sequence is determined based on the logical judgment result. Specifically, according to the logical judgment result, the part of the reference text sequence judged to be erroneous and the total number of elements that can be evaluated in the reference text sequence are determined, and then the error rate of the reference text sequence is calculated based on the number of errors and the total number of text elements.
[0072] Exemplarily, if the error rate is less than or equal to a preset value, the errors in the reference text sequence are corrected based on the logical judgment result to obtain the target text sequence. Specifically, first, according to the logical judgment result, the specific type of error is determined, such as grammatical errors (such as subject-verb inconsistency, tense error, etc.), semantic errors (such as concept confusion, logical contradiction, etc.), professional knowledge errors (such as technical parameter errors, process description errors, etc.), and then corresponding correction strategies are formulated for different error types. For example, for grammatical errors, you can refer to grammatical rules for modification; for semantic errors, you need to re-understand the context and adjust the expression to ensure semantic clarity and coherence; for professional knowledge errors, you need to correct them based on accurate professional information. Then, according to the formulated correction strategy, the errors in the reference text sequence are modified one by one, and after completing the preliminary correction, the entire text is reviewed to ensure that the corrected content is accurate in grammar, semantics and professional knowledge, and is fluent and natural in expression.
[0073] Exemplarily, if the error rate is greater than a preset value, the query information of the target user is acquired again to obtain the second query information, and the target text sequence corresponding to the second query information is determined. Specifically, if the error rate is greater than the preset value, it means that there is a problem with the logic of the first target vector information, and the user may be prompted to re-enter, and a prompt message may be displayed on the system interface to guide the user to re-enter the query. Some correct query examples may also be displayed to the user to help the user better organize and express their needs, thereby obtaining more accurate and clear second query information. The user's true intention may also be gradually clarified through further interaction with the user, such as asking questions, selecting options, etc., thereby obtaining more accurate second query information. The previous processing flow may also be reset to provide the user with a new input interface or window, allowing the user to re-enter the query information, thereby obtaining the second query information, and finally determining the target text sequence corresponding to the second query information.
[0074] It can be seen that by performing strict logical judgment and error correction on the generated reference text sequence, it is possible to ensure that the target text sequence finally provided to the user has high accuracy and rationality, thereby improving the quality and reliability of the answer, and providing the user with more accurate, clear and logical answers, which helps to meet user needs and improve user satisfaction and trust in the system; correcting the error rate in cases where the error rate is low, and re-acquiring the query information when the error rate is high can avoid wasting too many subsequent processing resources on answers with serious errors, thereby improving the utilization efficiency of system resources; by continuously processing and correcting the text sequence, more learning samples can be provided for the target large model, which helps to continuously improve and optimize the target large model and improve the accuracy of future answers.
[0075] In summary, the implementation of the present invention has the following beneficial effects:
[0076] The distribution network infrastructure information is obtained, and a vector database is constructed based on the distribution network infrastructure information to obtain a target vector database. A large model is constructed based on the distribution network infrastructure information to obtain a target large model. Both the target vector database and the target large model are components of the RAG system. The query information of the target user is obtained to obtain the first query information. The first query information is input into the target vector database for processing to obtain the first target vector information. The first target vector information is input into the target large model for inference to obtain the target answer, thereby improving the retrieval efficiency of the RAG technology.
[0077] See also Figure 3 , Figure 3 Schematic diagram of the structure of a question-answering device for a distribution network infrastructure project provided by an embodiment of the present invention. Figure 3 As shown, the question answering device 300 for distribution network infrastructure engineering includes: an acquisition unit 301 and a processing unit 302 .
[0078] An acquisition unit 301 is used to acquire distribution network infrastructure information;
[0079] The processing unit 302 is used to construct a vector database based on the distribution network infrastructure information to obtain a target vector database;
[0080] A large model is constructed based on the distribution network infrastructure information to obtain a target large model; the target vector database and the target large model are both components of the RAG system;
[0081] Obtaining query information of a target user to obtain first query information;
[0082] Inputting the first query information into a target vector database for processing to obtain first target vector information;
[0083] The first target vector information is input into the target large model for calculation to obtain the target answer.
[0084] In some possible implementations, in terms of inputting the first query information into a target vector database for processing to obtain the first target vector information, the processing unit 302 is specifically configured to:
[0085] extracting keywords from the first query information through a target vector database to obtain a plurality of keywords;
[0086] Determine the part of speech of each of the multiple keywords to obtain multiple parts of speech;
[0087] Assembling multiple keywords according to multiple parts of speech to obtain a first query statement;
[0088] Segmenting the first query statement into a plurality of tokens using a target vector database;
[0089] Search the target vector database for the word vector corresponding to each of the multiple word segments to obtain multiple word vectors;
[0090] Combine multiple word vectors to obtain the first target vector information.
[0091] In some possible implementations, in combining multiple word vectors to obtain first target vector information, the processing unit 302 is specifically configured to:
[0092] Determine a reference weight corresponding to each word vector in the multiple word vectors to obtain multiple reference weights;
[0093] According to the determination method in the following steps S1-S3, the target weight corresponding to each word vector in the multiple word vectors is determined to obtain multiple target weights, which is specifically the following steps:
[0094] S1. Obtain the frequency of a first word vector in a target vector database to obtain a target frequency; the first word vector is any word vector among multiple word vectors;
[0095] S2. Determine the optimization factor corresponding to the target frequency;
[0096] S3. Optimize the first reference weight according to the optimization factor to obtain a first weight; the first reference weight is the reference weight corresponding to the first word vector, and the first weight is the target weight corresponding to the first word vector;
[0097] A weighted calculation is performed based on the multiple word vectors and the target weight corresponding to each word vector in the multiple word vectors to obtain first target vector information.
[0098] In some possible implementations, in inputting the first target vector information into the target macro model for inference to obtain the target answer, the processing unit 302 is specifically configured to:
[0099] Determine a reference text sequence corresponding to the first target vector information through a target macro model;
[0100] Perform logical judgment on the reference text sequence to obtain a logical judgment result;
[0101] Determine the error rate of the reference text sequence based on the logical judgment result;
[0102] If the error rate is less than or equal to the preset value, the errors in the reference text sequence are corrected based on the logical judgment result to obtain the target text sequence;
[0103] If the error rate is greater than a preset value, the query information of the target user is obtained again to obtain second query information;
[0104] A target text sequence corresponding to the second query information is determined.
[0105] In some possible implementations, in terms of building a large model based on the distribution network infrastructure information to obtain a target large model, the processing unit 302 is specifically configured to:
[0106] Determine the engineering data based on the distribution network infrastructure information and obtain the target engineering data;
[0107] Preprocess the target engineering data to obtain a target engineering data set;
[0108] Get the preset large model;
[0109] The preset large model is trained and tested based on the target engineering data set to obtain the target large model.
[0110] In some possible implementations, the processing unit 302 is further specifically configured to:
[0111] Connect the target large model with the intelligent storage module;
[0112] The target engineering data set in the target large model is updated through the intelligent storage module.
[0113] In some possible implementations, in terms of constructing a vector database based on the distribution network infrastructure information to obtain a target vector database, the processing unit 302 is specifically configured to:
[0114] Obtain a preset initial vector database;
[0115] The distribution network infrastructure information is processed in blocks according to preset rules to obtain multiple infrastructure knowledge blocks;
[0116] Vectorization is performed on multiple infrastructure knowledge blocks to obtain multiple infrastructure knowledge vectors; one infrastructure knowledge vector corresponds to one infrastructure knowledge block;
[0117] Create a vectorized index based on multiple infrastructure knowledge vectors to obtain multiple vectorized indexes; one vectorized index corresponds to one infrastructure knowledge vector;
[0118] According to the multiple vectorized indexes, multiple infrastructure knowledge vectors are stored in an initial vector database to obtain a target vector database.
[0119] See also Figure 4 , Figure 4 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 4As shown, the electronic device 400 includes a transceiver 401, a processor 402 and a memory 403. They are connected via a bus 404. The memory 403 is used to store computer programs and data, and can transmit the data stored in the memory 403 to the processor 402. The above program includes instructions for executing the following steps:
[0120] Obtain distribution network infrastructure information;
[0121] Build a vector database based on the distribution network infrastructure information to obtain a target vector database;
[0122] A large model is constructed based on the distribution network infrastructure information to obtain a target large model; the target vector database and the target large model are both components of the RAG system;
[0123] Obtaining query information of a target user to obtain first query information;
[0124] Inputting the first query information into a target vector database for processing to obtain first target vector information;
[0125] The first target vector information is input into the target large model for calculation to obtain the target answer.
[0126] In some possible implementations, in terms of inputting the first query information into a target vector database for processing to obtain the first target vector information, the program further includes instructions for executing the following steps:
[0127] extracting keywords from the first query information through a target vector database to obtain a plurality of keywords;
[0128] Determine the part of speech of each of the multiple keywords to obtain multiple parts of speech;
[0129] Assembling multiple keywords according to multiple parts of speech to obtain a first query statement;
[0130] Segmenting the first query statement into a plurality of tokens using a target vector database;
[0131] Search the target vector database for the word vector corresponding to each of the multiple word segments to obtain multiple word vectors;
[0132] Combine multiple word vectors to obtain the first target vector information.
[0133] In some possible implementations, in terms of combining multiple word vectors to obtain first target vector information, the program further includes instructions for performing the following steps:
[0134] Determine a reference weight corresponding to each word vector in the multiple word vectors to obtain multiple reference weights;
[0135] According to the determination method in the following steps S1-S3, the target weight corresponding to each word vector in the multiple word vectors is determined to obtain multiple target weights, which is specifically the following steps:
[0136] S1. Obtain the frequency of a first word vector in a target vector database to obtain a target frequency; the first word vector is any word vector among multiple word vectors;
[0137] S2. Determine the optimization factor corresponding to the target frequency;
[0138] S3. Optimize the first reference weight according to the optimization factor to obtain a first weight; the first reference weight is the reference weight corresponding to the first word vector, and the first weight is the target weight corresponding to the first word vector;
[0139] A weighted calculation is performed based on the multiple word vectors and the target weight corresponding to each word vector in the multiple word vectors to obtain first target vector information.
[0140] In some possible implementations, in terms of inputting the first target vector information into the target macro model for calculation to obtain the target answer, the program further includes instructions for executing the following steps:
[0141] Determine a reference text sequence corresponding to the first target vector information through a target macro model;
[0142] Perform logical judgment on the reference text sequence to obtain a logical judgment result;
[0143] Determine the error rate of the reference text sequence based on the logical judgment result;
[0144] If the error rate is less than or equal to the preset value, the errors in the reference text sequence are corrected based on the logical judgment result to obtain the target text sequence;
[0145] If the error rate is greater than a preset value, the query information of the target user is obtained again to obtain second query information;
[0146] A target text sequence corresponding to the second query information is determined.
[0147] In some possible implementations, in terms of building a large model based on the distribution network infrastructure information to obtain a target large model, the above program further includes instructions for executing the following steps:
[0148] Determine the engineering data based on the distribution network infrastructure information and obtain the target engineering data;
[0149] Preprocess the target engineering data to obtain a target engineering data set;
[0150] Get the preset large model;
[0151] The preset large model is trained and tested based on the target engineering data set to obtain the target large model.
[0152] In some possible implementations, the above program further includes instructions for executing the following steps:
[0153] Connect the target large model with the intelligent storage module;
[0154] The target engineering data set in the target large model is updated through the intelligent storage module.
[0155] In some possible implementations, in terms of constructing a vector database based on the distribution network infrastructure information to obtain a target vector database, the above program further includes instructions for executing the following steps:
[0156] Obtain a preset initial vector database;
[0157] The distribution network infrastructure information is processed in blocks according to preset rules to obtain multiple infrastructure knowledge blocks;
[0158] Vectorization is performed on multiple infrastructure knowledge blocks to obtain multiple infrastructure knowledge vectors; one infrastructure knowledge vector corresponds to one infrastructure knowledge block;
[0159] Create a vectorized index based on multiple infrastructure knowledge vectors to obtain multiple vectorized indexes; one vectorized index corresponds to one infrastructure knowledge vector;
[0160] According to the multiple vectorized indexes, multiple infrastructure knowledge vectors are stored in an initial vector database to obtain a target vector database.
[0161] It should be understood that the electronic devices in this application may include smart phones (such as Android phones, iOS phones, Windows Phone phones, etc.), tablet computers, PDAs, laptops, mobile Internet devices MID (Mobile Internet Devices, MID for short) or wearable devices or servers, edge computing nodes, etc. The above electronic devices are only examples, not exhaustive, and include but are not limited to the above electronic devices. In practical applications, the above electronic devices may also include: smart vehicle terminals, computer equipment, etc.
[0162] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program is executed by a processor to implement part or all of the steps of any method for answering questions in a distribution network infrastructure project as described in the above method embodiment.
[0163] The embodiments of the present application also provide a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any method for answering questions about a distribution network infrastructure project as recorded in the above method embodiments.
[0164] It should be noted that, for the above-mentioned various method implementations, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the implementations described in the specification are all optional implementations, and the actions and modules involved are not necessarily required by this application.
[0165] In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0166] In the several embodiments provided in this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device implementation described above is only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another ERP hardware detection device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical or other forms.
[0167] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0168] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software program module.
[0169] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of each implementation method of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0170] A person skilled in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.
[0171] The above is a detailed introduction to the implementation methods of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above implementation methods is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for answering questions about a distribution network infrastructure project, characterized in that: Applied to the RAG system, the method comprises: Obtain distribution network infrastructure information; Building a vector database based on the distribution network infrastructure information to obtain a target vector database; A large model is constructed based on the distribution network infrastructure information to obtain a target large model; the target vector database and the target large model are both components of the RAG system; Obtaining query information of a target user to obtain first query information; Inputting the first query information into the target vector database for processing to obtain first target vector information; The first target vector information is input into the target large model for calculation to obtain the target answer.
2. The method according to claim 1, characterized in that The first query information is input into the target vector database for processing to obtain first target vector information, including: extracting keywords from the first query information through the target vector database to obtain a plurality of keywords; Determine the part of speech of each of the multiple keywords to obtain multiple parts of speech; Assembling the multiple keywords according to the multiple parts of speech to obtain a first query statement; Segmenting the first query statement into a plurality of tokens using the target vector database; Searching the target vector database for a word vector corresponding to each of the multiple word segments to obtain multiple word vectors; The multiple word vectors are combined to obtain the first target vector information.
3. The method according to claim 2, characterized in that The combining the multiple word vectors to obtain the first target vector information includes: Determine a reference weight corresponding to each word vector in the multiple word vectors to obtain multiple reference weights; According to the determination method in the following steps S1-S3, the target weight corresponding to each word vector in the multiple word vectors is determined to obtain multiple target weights, which is specifically the following steps: S1, obtaining the frequency of a first word vector appearing in the target vector database to obtain a target frequency; the first word vector is any word vector among the multiple word vectors; S2. Determine an optimization factor corresponding to the target frequency; S3. Optimize the first reference weight according to the optimization factor to obtain a first weight; the first reference weight is a reference weight corresponding to the first word vector, and the first weight is a target weight corresponding to the first word vector; A weighted calculation is performed based on the multiple word vectors and the target weight corresponding to each word vector in the multiple word vectors to obtain the first target vector information.
4. The method according to any one of claims 1 to 3, characterized in that: The step of inputting the first target vector information into the target large model for calculation to obtain the target answer comprises: Determine a reference text sequence corresponding to the first target vector information by using the target macro model; Performing logical judgment on the reference text sequence to obtain a logical judgment result; Determining the error rate of the reference text sequence based on the logical judgment result; If the error rate is less than or equal to a preset value, correcting the errors in the reference text sequence based on the logic judgment result to obtain the target text sequence; If the error rate is greater than the preset value, re-acquiring the query information of the target user to obtain second query information; The target text sequence corresponding to the second query information is determined.
5. The method according to any one of claims 1 to 3, characterized in that: The step of constructing a large model based on the distribution network infrastructure information to obtain a target large model includes: Determine engineering data based on the distribution network infrastructure information to obtain target engineering data; Preprocessing the target engineering data to obtain a target engineering data set; Get the preset large model; The preset large model is trained and tested based on the target engineering data set to obtain the target large model.
6. The method according to claim 5, characterized in that The method further comprises: Connecting the target large model to the intelligent storage module; The target engineering data set in the target large model is updated through the intelligent storage module.
7. The method according to any one of claims 1 to 3, characterized in that: The constructing of a vector database based on the distribution network infrastructure information to obtain a target vector database includes: Obtain a preset initial vector database; The distribution network infrastructure information is processed in blocks according to preset rules to obtain multiple infrastructure knowledge blocks; Vectorizing the multiple infrastructure knowledge blocks to obtain multiple infrastructure knowledge vectors; one infrastructure knowledge vector corresponds to one infrastructure knowledge block; Creating a vectorized index based on the multiple infrastructure knowledge vectors to obtain multiple vectorized indexes; one vectorized index corresponds to one infrastructure knowledge vector; The plurality of infrastructure knowledge vectors are stored in the initial vector database according to the plurality of vectorized indexes to obtain the target vector database.
8. A question-answering device for a distribution network infrastructure project, characterized in that: Applied to the RAG system, the question-answering device comprises: an acquisition unit and a processing unit; The acquisition unit is used to acquire distribution network infrastructure information; The processing unit is used to construct a vector database based on the distribution network infrastructure information to obtain a target vector database; A large model is constructed based on the distribution network infrastructure information to obtain a target large model; the target vector database and the target large model are both components of the RAG system; Obtaining query information of a target user to obtain first query information; Inputting the first query information into the target vector database for processing to obtain first target vector information; The first target vector information is input into the target large model for calculation to obtain the target answer.
9. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the one or more programs include instructions for executing the steps in the method described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Medical auxiliary question and answer method and system based on knowledge calibration and retrieval enhancement
CN117573843A
Domain knowledge enhanced electric power large model training and dispatching method
CN117592563A
Knowledge question-answering method and system based on large language model
CN117708282A
Text recall method and device, computing equipment and machine readable storage medium
CN117786045A
