Aviation standard question and answer optimization method and system based on atlas and document data
By building a knowledge graph and knowledge base for aviation enterprise standards, combining RAG technology and large-scale intelligent Q&A, the existing system cannot intelligently understand user problems, and realize efficient and accurate standard knowledge retrieval and Q&A services.
Patent Information
- Application Number
- CN202411681795.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-03-14
AI Technical Summary
The existing aviation standard search system cannot intelligently understand the entities and relationships in user problems, resulting in the inaccurate retrieval of standard attribute information and content, and it is difficult to meet the users' needs for efficient interaction through natural language.
The aviation standard question-and-answer optimization method based on graphs and document data is adopted. By constructing a aviation enterprise standard attribute knowledge graph and standard text knowledge base, combining Retrieval-Augmented Generation (RAG) technology and large-model intelligent question-and-answer, we will improve the accuracy and intelligence of standard knowledge retrieval.
It improves the accuracy of retrieval of standard attribute information and content, enhances the system's intelligent Q&A interaction capabilities, provides efficient and convenient standard Q&A services, and improves user interaction experience.
Smart Images

Figure CN119621894A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of natural language processing in the aviation field, and in particular to an aviation standard question-answering optimization method and system based on graph and document data. Background Art
[0002] In the process of management and application of aviation enterprise standards, one of the key needs of users is to ask questions about aviation standards through natural language and interact with the system efficiently. User questions can be mainly divided into two categories. The first category of questions is related to the attribute information of the standard, such as quickly obtaining the attribute information of a certain standard, such as the drafter, implementing unit, referenced standard, replacement standard, and replaced standard. The second category of questions may involve the specific content of the standard, including the query of aviation field terminology, the discussion of aviation professional knowledge, and detailed industry regulations. Most existing standard retrieval systems rely on keyword matching and simple database queries, which cannot fully understand the user's query intent and the structure of the standard, resulting in query results that are often not accurate or comprehensive; it is also difficult to meet the user's needs for efficient interaction through natural language, and the information retrieval efficiency is low. The main problems with existing standard retrieval systems include:
[0003] (1) The existing system mainly retrieves standard attribute information based on traditional databases, which cannot intelligently understand the entities and relationships in user questions, making it difficult to effectively solve complex query problems;
[0004] (2) For questions that may be related to the text of the standard, the retrieval of the standard content relies on keyword matching, which is difficult to handle the complex semantics in long text content. Users must modify the search conditions multiple times to obtain answers that meet their needs;
[0005] (3) Traditional systems lack intelligent question-answering interactions, and users cannot obtain the answers they need through concise natural language expressions, resulting in an unfriendly interactive experience.
[0006] Therefore, it is particularly important to propose a new method to improve the accuracy and intelligence of standard knowledge retrieval and provide users with efficient and convenient standard question-and-answer services. Summary of the invention
[0007] In view of the shortcomings of the prior art, the present invention proposes an aviation standard question and answer optimization method and system based on graph data and document data, which aims to improve the accuracy and intelligence of standard knowledge retrieval through large-model intelligent question and answer by using retrieval-augmented generation (RAG) technology for knowledge graph data and document data, and provide users with efficient and convenient standard question and answer services.
[0008] To achieve the above object, the present invention discloses the following technical solution:
[0009] Specifically, the present invention provides an aviation standard question answering optimization method based on graph and document data, which comprises the following steps:
[0010] S1. Identify user question intent based on the BERT model: Build a BERT pre-training model, annotate user question classification data for fine-tuning training, and use the trained BERT model to identify the intent of natural language questions raised by users, dividing the questions into two categories: standard attribute questions and standard content questions;
[0011] S2. Constructing a knowledge graph of aviation enterprise standard attributes: extracting standard attribute information and supplementing the standard attribute information, converting the supplemented standard attribute information into a knowledge graph and storing it;
[0012] S3. Build a knowledge base of aviation enterprise standard texts: parse standard documents from multiple sources, perform semantic segmentation and vectorization based on document structure, and build a semantic vector database;
[0013] S4, aviation enterprise standard attribute question knowledge recall, specifically including the following sub-steps:
[0014] S41, Entity Extraction and Relation Extraction: Use the trained UIE model to automatically extract entities and relations in user questions;
[0015] S42, Entity linking based on ES hybrid retrieval, for all candidate entities e i Sort and select the top-k entities with the highest scores as the final matching central entities;
[0016] S43, hop-based subgraph construction, using the trained hop-count prediction model to predict the hop count of user questions, recalling and merging subgraphs based on the predicted hop count, merging the multi-hop relationship subgraphs of each central entity into a complete subgraph G final , the final generated subgraph G final Contains all central entities and their related multi-hop relationships, including the following sub-steps:
[0017] S431, hop count prediction: Based on the complexity of the user's question, the hop count of the question is predicted, and the vector representation V of the user's question is generated through the BERT model. Q , and use a linear classifier to predict the number of hops h pred ;
[0018] S432, subgraph recall: Based on the central entity obtained in step S42, assuming that the central entity set is E top-k ={e1,e2,...,e k}, each central entity e i is a key entity in the user's question, from each central entity e i The system starts with 1 hop and gradually expands to h pred Jump, recall related entities and relations, for each central entity e i , the system sequentially searches for the nodes that are 1 hop, 2 hops, and so on. pred The subgraph G1(e i )、G2(e i )...... The formula is as follows:
[0019] G1(e i )={(e i ,r,e j )|distance(e i ,e j )=1}
[0020] G2(e i )={(e i ,r,e j )|distance(e i ,e j )=2} ......
[0022]
[0023] Among them, distance(e i ,e j ) represents the central entity e i Related entities j The hop distance between them;
[0024] S433, subgraph merging: For each central entity e i Expand layer by layer, and the formula of the expanded multi-hop relationship subgraph is:
[0025]
[0026] Merge the multi-hop relationship subgraphs of each central entity into a complete subgraph G final , the final generated subgraph G final Contains all central entities and their associated multi-hop relationships;
[0027] Subgraph G final The specific expressions are as follows:
[0028]
[0029] Among them, Gmulti-hop (e i ) is based on e i is the multi-hop relationship subgraph of the central entity, and k is the total number of central entities screened;
[0030] S44, vector-based relationship pruning, vectorizes the relationship names in the constructed standard attribute knowledge graph, and vectorizes the relationships extracted in the entity extraction and relationship extraction parts, calculates the similarity between the two, retains the triples of the most relevant relationships, filters out noise relationships that are not related to the problem, and simplifies the subgraph, which specifically includes the following sub-steps:
[0031] S441. Vectorization of all relations in the standard attribute knowledge graph: Use the fine-tuned BGE vector model to vectorize the relation names in the standard attribute knowledge graph. First, fine-tune the BGE model with aviation data, construct positive and negative samples in the aviation data, and the fine-tuning formula is:
[0032]
[0033] Among them, θ * represents the best parameter after fine-tuning; x i and i They represent the input and target output in the training data respectively; L() is the loss function, which measures the model output BGE θ (x i ) and y i The difference; N is the total number of training samples; Next, the fine-tuned BGE model is used to generate the semantic vector V(r) of each relationship. For each relationship r, the vectorization formula is:
[0034]
[0035] in, represents the BGE vector model after fine-tuning on the aviation field dataset;
[0036] S442, user question relationship vectorization: the relationship extracted from the entity extraction and relationship extraction parts is vectorized using the same vector model to generate the semantic vector V(r query ), the vectorized formula is:
[0037]
[0038] in, represents the BGE vector model after fine-tuning on the aviation field dataset;
[0039] S443. Similarity calculation of relationship pruning: The semantic similarity between the standard attribute knowledge graph and the user question is calculated by cosine similarity. The similarity calculation formula is as follows:
[0040]
[0041] Among them, V(r query ) is the relation vector extracted from the user question, V(r) is the vector representation of the relation in the standard attribute knowledge graph, · represents the vector inner product, and ||·|| represents the norm of the vector;
[0042] S444, relationship pruning threshold setting: according to the set similarity threshold θ, the similarity of each relationship is screened, such as the similarity sim(V(r query ),V(r)) is higher than the threshold, the relationship is considered to be closely related to the user's question and is retained; otherwise, the relationship is pruned; the pruning rule formula is as follows:
[0043]
[0044] Among them, keep(r) indicates whether to keep the relationship, 1 means keep, 0 means cut; 1 {·} It is an indicator function: it returns 1 if the condition is true, otherwise it returns 0;
[0045] S445, generation of pruned subgraph: similarity calculation and screening of all relations in the subgraph one by one. After pruning irrelevant relations, the pruned subgraph G is obtained. pruned :
[0046]
[0047] Among them, G pruned is the subgraph after pruning, keep(r)=1 means that the triples are retained, e i ,r,e j The final generated subgraph G final All triples in ;
[0048] S45, convert the subgraph into natural language and construct a Cypher statement;
[0049] S5. The recall results of the aviation enterprise standard content issues were obtained;
[0050] S6. Based on the recalled content, intelligent question and answer are performed on the pre-trained general large model through retrieval enhancement generation technology: the recall results obtained in steps S4 and S5 are input into the pre-trained large language model together with the user's original question through retrieval enhancement generation technology as a knowledge reference to assist in generating answers.
[0051] Preferably, step S5 specifically includes the following sub-steps:
[0052] S51, problem vectorization, the vectorization process is as follows:
[0053]
[0054] Among them, V(Q) is the vector representation of the user's question, and Q is the user's question; represents the BGE vector model after fine-tuning on the aviation field dataset;
[0055] S52: After the hybrid search, all chunks are sorted based on the hybrid search scores, and the top-q chunks with the highest scores are selected as the most relevant content. The formula is as follows:
[0056] {c1,c2,...,c q}=Top_q(score final (c1),score final (c2),...,score final (c N ));
[0057] In step S52, the most relevant top-q chunks are found from the ES library by hybrid retrieval of keywords and vectors, which specifically includes the following sub-steps:
[0058] S521, keyword search score: Based on the keywords in the question, the system performs keyword matching on the following fields in the ES library: standard document name, standard document number, paragraph title, and paragraph content. For each chunk, the keyword matching score is calculated using the BM25 algorithm, and the formula is as follows:
[0059]
[0060] Among them, name(c i ) is chunk c i The standard document name, bzh(c i ) is chunk c i The standard document number, title(c i ) is chunk c i The paragraph title, content(c i ) is chunk c i The paragraph content, s (·) is the score of the keyword matching algorithm. BM25 is the score obtained by using the BM25 algorithm. n , γ b , γ t, γ c The weights of these four fields respectively;
[0061] S522, vector retrieval score: based on the question vector V(Q) and the paragraph content vector V(c i ) to perform semantic similarity retrieval, and use cosine similarity to calculate the vector similarity between the question and the chunk content. semantic (c i ) represents the semantic similarity score, and the formula is as follows:
[0062]
[0063] S523, hybrid search score: The keyword matching score and the vector matching score are weightedly combined to generate the final score of each chunk. The formula of the hybrid search score is as follows:
[0064] score final (c i )=α·score keyword (c i )+(1-α)·score semantic (c i )
[0065] Among them, α is the weight of the keyword matching score, and 1-α is the weight of the vector similarity score. The range of α should be between [0,1];
[0066] S524. Output the Top-q search results: Sort all chunks according to the mixed scores, and select the top-q chunks with the highest scores as the most relevant content, which will be used for knowledge recall of RAG technology in large-model intelligent question answering. The formula is as follows:
[0067] {c1,c2,...,c q}=Top_q(score final (c1),score final (c2),...,score final (c N )).
[0068] Preferably, step S3 specifically includes the following sub-steps:
[0069] S31. Data segmentation: After parsing the standard document, the data is segmented using the third-level heading as the smallest unit. Each third-level heading and all the contents contained therein are spliced into a complete chunk, and each generated chunk is screened. The screening rules include: length control screening and semantic density screening;
[0070] S32. Build a vector semantic library: After the chunking is completed, each chunk is vectorized through a semantic vector model to form a semantic vector library for retrieval.
[0071] Preferably, step S32 specifically includes the following sub-steps:
[0072] S321. Select the fine-tuned Chinese semantic vector model BGE model as the embedding model, and fine-tune the model through the corpus containing aviation field terminology and standard quality literature, the corpus includes aviation encyclopedia, scientific research reports and literature in the field of standard quality;
[0073] S322. Use the fine-tuned model to vectorize each chunk. For model fine-tuning, after constructing positive samples and negative samples in the aviation field data, the fine-tuning formula is:
[0074]
[0075] Among them, θ * represents the best parameter after fine-tuning; x i and i They represent the input and target output in the training data respectively; L() is the loss function, which measures the model output BGE θ (x i ) and y i The difference; N is the total number of training samples; Next, use the fine-tuned BGE model to transform each chunk C i Convert to a fixed-length vector representation V(C i ), which contains the semantic information of the chunk and is expressed as:
[0076]
[0077] in, represents the BGE vector model after fine-tuning on the aviation field dataset;
[0078] S323, store the information of each chunk in the Elasticsearch (ES) library. The field design of the ES library includes: standard document name, standard document number, paragraph title, paragraph content, and the semantic representation V (C i ).
[0079] Preferably, the entity extraction and relationship extraction in step S41 specifically include the following sub-steps:
[0080] S411. Build and annotate a data set for model training. Each data sample consists of a user question and corresponding entity labels and relationship labels. During annotation, each key entity and relationship in the question is marked as a specific category.
[0081] S412. Based on the labeled data set, the UIE model is used to train the entity extraction task. During the training process, the model gradually learns how to identify and classify the correct entities from natural language questions through self-supervised learning.
[0082] S413. The trained UIE model is directly applied to the user's questions. When the user inputs a question, the model automatically identifies the entities and relations in the sentence and outputs their categories.
[0083] Preferably, step S1 specifically includes the following sub-steps:
[0084] S11. Use the BERT pre-trained model to classify questions. The calculation formula is as follows:
[0085] For the input sentence X=(x1,x2,...,x n ), BERT will convert it into a fixed-length word vector representation H = (h1,h2,...,h n ), the classification task is to add a classification head in the last layer and convert the first vector h marked [CLS] [CLS] Input into the fully connected layer to generate classification scores:
[0086] y=softmax(W·h [CLS] +b)
[0087] Among them, W and b are trainable parameters, and the softmax function converts the score into the probability of each category;
[0088] S12. Classify and collect the question data to complete data annotation, clean and deduplicate the annotated question data, and convert it into the input format required by BERT, including word segmentation and word vector encoding of the vocabulary;
[0089] S13. Use the labeled data to train the BERT pre-trained model;
[0090] Based on the pre-trained BERT, fine-tune the training using labeled question classification data, and use the cross entropy loss function to optimize the classifier parameters:
[0091]
[0092] Where N is the total number of samples, y i is the true label, Predict probabilities for the model.
[0093] Preferably, step S2 specifically includes the following sub-steps:
[0094] S21. Extract standard attribute information: parse each aviation enterprise standard document, convert the text content in the document into processable structured data, extract the title, paragraph and table according to the format specification of the standard document to obtain the parsed text unit, write an extraction script, and automatically extract the information related to the standard attributes. The extracted standard attribute information includes: the Chinese name of the standard, the foreign name of the standard, the standard number, the standard type, the release date, the implementation date, the drafter, the proposing unit and the approving unit;
[0095] S22. Supplement the standard attribute information, the supplementary information including the employee number, unit nickname and standard classification number;
[0096] S23. Construct the knowledge graph of aviation enterprise standard attributes. The knowledge graph of aviation enterprise standard attributes includes the following four entities: standard, personnel, unit and year; the relationship between the four entities includes ten relationship types: draft, approve, propose, edit, own, cite, replace, fbnf, ssnf and ryssdw;
[0097] S24. The constructed standard attribute knowledge graph will be stored in the neo4j database.
[0098] Preferably, step S42 specifically includes the following sub-steps:
[0099] S421. Use the fine-tuned BGE vector model to perform semantic vectorization on each entity of the standard attribute knowledge graph. i , the BGE vector model generates a fixed-length vector representation V(e i ), the specific process is as follows:
[0100]
[0101] in, represents the BGE vector model after fine-tuning on the aviation field dataset;
[0102] S422. Store the vectorized entity name and its vector representation in the ES library. Each entity contains the following fields: entity name name (e i ), entity category type(e i ) and the vector V(e i ), the storage structure of each entity is:
[0103] entity_structure = {name(e i ),type(e i ),V(e i )};
[0104] S423, perform hybrid search based on keywords and vectors, and search all candidate entities based on the hybrid search scores. i Sorting is performed and the top-k entities with the highest scores are selected as the final matching central entities for subsequent subgraph recall.
[0105] Preferably, step S423 specifically includes the following sub-steps:
[0106] S4231. Calculate the keyword search score in the ES database and score the keyword matching degree of the candidate entity name. The keyword search score formula is as follows:
[0107] score keyword (e i )=BM25(e query ,name(e i ))
[0108] Among them, e query is the entity extracted from the user's question, name(e i ) is the entity e in the ES library i The name of BM25 is used to calculate the keyword matching score;
[0109] The calculation formula of BM25 score is as follows:
[0110]
[0111] Among them, t is the term in the query entity, f(t,name(e i )) is the frequency of the term in the entity name, k1 and b are the hyperparameters of BM25, avgdl is the average length of the entity name, and IDF(t) is the inverse document frequency of the term;
[0112] S4232, query entity e generated based on BGE model query The vector representation V(e query ), perform vector retrieval scoring in the ES library. The similarity of vector retrieval is performed by calculating the cosine similarity between the query vector and the entity vector in the ES library;
[0113] The vector retrieval score formula is:
[0114]
[0115] Among them, j represents the element index in the vector, which is used to traverse each component in the vector; n represents the vector V(e query ) and V(e i ) dimension; v represents V(e query ) weight, v j V(e query) is the jth component of V(e query )’s jth element; u represents V(e i ) separation, u j V(e i ) is the jth component of V(e i )’s j-th element;
[0116] S4233. Use a weighted formula to combine the two search methods to perform a hybrid search score. The final hybrid search score is shown in the following formula:
[0117] score final (e i )=α·score keyword (e i )+(1-α)·score vector (e i )
[0118] Among them, α is the weight of the keyword matching score, 1-α is the weight of the vector similarity score, and the range of α is between [0,1];
[0119] S4234, based on the hybrid retrieval score, all candidate entities e i Sort and select the top-k entities with the highest scores as the final matching central entities for subsequent subgraph construction. The formula is expressed as:
[0120] {e1,e2,...,e k}=Top_k(score final (e1),score final (e2),...,score final (e N )).
[0121] On the other hand, the present invention also proposes a knowledge-enhanced aviation enterprise standard intelligent question-answering system, which includes a user question intention recognition unit, an aviation enterprise standard attribute knowledge graph construction unit, an aviation enterprise standard text knowledge base construction unit, an aviation enterprise standard attribute question knowledge recall unit, an aviation enterprise standard content question recall unit and an answer generation unit;
[0122] The user question intention recognition unit is used to recognize the user question intention based on the BERT model; the aviation enterprise standard attribute knowledge graph construction unit is used to construct the aviation enterprise standard attribute knowledge graph; the aviation enterprise standard text knowledge base construction unit is used to construct the aviation enterprise standard text knowledge base; the aviation enterprise standard attribute type question knowledge recall unit is used to recall the aviation enterprise standard attribute type question knowledge; the aviation enterprise standard content type question recall unit is used to recall the aviation enterprise standard content type question knowledge; the answer generation unit is used to use RAG technology to perform large-model intelligent question and answer, and input the recall results into the pre-trained large model together with the user's original question through retrieval enhancement generation technology as a knowledge reference to assist in generating answers.
[0123] Compared with the prior art, the present invention has the following beneficial effects:
[0124] (1) The method and system of the present invention solve the problem that the entities and relationships in user questions cannot be intelligently understood in the existing standard attribute information retrieval process by constructing a knowledge graph of aviation enterprise standards and using RAG technology based on the knowledge graph, thereby improving the accuracy and efficiency of standard attribute information question and answer.
[0125] (2) The method and system of the present invention solve the problem of insufficient complex semantic processing capabilities of long texts in standard content retrieval by introducing RAG technology based on document data, allowing users to ask questions in natural language and obtain accurate answers that meet their needs.
[0126] (3) The method and system of the present invention solve the problem of the lack of intelligent question-answering interaction in traditional systems through user intention recognition technology combined with RAG technology for graph data and document data, enhance the user's interactive experience in intelligent question-answering of aviation enterprise standards, and realize efficient and natural standard knowledge question-answering services. BRIEF DESCRIPTION OF THE DRAWINGS
[0127] Figure 1 is a flow chart of the overall method of the present invention;
[0128] Figure 2 It is a schematic diagram of the specific operation process of the present invention;
[0129] Figure 3 It is a schematic block diagram of the structure of the present invention. DETAILED DESCRIPTION
[0130] The exemplary embodiments, features and aspects of the present invention will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.
[0131] The present invention provides an aviation standard question-answering optimization method based on graph data and document data, such as Figure 1-Figure 2 As shown, it includes the following steps:
[0132] S1. User question intention recognition method based on BERT model:
[0133] The user's questions are classified through the intent recognition model BERT, and the user's questions are automatically classified into standard attribute questions and standard content questions. For different types of questions, the system will adopt different processing procedures. Through intelligent intent recognition, the system can quickly respond to user needs and provide more targeted answers, greatly improving the system's interactive experience and answer accuracy. This step specifically includes the following sub-steps: S11, use the BERT pre-trained model to classify questions:
[0134] BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained deep bidirectional transformer model that can capture the semantic relationship between the context in a sentence by performing unsupervised pre-training on a large-scale corpus, and is suitable for natural language classification tasks. In the present invention, BERT is used for question classification, and the calculation formula for question classification is as follows:
[0135] For the input sentence X=(x1,x2,...,x n ), BERT will convert it into a fixed-length word vector representation H = (h1,h2,...,h n ). The classification task is accomplished by adding a classification head to the last layer and converting the first vector h labeled [CLS] [CLS] Input into the fully connected layer to generate classification scores:
[0136] y=softmax(W·h [CLS] +b),
[0137] Among them, W and b are trainable parameters, and the softmax function converts the score into the probability of each category.
[0138] S12. Intent recognition model data annotation:
[0139] In order to train a BERT-based classifier, user questions need to be annotated. Perform the following annotation steps:
[0140] Category classification. User questions are divided into two categories, namely, standard attribute questions (including questions related to the drafter, implementing unit, referenced standards, replacement standards, replaced standards, etc. of a certain standard); standard content questions (involving term explanations, industry knowledge, specific clauses, detailed regulations, etc. that may appear in the standard text).
[0141] Data collection: A large number of question samples are extracted from historical query logs and simulated user interactions. Each question sample is manually annotated as a standard attribute class or a standard content class according to its content. The annotated samples are as follows: attribute class questions: "What is the drafting unit of the QAVICXXXX standard?", "Who are the drafters of the QAVICXXXX standard?"; content class questions: "What is the scope of application of the QAVICXXXX standard?", "What is the maintainability allocation?". After that, data preprocessing is performed to clean the annotated question data, remove duplicates, and convert it into the input format required by BERT, including word segmentation and word vector encoding of vocabulary.
[0142] S13, Intent recognition model training:
[0143] Based on the pre-trained BERT, fine-tuning training is performed using labeled question classification data. In terms of loss function, the cross entropy loss function is used to optimize the parameters of the classifier:
[0144]
[0145] Where N is the total number of samples, y i is the true label, The model predicts the probability. In terms of training parameters, the Adam optimizer is used for parameter update, the initial learning rate is set to 1e-5, and the batch size is 16.
[0146] After that, the model is evaluated. The model is evaluated using the validation set, and indicators such as accuracy, recall, and F1 score are calculated to ensure the robustness and accuracy of the classifier in practical applications.
[0147] In the system, the trained intent recognition model is used to recognize the intent of natural language questions raised by users, and the questions are automatically classified into two categories: standard attribute questions and standard content questions. Different processing procedures are adopted according to the problem classification results, which are described in the knowledge recall method of aviation enterprise standard attribute questions and the processing method of aviation enterprise standard content questions. This classification processing mechanism not only ensures that the system selects the most appropriate retrieval method according to the question type, but also improves the accuracy and generation efficiency of the answer.
[0148] S2. Construction of knowledge graph of aviation enterprise standard attributes: By extracting key attribute information from aviation enterprise standard documents, a knowledge graph is constructed to provide basic data support for answering subsequent standard attribute questions. This method includes four steps: extraction of standard attribute information, supplementation of existing inherent information, construction of graph, and storage of graph.
[0149] S21. Extracting standard attribute information: Aviation enterprise standard documents usually adopt a relatively standardized format, and the location of attribute information of various standards (such as drafter, proposing unit, etc.) in the document has regularity. Based on this, the present invention automatically identifies and extracts the attribute information in these fixed formats by designing an extraction script, which specifically includes the following steps:
[0150] First, parse each aviation enterprise standard document (in PDF, Word, etc. format) and convert the text content in the document into processable structured data. According to the format specifications of the standard document, extract the title, paragraph, table and other text units.
[0151] Secondly, for the parsed text units, write an extraction script to automatically extract information related to standard attributes. The key attribute information extracted includes: standard Chinese name, standard foreign name, standard number, standard type, release date, implementation date, drafter, proposing unit, approving unit, etc.
[0152] S22. Supplementary information:
[0153] In order to enhance the integrity and query effect of the knowledge graph, the present invention also supplements some known information based on automatic extraction. This supplementary information usually includes:
[0154] Personnel ID: Supplement personnel ID information by matching personnel names with the group’s database.
[0155] Unit Aliases: Commonly used alias information is added to each unit to facilitate users to obtain correct unit information when using different names during query.
[0156] Standard classification number: By querying the standard database, the standard classification number is filled in to facilitate the provision of such information to users.
[0157] Other standard related information
[0158] S23. Constructing the knowledge graph of aviation enterprise standard attributes:
[0159] After the standard attribute information is extracted and the inherent information is supplemented, the next step is to convert this information into a knowledge graph structure. The specific graph design is based on the following four types of entities, and their labels and attributes are also listed in the table.
[0160]
[0161]
[0162] Based on the above four types of entities, the following 10 relationship types are designed:
[0163]
[0164] S24. Storing the knowledge graph:
[0165] The constructed standard attribute knowledge graph will be stored in the neo4j database for easy query and call. Through the graph database structure of neo4j, complex queries can be performed efficiently, supporting multi-hop queries and reasoning about entity relationships. The construction of the knowledge graph provides a strong data foundation for the intelligent question-answering system, which can quickly respond to users' standard attribute questions.
[0166] S3. Build a knowledge base of aviation enterprise standard texts:
[0167] By segmenting and vectorizing multi-source standard documents, a semantic vector database is constructed to support the retrieval and answering of standard content questions. The specific steps include the following:
[0168] S31. Data segmentation: In the document processing process, standard documents from multiple sources are segmented into chunks according to specific rules. Each chunk retains as complete contextual semantics as possible and serves as the basic unit of the standard text knowledge base. The specific steps of segmentation are as follows:
[0169] S311. Data source analysis. Standard documents usually exist in different formats (such as Word, PDF, etc.). First, these documents are analyzed and the text content is extracted to form a processable data format.
[0170] S312, block segmentation algorithm. The present invention uses the third-level heading as the smallest unit for data segmentation. That is, each third-level heading and all the contents contained therein (such as paragraphs, tables, etc.) are spliced into a complete chunk to ensure semantic coherence. For documents that cannot be segmented based on the title, an algorithm based on paragraph length and keyword density is used for automatic segmentation.
[0171] S313, block screening. In order to ensure that the chunks in the knowledge base have sufficient value, each generated chunk is screened. The screening rules include: length control, that is, the text length of the chunk is controlled within a reasonable range, too short chunks will be merged, and too long chunks will be split again; semantic density, that is, through keyword density analysis, chunks containing higher information are screened to improve retrieval quality.
[0172] S32. Construction of vector semantic library:
[0173] After the chunking is completed, each chunk is vectorized through the semantic vector model to form a semantic vector library for retrieval. The steps for building the vector semantic library are as follows:
[0174] S321, embedding model selection. Selecting a vector model suitable for semantic understanding is crucial to retrieval performance. The present invention uses a fine-tuned Chinese semantic vector model bge-large-zh-v1.5. The model is fine-tuned and trained with a corpus containing aviation field terms and standard quality documents to optimize the model's performance in standard content retrieval.
[0175] S322, Model fine-tuning: The model is fine-tuned using more than 9,000 pairs of standard-related question-answer pairs. The corpus of question-answer pairs includes aviation encyclopedias, scientific research reports, and literature in the field of standard quality, ensuring that the model can accurately understand standard-related issues and semantics. For model fine-tuning, after constructing positive and negative samples in aviation field data, the fine-tuning formula is:
[0176]
[0177] Among them, θ * represents the best parameter after fine-tuning; x i and i They represent the input and target output in the training data respectively; L() is the loss function, which measures the model output BGE θ (x i ) and y i The difference between the two; N is the total number of training samples.
[0178] S323, vectorization process: The fine-tuned model is used to vectorize each chunk. For each chunk C i , the embedding model converts it into a fixed-length vector representation V(C i ), which contains the semantic information of the chunk and is expressed as:
[0179]
[0180] in, Represents the BGE vector model after fine-tuning on the aviation domain dataset.
[0181] S324, ES library storage: The information of each chunk is stored in the Elasticsearch (ES) library. The field design of the ES library includes: standard document name (corresponding to the standard document name to which the chunk belongs); standard document number (corresponding to the standard number of the standard document to which the chunk belongs); paragraph title (paragraph title information of the chunk); paragraph content (the actual text content of the chunk); paragraph content vector (the semantic representation V (C) of the chunk after vectorization); i )).
[0182] S4. Knowledge recall method for standard attribute questions of aviation enterprises: The processing process is divided into five main steps: entity extraction and relationship extraction, entity linking based on ES, subgraph construction based on hop count, relationship pruning based on vectors, and Cypher statement construction. If the user question is classified as a standard attribute question through the intent recognition model, this process is used for recall processing, which specifically includes the following sub-steps:
[0183] S41, Entity Extraction and Relation Extraction: First, use the trained UIE (Unified Information Extraction) model to automatically extract entities and relations in user questions. The UIE model is a unified framework based on information extraction tasks and can handle multiple information extraction tasks at the same time. The specific steps are as follows:
[0184] S411. Construct and annotate a data set for model training. Each data sample consists of a user question and corresponding entity labels and relationship labels. When annotating, each key entity and relationship in the question is marked as a specific category; for example, in the user question "What is the drafting unit of the QAVICXXXX standard?", the entity is "QAVICXXXX" (category: standard) and the relationship is "drafting unit" (category: relationship); in "What standard did XXX draft?", the entity is "XXX" (category: person) and the relationship is "drafted" (category: relationship).
[0185] S412. Based on the labeled data set, the UIE model is used to train the entity extraction task. During the training process, the model gradually learns how to identify and classify the correct entities from natural language questions through self-supervised learning.
[0186] S413. The trained UIE model is directly applied to the user's questions. When the user enters a question, the model automatically identifies the entities and relations in the sentence and outputs their categories. For example, for the question "Which unit drafted the standard GB 12345?", the model will identify "standard GB 12345" as the "standard" entity and "drafting" as the "relationship".
[0187] S42, ES-based entity linking, which includes the following sub-steps:
[0188] S421, use the BGE vector model to perform semantic vectorization on each entity of the standard attribute knowledge graph. For each entity e i , the BGE vector model generates a fixed-length vector representation V(e i ), the specific process is as follows:
[0189]
[0190] in, Represents the BGE vector model after fine-tuning on the aviation domain dataset.
[0191] S422. Store the vectorized entity name and its vector representation in the ES library. Each entity contains the following fields: entity name name (e i ), entity category type(e i ) and the vector V(e i ), the storage structure of each entity is:
[0192] entity_structure = {name(e i ),type(e i ),V(e i )}.
[0193] Entity names include "GB 12345"; entity categories include standard, person, unit; vectors are semantic vectors generated by the BGE model.
[0194] S423, perform a hybrid search on keywords and vectors, and based on the hybrid search scores, search all candidate entities e i Sorting is performed and the top-k entities with the highest scores are selected as the final matching results. Through the hybrid retrieval method of keywords and vectors, the system can find the entity that best matches the entity in the user's question from the ES library. The specific steps include the following:
[0195] S4231. Perform keyword search and scoring in the ES database to find candidate entities whose names contain the keyword. The scoring formula for keyword search is as follows:
[0196] score keyword (e i )=BM25(e query ,name(e i ))
[0197] Among them, e query is the entity extracted from the user's question, name(e i ) is the entity e in the ES libraryi The name of BM25 is used to calculate the keyword matching score;
[0198] The calculation formula of BM25 score is as follows:
[0199]
[0200] Among them, t is the term in the query entity, f(t,name(e i )) is the frequency of the term in the entity name, k1 and b are the hyperparameters of BM25, avgdl is the average length of the entity name, and IDF(t) is the inverse document frequency of the term.
[0201] S4232, query entity e generated based on BGE model query The vector representation V(e query ), perform vector retrieval scoring in the ES library. The similarity of vector retrieval is performed by calculating the cosine similarity between the query vector and the entity vector in the ES library. The vector retrieval scoring formula is:
[0202]
[0203] S4232, the scores of keyword search and vector search respectively reflect the performance of the entity in keyword matching and semantic similarity. In order to combine the scores of the two, a weighted formula is used to combine the two search methods for hybrid search scoring. The final hybrid search score is shown in the following formula:
[0204] score final (e i )=α·score keyword (e i )+(1-α)·score vector (e i )
[0205] Among them, α is the weight of the keyword matching score, 1-α is the weight of the vector similarity score, and the range of α is between [0,1].
[0206] S4233, according to the mixed retrieval score, all candidate entities e i Sort and select the top-k entities with the highest scores as the final matching results. The formula is expressed as:
[0207] {e1,e2,...,e k}=Top_k(score final (e1),score final (e2),...,score final (e N )).
[0208] S43, hop-based subgraph construction, hop-based prediction, subgraph recall and merging, merging the multi-hop relationship subgraphs of each central entity into a complete subgraph G final , the final generated subgraph G final Contains all central entities and their related multi-hop relationships, which are specifically represented as follows:
[0209]
[0210] Among them, G multi-hop (e i ) is based on e i is the multi-hop relationship subgraph of the central entity, and k is the total number of central entities screened out.
[0211] After the central entities that best match the user's question are retrieved through ES in the previous step, the subgraphs related to these central entities are recalled from the knowledge graph through the subgraph construction method based on the number of hops. The prediction of the number of hops is used to control the retrieval depth of the graph and ensure the compactness and effectiveness of the subgraph. Step S43 specifically includes the following substeps:
[0212] S431. Hop count prediction: The hop count indicates the number of steps required to reach another entity from one entity through the relationship in the graph. For example, "1 hop" indicates that there is a direct relationship between two entities, and "2 hops" indicates that the two entities are connected through an intermediate entity. In order to control the scope of subgraph retrieval, a most suitable hop count h is predicted based on the complexity of the user's question. pred , generate the vector representation V of the user question through the BERT model Q , and use a linear classifier to predict the most likely number of hops. The prediction formula is as follows:
[0213] p(hop)=Softmax(W h ·V Q +b h )
[0214] Among them, W h and b h is the parameter of the classifier, and finally the category with the highest hop probability p(hop) is selected as the predicted hop count h pred .
[0215] S432, subgraph recall: Based on the central entities retrieved by ES in the previous step, assuming that these entities are E top-k ={e1,e2,...,e k}, each entity e i is a key entity in the user's question, from each central entity e i The system starts with 1 hop and gradually expands to h predJump, recall related entities and relations, for each central entity e i The system searches for the nodes that are 1 hop, 2 hops, and so on. pred All relations and entities within a hop are expressed as follows:
[0216] G1(e i )={(e i ,r,e j )|distance(e i ,e j )=1}
[0217] G2(e i )={(e i ,r,e j )|distance(e i ,e j )=2} ......
[0219]
[0220] Among them, distance(e i ,e j ) represents the central entity e i Related entities j The hop distance between them.
[0221] S433, subgraph merging: For each central entity e i , expanding layer by layer, the formula of the expanded multi-hop relationship subgraph is:
[0222]
[0223] Merge the multi-hop relationship subgraphs of each central entity into a complete subgraph G final , the final generated subgraph G final Contains all central entities and their associated multi-hop relationships.
[0224] S44, vector-based relationship pruning, vectorize all possible relationship names in the constructed standard attribute knowledge graph, and vectorize the relationships extracted in the entity extraction and relationship extraction parts, calculate the similarity between the two, retain the most relevant relationships, filter out noise relationships irrelevant to the problem, simplify the subgraph, and the pruned subgraph G pruned It is expressed as follows:
[0225]
[0226] Among them, G pruned is the subgraph after pruning, keep(r)=1 indicates the retained triples, ei ,r,e j The final generated subgraph G final All triples in .
[0227] After constructing the subgraph by the number of hops, a vector-based relationship pruning method is used to screen the relationships in the subgraph by comparing semantic vectors. The specific method is to vectorize all possible relationship names in the constructed standard attribute knowledge graph, and vectorize the relationships extracted in the entity extraction and relationship extraction parts, and calculate the similarity between the two, so as to retain the most relevant relationships, filter out noise relationships that are not related to the problem, and simplify the subgraph. Step S44 specifically includes the following sub-steps:
[0228] S441. Vectorization of all relations in the standard attribute knowledge graph: For all possible relation types in the standard attribute knowledge graph, use the pre-trained model to vectorize these relation names and generate the semantic vector V(r) of each relation. For each relation r, the vectorization formula is:
[0229]
[0230] in, Represents the BGE vector model after fine-tuning on the aviation domain dataset.
[0231] S442, user question relationship vectorization: the relationship extracted from the entity extraction and relationship extraction parts is vectorized using the same vector model to generate the semantic vector V(r query ), the vectorized formula is:
[0232]
[0233] Likewise, Represents the BGE vector model after fine-tuning on the aviation domain dataset.
[0234] For example, if the question is "What is the drafting organization for this standard?", the relation extracted from the question is "Drafting Organization".
[0235] S443, Relationship pruning-similarity calculation: To evaluate the relationship between each relationship r in the standard attribute knowledge graph and the relationship r in the user question query The semantic similarity between standard attribute knowledge graphs is calculated by cosine similarity. The similarity calculation formula is as follows:
[0236]
[0237] Among them, V(r query) is the relationship vector extracted from the user question, V(r) is the vector representation of the relationship in the standard attribute knowledge graph, · represents the vector inner product, and ||·|| represents the norm of the vector; the cosine similarity reflects the semantic similarity between the relationship in the user question and the possible relationship in the standard attribute knowledge graph.
[0238] S444, relationship pruning - pruning threshold setting: According to the set similarity threshold θ, the system screens the similarity of each relationship, such as the similarity sim(V(r query ),V(r)) is higher than the threshold, the relationship is considered to be closely related to the user's question and is retained; otherwise, the relationship is pruned; the pruning rule formula is as follows:
[0239]
[0240] Among them, keep(r) indicates whether to keep the relationship, 1 means keep, 0 means cut; 1 {·} Is an indicator function: it returns 1 if the condition is true, otherwise it returns 0.
[0241] S445, generation of the pruned subgraph: Through the above pruning strategy, the system calculates and screens the similarity of all the relationships in the subgraph one by one. After pruning irrelevant relationships, the subgraph only retains the most relevant part of the relationship in the user's question, thereby streamlining the subgraph and reducing the complexity of subsequent calculations.
[0242] S45. Subgraph conversion to natural language and construction of Cypher statements: The triples in the pruned subgraph that are closely related to the user's question are converted into fluent natural language texts through preset templates, where the triples are entity-relationship-entity. The natural language texts are provided to the big model as knowledge references. In this way, the system can perform more intelligent reasoning and answer generation based on relevant knowledge. In order to convert triples into natural language texts, the system uses preset natural language templates. Different relationship types correspond to different templates. The following are some examples of conversion templates for common relationships:
[0243] For the relationship "Drafter", the template is "Standard e i The drafter is e j .
[0244] For the relation "reference standard", the template is "Standard i Referenced Standard j ”.
[0245] For the relationship "Approval Unit", the template is "Standard i The approval unit is e j ”.
[0246] S5. Recall of aviation enterprise standard content-related questions. When processing aviation enterprise standard content-related questions, a hybrid search technology of keywords and vectors is used, and RAG (Retrieval-Augmented Generation) is combined for question-answer generation. First, the system parses the user's question and performs a hybrid search in the constructed aviation enterprise standard text knowledge base, and finally uses a large model to generate accurate answers. If the user's question is classified as a standard content-related question through the intent recognition model, this process is used for recall processing. It specifically includes the following sub-steps:
[0247] S51, question vectorization. When a user asks a standard content question, the system first parses the question and vectorizes the question using the same embedding model (BGE model) as the standard content library. The vectorization process is as follows:
[0248]
[0249] Among them, V(Q) is the vector representation of the user's question, and Q is the user's question; Represents the BGE vector model after fine-tuning on the aviation domain dataset.
[0250] S52: After the hybrid search, all chunks are sorted based on the hybrid search scores, and the top-q chunks with the highest scores are selected as the most relevant content. The formula is as follows:
[0251] {c1,c2,...,c q}=Top_q(score final (c1),score final (c2),...,score final (c N )).
[0252] In a specific application, in step S52, the most relevant top-q chunks are found from the ES library by hybrid retrieval of keywords and vectors, which specifically includes the following sub-steps:
[0253] S521, keyword search score: Based on the keywords in the question, the system performs keyword matching on the following fields in the ES library: standard document name, standard document number, paragraph title, and paragraph content. For each chunk, the keyword matching score is calculated using the BM25 algorithm, and the formula is as follows:
[0254]
[0255] Among them, name(c i ) is chunk c i The standard document name, bzh(ci ) is chunk c i The standard document number, title(c i ) is chunk c i The paragraph title, content(c i ) is chunk c i The paragraph content, s (·) is the score of the keyword matching algorithm. BM25 is the score obtained by using the BM25 algorithm. n , γ b , γ t , γ c are the weights of these four fields respectively.
[0256] S522, vector retrieval score: based on the question vector V(Q) and the paragraph content vector V(c i ) to perform semantic similarity retrieval, and use cosine similarity to calculate the vector similarity between the question and the chunk content. semantic (c i ) represents the semantic similarity score, and the formula is as follows:
[0257]
[0258] S523, hybrid search score: The keyword matching score and the vector matching score are weightedly combined to generate the final score of each chunk. The formula of the hybrid search score is as follows:
[0259] score final (c i )=α·score keyword (c i )+(1-α)·score semantic (c i )
[0260] Among them, α is the weight of the keyword matching score, and 1-α is the weight of the vector similarity score. The range of α should be between [0,1].
[0261] S524. Output the Top-q search results: Sort all chunks according to the mixed scores, and select the top-q chunks with the highest scores as the most relevant content, which will be used for knowledge recall of RAG technology in large-model intelligent question answering. The formula is as follows:
[0262] {c1,c2,...,c q}=Top_q(score final (c1),score final (c2),...,score final (cN )).
[0263] S6. Based on the recalled content, intelligent question and answer is performed on the pre-trained general large model through retrieval enhancement generation technology: the recall results obtained in step S4 and step S5 are input into the pre-trained large language model together with the user's original question through retrieval enhancement generation technology as a knowledge reference to assist in generating answers. The large voice model can be Tongyi Qianwen Qwen-72B, GLM-4-9B, etc.
[0264] In a specific embodiment of the present invention, based on the Retrieval-Augmented Generation (RAG) technology and in combination with the locally deployed Qwen-72B large language model, prompts for engineering design input are used to maximize the use of reference information of the aviation enterprise standard attribute knowledge graph and the standard text knowledge base, thereby generating accurate answers.
[0265] After the user questions are classified by intent recognition, they are classified into standard attribute questions or standard content questions. For standard attribute questions, the steps in the aviation enterprise standard attribute question knowledge recall method section are used to recall the knowledge base reference knowledge; for standard content questions, the steps in the aviation enterprise standard content question processing method section are used to recall the knowledge base reference knowledge.
[0266] The purpose of prompt engineering is to ensure that the large model can fully understand the user's question and its related context information through carefully designed input prompts. In the present invention, the main task of prompt engineering is to reasonably organize and structure the recalled reference information and user questions to guide the Qwen-72B large language model to generate answers. The prompt words designed in the embodiment of the present invention are as follows:
[0267]
【You are an excellent expert in aviation enterprise standards and are familiar with the terms and contents of various aviation enterprise standards. Please answer my questions in conjunction with the reference information. Please note: do not rely on the reference information. First, the content in the reference information may not be relevant to my question. You can only refer to the part of the information that you think is relevant to the question. Second, please combine your own professional knowledge.
[0268] Reference information:.............
[0269] User question:.............
[0270] Please answer. 】
[0271] According to the prompt engineering design, the system uses the prompt words after integrating the user's questions and the recalled reference knowledge as complete input, and passes it to the Qwen-72B large language model. The large model generates answers based on the input prompts and the reference information through RAG technology. By introducing RAG technology and prompt engineering, the embodiment of the present invention further optimizes the question and answer generation process based on the use of the Qwen-72B large language model, which not only improves the effectiveness of the input prompts, but also strengthens the context understanding ability of the large model when generating answers. Combining the two sources of knowledge, the system can efficiently and accurately handle complex issues of aviation enterprise standards and provide accurate and intelligent answers.
[0272] On the other hand, the present invention also proposes a knowledge-enhanced aviation enterprise standard intelligent question-answering system, such as Figure 3 As shown, it includes a user question intention recognition unit 1, an aviation enterprise standard attribute knowledge graph construction unit 2, an aviation enterprise standard text knowledge base construction unit 3, an aviation enterprise standard attribute type question knowledge recall unit 4, an aviation enterprise standard content type question recall unit 5 and an answer generation unit 6.
[0273] The user question intention recognition unit 1 is used to recognize the user question intention based on the BERT model; the aviation enterprise standard attribute knowledge graph construction unit 2 is used to construct the aviation enterprise standard attribute knowledge graph; the aviation enterprise standard text knowledge base construction unit 3 is used to construct the aviation enterprise standard text knowledge base; the aviation enterprise standard attribute type question knowledge recall unit 4 is used to recall the aviation enterprise standard attribute type question knowledge; the aviation enterprise standard content type question recall unit 5 is used to recall the aviation enterprise standard content type question knowledge; the answer generation unit 6 is used to use RAG technology to perform large-model intelligent question and answer, and input the recall result into the pre-trained large model together with the user's original question through retrieval enhancement generation technology as a knowledge reference to assist in generating answers.
[0274] The embodiments described above are only descriptions of the preferred implementation modes of the present invention, and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.
Claims
1. An aviation standard question answering optimization method based on graph and document data, characterized by: It includes the following sub-steps: S1. Identify user question intent based on the BERT model: Build a BERT pre-training model, annotate user question classification data for fine-tuning training, and use the trained BERT model to identify the intent of natural language questions raised by users, dividing the questions into two categories: standard attribute questions and standard content questions; S2. Constructing a knowledge graph of aviation enterprise standard attributes: extracting standard attribute information and supplementing the standard attribute information, converting the supplemented standard attribute information into a knowledge graph and storing it; S3. Build a knowledge base of aviation enterprise standard texts: parse standard documents from multiple sources, perform semantic segmentation and vectorization based on document structure, and build a semantic vector database; S4, aviation enterprise standard attribute question knowledge recall, specifically including the following sub-steps: S41, entity extraction and relationship extraction: Use the trained UIE model to automatically extract entities and relationships in user questions to obtain candidate entities; S42, Entity linking based on ES hybrid retrieval, for all candidate entities e i Sort and select the top-k entities with the highest scores as the final matching central entities; S43, hop-based subgraph construction, using the trained hop-count prediction model to predict the hop count of user questions, recalling and merging subgraphs based on the predicted hop count, merging the multi-hop relationship subgraphs of each central entity into a complete subgraph G final , the final generated subgraph G final Contains all central entities and their related multi-hop relationships, including the following sub-steps: S431, hop count prediction: Based on the complexity of the user's question, the hop count of the question is predicted, and the vector representation V of the user's question is generated through the BERT model. Q , and use a linear classifier to predict the number of hops h pred ; S432, subgraph recall: Based on the central entity obtained in step S42, assuming that the central entity set is E top-k ={e1, e2, ..., e k }, each central entity e i is a key entity in the user's question. From each central entity e i The system starts with 1 hop and gradually expands to h pred Jump, recall related entities and relations, for each central entity e i , the system searches for the nodes that are 1 hop, 2 hops, etc. from it in turn. pred The subgraph G1(e i )、G2(e i )...... The formula is as follows: G1(and i )={(and i ,re j )|distance(e i ,and j )=1} G2(and i )={(and i ,re j )|distance(e i ,and j )=2} …… Among them, distance(e i , e j ) represents the central entity e i Related entities j The hop distance between them; S433, subgraph merging: For each central entity e i Expand layer by layer, and the formula of the expanded multi-hop relationship subgraph is: Merge the multi-hop relationship subgraphs of each central entity into a complete subgraph G final , the final generated subgraph G final Contains all central entities and their associated multi-hop relationships; Subgraph G final The specific expressions are as follows: Among them, G multi-hop (e i ) is based on e i is the multi-hop relationship subgraph of the central entity, and k is the total number of central entities screened; S44, vector-based relationship pruning, vectorizes the relationship names in the constructed standard attribute knowledge graph, and vectorizes the relationships extracted in the entity extraction and relationship extraction parts, calculates the similarity between the two, retains the triples of the most relevant relationships, filters out noise relationships that are not related to the problem, and simplifies the subgraph, which specifically includes the following sub-steps: S441. Vectorization of all relations in the standard attribute knowledge graph: Use the fine-tuned BGE vector model to vectorize the relation names in the standard attribute knowledge graph. First, fine-tune the BGE model on aviation data, construct positive and negative samples in the aviation data, and the fine-tuning formula is: Among them, θ * represents the best parameter after fine-tuning; x i and i They represent the input and target output in the training data respectively; L() is the loss function, which measures the model output BGE θ (x i ) and y i The difference between ; N is the total number of training samples; The fine-tuned BGE model is used to generate the semantic vector V(r) of each relation. For each relation r, the vectorization formula is: in, represents the BGE vector model after fine-tuning on the aviation field dataset; S442, user question relationship vectorization: the relationship extracted from the entity extraction and relationship extraction parts is vectorized using the same vector model to generate the semantic vector V(r que,y) , the vectorized formula is: in, represents the BGE vector model after fine-tuning on the aviation field dataset; S443. Similarity calculation of relationship pruning: The semantic similarity between the standard attribute knowledge graph and the user question is calculated by cosine similarity. The similarity calculation formula is as follows: Among them, V(r query ) is the relation vector extracted from the user question, V(r) is the vector representation of the relation in the standard attribute knowledge graph, · represents the vector inner product, and ||·|| represents the norm of the vector; S444, relationship pruning: According to the set similarity threshold θ, the similarity of each relationship is screened, such as the similarity sim(V(r query ), V(r)) is higher than the threshold, then the relationship is considered to be closely related to the user's question and is retained; otherwise, the relationship is pruned; the pruning rule formula is as follows: Among them, keep(r) indicates whether to keep the relationship, 1 means keep, 0 means cut; 1 {·} It is an indicator function: it returns 1 if the condition is true, otherwise it returns 0; S445, generation of pruned subgraph: similarity calculation and screening are performed on all relations in the subgraph one by one to obtain the pruned subgraph G pruned : Among them, G pruned is the subgraph after pruning, keep(r)=1 means that the triples are retained, e i ,r,e j is the final generated subgraph G final All triples in ; S45, convert the subgraph into natural language and construct a Cypher statement; S5. Recalls due to issues with aviation enterprise standards content; S6. Based on the recalled content, intelligent question and answer are performed on the pre-trained general large model through retrieval enhancement generation technology: the recall results obtained in steps S4 and S5 are input into the pre-trained large language model together with the user's original question through retrieval enhancement generation technology as a knowledge reference to assist in generating answers.
2. The aviation standard question-answering optimization method based on graph and document data according to claim 1 is characterized by: Step S5 specifically includes the following sub-steps: S51, problem vectorization, the vectorization process is as follows: Among them, V(Q) is the vector representation of the user's question, and Q is the user's question; represents the BGE vector model after fine-tuning on the aviation field dataset; S52. After the hybrid search, all chunks are sorted based on the hybrid search scores, and the top-q chunks with the highest scores are selected as the most relevant content. The formula is as follows: {c1,c2,...,c a }=Top_q(score final (c1),score final (c2),...,score final (c N )); In step S52, the most relevant top-q chunks are found from the ES library by hybrid retrieval of keywords and vectors, which specifically includes the following sub-steps: S521, keyword search score: Based on the keywords in the question, the system performs keyword matching on the following fields in the ES library: standard document name, standard document number, paragraph title, and paragraph content. For each chunk, the keyword matching score is calculated using the BM25 algorithm, and the formula is as follows: Among them, name(c i ) is chunk c i The standard document name, bzh(c i ) is chunk c i The standard document number, title(c i ) is chunk c i The paragraph title, content(c i ) is chunk c i The paragraph content, s (·) is the score of the keyword matching algorithm, BM25 is the score obtained by using the BM25 algorithm, and γ n , γ b , γ t , γ c The weights of these four fields respectively; S522, vector retrieval score: based on the question vector V(Q) and the paragraph content vector V(c i ) to perform semantic similarity retrieval, use cosine similarity to calculate the vector similarity between the question and the chunk content, and use score semantic (c i ) represents the semantic similarity score, and the formula is as follows: S523, hybrid search score: The keyword matching score and the vector matching score are weightedly combined to generate the final score of each chunk. The formula of the hybrid search score is as follows: score final (c i )=a·score keyword (c i )+(1-a)·Score semantic (c i ) Among them, α is the weight of the keyword matching score, 1-α is the weight of the vector similarity score, and the range of α should be between [0, 1]; S524. Output the Top-q search results: Sort all chunks according to the mixed scores, and select the top-q chunks with the highest scores as the most relevant content for the knowledge recall of the RAG technology in the large-model intelligent question answering. The formula is as follows: {c1,c2..,.,c q }=Top_q(score final (c1),score final (c2),...,score final (c N ))。 3. The aviation standard question-answering optimization method based on graph and document data according to claim 1 is characterized by: Step S3 specifically includes the following sub-steps: S31. Data segmentation: After parsing the standard document, the data is segmented using the third-level heading as the smallest unit. Each third-level heading and all the contents contained therein are spliced into a complete chunk, and each generated chunk is screened. The screening rules include: length control screening and semantic density screening; S32. Build a vector semantic library: After the chunking is completed, each chunk is vectorized through a semantic vector model to form a semantic vector library for retrieval.
4. The aviation standard question-answering optimization method based on graph and document data according to claim 2 is characterized by: Step S32 specifically includes the following sub-steps: S321. Select the fine-tuned Chinese semantic vector model BGE model as the embedding model, and fine-tune the model through the corpus containing aviation field terminology and standard quality literature, the corpus includes aviation encyclopedia, scientific research reports and literature in the field of standard quality; S322, use the fine-tuned BGE model to vectorize each chunk, each chunk C i Convert to a fixed-length vector representation V(C i ), which contains the semantic information of the chunk and is expressed as: in, represents the BGE vector model after fine-tuning on the aviation field dataset; S323, store the information of each chunk in the Elasti csearch (ES) library. The field design of the ES library includes: standard document name, standard document number, paragraph title, paragraph content, and the semantic representation V (C i ).
5. The aviation standard question-answering optimization method based on graph and document data according to claim 1 is characterized by: The entity extraction and relationship extraction in step S41 specifically include the following sub-steps: S411. Build and annotate a data set for model training. Each data sample consists of a user question and corresponding entity labels and relationship labels. During the annotation process, each key entity and relationship in the question is marked as a specific category. S412. Based on the labeled data set, the UIE model is used to train the entity extraction task. During the training process, the model gradually learns how to identify and classify the correct entities from natural language questions through self-supervised learning. S413. The trained UIE model is directly applied to the user's questions. When the user inputs a question, the model automatically identifies the entities and relations in the sentence and outputs their categories.
6. The aviation standard question-answering optimization method based on graph and document data according to claim 1 is characterized by: Step S1 specifically includes the following sub-steps: S11. Use the BERT pre-trained model to classify questions. The calculation formula is as follows: For an input sentence X = (x1, x2, ..., x n ), BERT will convert it into a fixed-length word vector representation H = (h1, h2, ..., h n ), the classification task is to add a classification head in the last layer and convert the first vector h marked [CLS] [CLS] Input into the fully connected layer to generate classification scores: y =softmax(W·h [CLS] +b) Among them, W and b are trainable parameters, and the softmax function converts the score into the probability of each category; S12. Classify and collect the question data to complete data annotation, clean and deduplicate the annotated question data, and convert it into the input format required by BERT, including word segmentation and word vector encoding of the vocabulary; S13. Use the labeled data to train the BERT pre-trained model; Based on the pre-trained BERT, fine-tune the training using labeled question classification data, and use the cross entropy loss function to optimize the classifier parameters: Where N is the total number of samples, y i is the true label, Predict probabilities for the model.
7. The aviation standard question-answering optimization method based on graph and document data according to claim 1 is characterized by: Step S2 specifically includes the following sub-steps: S21. Extract standard attribute information: parse each aviation enterprise standard document, convert the text content in the document into processable structured data, extract the title, paragraph and table according to the format specification of the standard document to obtain the parsed text unit, write an extraction script, and automatically extract the information related to the standard attributes. The extracted standard attribute information includes: the Chinese name of the standard, the foreign name of the standard, the standard number, the standard type, the release date, the implementation date, the drafter, the proposing unit and the approving unit; S22. Supplement the standard attribute information, the supplementary information including the employee number, unit nickname and standard classification number; S23. Construct the knowledge graph of aviation enterprise standard attributes. The knowledge graph of aviation enterprise standard attributes includes the following four entities: standard, personnel, unit and year; the relationship between the four entities includes ten relationship types: draft, approve, propose, edit, own, cite, replace, fbnf, ssnf and ryssdw; S24. The constructed standard attribute knowledge graph will be stored in the neo4j database.
8. The aviation standard question-answering optimization method based on graph and document data according to claim 1 is characterized by: Step S42 specifically includes the following sub-steps: S421, use the fine-tuned BGE vector model to perform semantic vectorization on each entity of the standard attribute knowledge graph. For each entity e i , the BGE vector model generates a fixed-length vector representation V(e i ), the specific process is as follows: in, represents the BGE vector model after fine-tuning on the aviation field dataset; S422. Store the vectorized entity name and its vector representation in the ES library. Each entity contains the following fields: entity name (name, vector, and vector representation). i ), entity category type(e i ) and the vector V(e i ), the storage structure of each entity is: entity_structure={name(e i ),type(e i ),V(e i )}; S423, perform hybrid search based on keywords and vectors, and search all candidate entities based on the hybrid search scores. i Sorting is performed and the top-k entities with the highest scores are selected as the final matching central entities for subsequent subgraph recall.
9. The aviation standard question-answering optimization method based on graph and document data according to claim 8, characterized in that: Step S423 specifically includes the following sub-steps: S4231. Calculate the keyword search score in the ES database and score the keyword matching degree of the candidate entity name. The keyword search score formula is as follows: score keyword (e i )=BM25(e query ,name(e i )) Among them, e query is the entity extracted from the user's question, name(e i ) is the entity e in the ES library i The name of BM25 is used to calculate the keyword matching score; The calculation formula of BM25 score is as follows: Among them, t is the term in the query entity, f(t, name(e i )) is the frequency of the term in the entity name, k1 and b are the hyperparameters of BM25, avgdl is the average length of the entity name, and IDF(t) is the inverse document frequency of the term; S4232, query entity e generated based on BGE model query The vector representation V(e query ), perform vector retrieval scoring in the ES library. The similarity of vector retrieval is performed by calculating the cosine similarity between the query vector and the entity vector in the ES library; The vector retrieval score formula is: Among them, j represents the element index in the vector, which is used to traverse each component in the vector; n represents the vector V(e query ) and V(e i ) dimension; V represents V(e query ) weight, v j V(e query ) is the jth component of V(e query )’s jth element; u represents V(e i ) separation, u j represents the jth component of V(ei), namely V(e i )’s j-th element; S4233. Use a weighted formula to combine the two search methods to perform a hybrid search score. The final hybrid search score is shown in the following formula: score final (e i )=α·score keyword (e i )+(1-α)·score vector (e i ) Among them, α is the weight of the keyword matching score, 1-α is the weight of the vector similarity score, and the range of α is between [0, 1]; S4234, based on the hybrid retrieval score, all candidate entities e i Sort and select the top-k entities with the highest scores as the final matching central entities for subsequent subgraph construction. The formula is expressed as: {e1,e2,...,e k }=Top_k(score final (e1),score final (e2),...,score final (e N ))。 10. An intelligent question-answering system for aviation enterprise standards with enhanced knowledge for the aviation standard question-answering optimization method based on graph and document data as claimed in claim 1, characterized in that: It includes a user question intention recognition unit, an aviation enterprise standard attribute knowledge graph construction unit, an aviation enterprise standard text knowledge base construction unit, an aviation enterprise standard attribute type question knowledge recall unit, an aviation enterprise standard content type question recall unit and an answer generation unit; The user question intention recognition unit is used to recognize the user question intention based on the BERT model; the aviation enterprise standard attribute knowledge graph construction unit is used to construct the aviation enterprise standard attribute knowledge graph; the aviation enterprise standard text knowledge base construction unit is used to construct the aviation enterprise standard text knowledge base; the aviation enterprise standard attribute type question knowledge recall unit is used to recall the aviation enterprise standard attribute type question knowledge; the aviation enterprise standard content type question recall unit is used to recall the aviation enterprise standard content type question knowledge; the answer generation unit is used to use RAG technology to perform large-model intelligent question and answer, and input the recall results into the pre-trained language large model together with the user's original question through retrieval enhancement generation technology as a knowledge reference to assist in generating answers.
Citation Information
Patent Citations
Government affair service field multi-strategy fusion dialogue method based on knowledge graph
CN116628172A
Knowledge graph generation type question answering method and system based on large language model
CN117033608A
Knowledge graph question-answering method for sub-graph retrieval optimization
CN117149974A
College scientific research management question and answer system combining knowledge graph and large language model
CN117609436A
Government affair intelligent response device and method based on intention recognition and large language model
CN118035419A
Cited By
Aerospace knowledge large model construction method based on progressive knowledge injection and retrieval enhancement generation
CN119808931A
A method for constructing aerospace knowledge large model based on progressive knowledge injection and retrieval enhanced generation
CN119808931B
Domain knowledge supplement and SQL generation optimization method and device based on large model
CN119938891A
Vector matching-based abnormal luggage processing method and system
CN120234407A
Customer service question and answer processing method and device
CN120353902A