A shipping knowledge graph retrieval enhanced large model question and answer method and system
By introducing explicit and implicit feedback mechanisms and knowledge graphs, and combining DeBERTa and conditional random fields for entity recognition and path ranking, the problem of dynamic adaptability and continuous learning of large language models in shipping question answering systems is solved, achieving efficient and interpretable question answering for shipping safety.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DALIAN MARITIME UNIVERSITY
- Filing Date
- 2026-01-15
- Publication Date
- 2026-06-05
AI Technical Summary
Existing large language models in question-answering systems in the shipping field struggle to dynamically adapt to the differentiated needs of different types of questions, fail to effectively integrate the unique topological features and dynamic context of shipping knowledge, and lack a continuous learning mechanism, resulting in difficulty in improving the quality of question-answering.
By introducing explicit and implicit feedback mechanisms, a path orderer that can be continuously evolved is realized by learning user behavior to construct supervision signals. DeBERTa, Linear, and Conditional Random Fields are used for entity recognition, and knowledge graphs are combined for path expansion and ordering. User feedback is used to optimize the path set, and finally, the path is input into a large language model in the form of structured prompts for question answering.
It significantly improves the practicality and interpretability of the question-and-answer system, achieves adaptive intelligent sorting, and dynamically generates professional questions and answers that meet user needs.
Smart Images

Figure CN122152973A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of large language model technology, and in particular to a method and system for enhancing the large model question answering of shipping knowledge graph retrieval. Background Technology
[0002] In recent years, large language models have made groundbreaking progress in the field of natural language processing, and their powerful semantic understanding and generation capabilities have provided a new technological foundation for intelligent question-answering systems. These models, pre-trained on massive general-purpose corpora, can capture complex patterns in language and demonstrate near-human performance in open-domain question-answering tasks. Especially when processing unstructured text, large language models exhibit excellent contextual understanding and generalization capabilities. However, when facing highly specialized vertical domains such as shipping, the limitations of general-purpose large language models gradually become apparent. The shipping field not only contains a large number of professional terms (such as TEU, ETA, etc.), industry standards (such as the SOLAS Convention), and specific entities (such as the IMO numbering system), but its knowledge system also has significant structured characteristics, involving complex relationships between multi-dimensional entities such as ships, ports, and shipping routes. This dual characteristic of specialization and structure makes it difficult for general-purpose language models to directly meet the accuracy and depth requirements of question answering in the shipping field.
[0003] To address the limitations of large language models in processing structured knowledge, existing technologies have proposed knowledge graph-enhanced question-answering schemes. These methods significantly improve the reliability of domain-specific question answering by combining the explicit structured knowledge of knowledge graphs with the implicit semantic understanding of large language models. Typical examples include: the GraftNet model based on graph neural networks, which achieves structure awareness by encoding knowledge subgraphs; the KoPL framework, which employs a procedural reasoning language, enabling the model to generate logically rigorous answers under grammatical constraints; and KILT and other retrieval-generation two-stage systems, which effectively reduce illusion generation through pre-retrieval of knowledge. While these methods have achieved good results in academic benchmark tests, they still have significant shortcomings in practical applications in the shipping field: First, the path generation module typically employs a fixed strategy, making it difficult to dynamically adapt to the differentiated needs of different types of questions, such as route queries and regulatory inquiries; second, existing ranking mechanisms rely excessively on text similarity, failing to effectively integrate the unique topological features of shipping knowledge (such as port hierarchy relationships) and dynamic context; most importantly, the system lacks a continuous learning mechanism, making it unable to optimize the ranking strategy through user feedback, resulting in difficulty in continuously improving question-answering quality when facing typical scenarios such as ambiguous ship call signs and multi-hop path reasoning. These limitations severely restrict the practical value of knowledge graph augmentation methods in the shipping field.
[0004] Therefore, there is a need for a shipping knowledge graph retrieval-enhanced large-scale question-answering method and system. Summary of the Invention
[0005] In view of this, the present invention provides a method and system for enhancing the large-scale question-answering model of shipping knowledge graph retrieval. By introducing explicit and implicit feedback mechanisms, it realizes a continuously evolving path sorter with the ability to "learn as it is used." By learning from real user behavior to construct supervisory signals, it achieves a leap from "static sorting" to "adaptive intelligent sorting," significantly improving the practicality, interpretability, and satisfaction of the question-answering system, and is applicable to the field of shipping safety question answering.
[0006] Therefore, the present invention provides the following technical solution: A shipping knowledge graph retrieval enhancement big model question answering method includes: Perform entity recognition based on user input; Candidate entities are generated based on the entity recognition results; Candidate paths are generated by expanding the paths based on the candidate entities, and the candidate paths are sorted to obtain a set of candidate paths. Provide the candidate path set to users for interaction, and optimize the candidate path set based on user feedback; The optimal path is selected from the optimized candidate path set; the optimal path is input into the large language model in the form of structured prompts, and professional question-and-answer output is generated.
[0007] Furthermore, the entity recognition of the user's input includes: Target entity recognition is achieved through a three-level sequence labeling network structure using DeBERTa, Linear, and Conditional Random Field; The target entities are proper nouns in the shipping industry, including: ship name, port, route, regulatory number, and time.
[0008] Furthermore, the generation of candidate entities based on entity recognition results includes: Construct a static mapping dictionary to map the identified entities to standard entities in the knowledge graph; Extract entity attributes from the knowledge graph: Extract the Chinese name, English name, alias, and abbreviation of each standard entity from the knowledge graph as the basis for mapping; The standard entities matched by the target entity in the mapping dictionary are used as the initial candidate set; For entities that cannot be matched with standard entities, a candidate set and a partial candidate set are generated through inclusion matching retrieval and partial matching retrieval. When the number of entities retrieved by partial matching is greater than the preset number, the semantic relevance scores of the partial candidate set entities and the standard entities are calculated by the DeBERTa model. The preset number of entities with the highest scores are selected and combined with the preliminary candidate set and the included candidate set to construct a candidate set. If the number of entities retrieved by partial matching is less than or equal to the preset number, the partial candidate set is combined with the preliminary candidate set and the included candidate set to construct a candidate set.
[0009] Furthermore, the step of generating candidate paths by expanding paths based on candidate entities includes: Starting with candidate entities, semantically related entity relationship paths are expanded hop by hop; Each hop retains only the top k paths that have the highest semantic similarity to the problem; Stop when the preset maximum number of entries is reached.
[0010] Further, the step of sorting the candidate paths to obtain a candidate path set includes: Calculate the comprehensive score of the candidate paths, sort the candidate paths in descending order based on the comprehensive score, and take the top k paths as the candidate path set; The overall score includes:
[0011] in, , , and For preset weight parameters, satisfy ; The main semantic score; Structural features; Co-occurrence matching factor; For coverage score.
[0012] Furthermore, the main semantic score includes: The user question and candidate path are transformed into semantic vector representations, encoded using the BERT model, and the cosine similarity between them is calculated as the main semantic score.
[0013] The structural features include: extracting graph structural features from candidate paths to construct structural vectors; The graph structure features include: entity category, relationship type, and path length; Construct the co-occurrence matching factor by determining whether the path contains entities or relationships that co-occur with other identified entities in the problem; The coverage score is generated by evaluating whether the path contains all target entities or their aliases in the problem.
[0014] Furthermore, the user feedback includes: explicit feedback and implicit feedback; the explicit feedback includes: The candidate path selected by the user is denoted as and will The sorting weight is set to Set the ranking weight of the remaining candidate paths to 1. ; The user marks that there is no suitable path and provides a new path; the path provided by the user is recorded as the user-selected path. Choose path The sorting weight is set to The ranking weights of all candidate paths that were not selected are set to 1. ; The user rejects all candidate paths, triggering a new round of path expansion, and sets the weight of all candidate paths to [value missing]. ; The implicit feedback: If the user's selection time exceeds the preset time, it is determined that the candidate paths are too similar and do not fully meet the user's needs. This feedback has a weight of [weight missing]. ; If a user rejects all candidate paths more than once, the candidate paths are deemed extremely undesirable to the user. This feedback has a weight of [weight missing]. ; If a user queries similar questions more than once within a preset time period, the candidate path is determined not to fully meet the user's expectations; this feedback weight is [not specified]. ; If a user makes a regular query, the candidate path is determined to match the user's preferences, and this feedback weight is β4.
[0015] Furthermore, the optimization of the candidate path set based on user feedback includes: Build feedback log items:
[0016] Training samples are constructed based on feedback log items, including: For each user interaction sample log, the user's selected path Mark as positive samples; the remaining unselected paths As a negative sample; Path pair Each pair of paths represents a user's choice of paths under a given problem Q. The preference is greater than ; Positive sample parameters are The negative sample parameters are ; Path pairs are used as supervision signals for the ranking learning model to train the path score function.
[0017] A shipping knowledge graph retrieval enhanced large-scale question-answering system includes: The entity recognition module performs entity recognition on user input. The entity linking module generates candidate entities based on the entity recognition results; The candidate path sorting module expands the path based on the candidate entity to generate candidate paths, and sorts the candidate paths to obtain a candidate path set. The path sorting optimization module provides a set of candidate paths to users for interaction and optimizes the set of candidate paths based on user feedback. The question-and-answer generation module selects the optimal path from the optimized candidate path set; it then inputs the optimal path into the large language model in the form of structured prompts and outputs professional question-and-answer output.
[0018] Advantages and positive effects of the present invention: This method implements a question-answering approach for the shipping industry through an integrated design of entity recognition, entity linking, path sorting, and feedback optimization.
[0019] 1) The semantically guided bundle search path extension is introduced, combined with the hop count adaptive control mechanism and the redundancy pruning mechanism, to realize the dynamic generation of candidate paths based on the semantics of the user's question. This overcomes the problems of blind expansion and semantic irrelevance in traditional path generation, and improves path reliability and inference efficiency.
[0020] 2) By introducing multi-dimensional path scoring indicators such as semantic similarity, structural features, context co-occurrence, and entity coverage, path scoring is performed from multiple dimensions, which significantly improves the comprehensiveness of path ranking and the interpretability of results.
[0021] 3) The path selection behavior of users in actual question-and-answer scenarios is transformed into training signals for the ranking model, ranking pairs are constructed, and the path ranking model is continuously optimized through the ranking learning algorithm, forming a self-learning closed loop of "user selection - model learning - performance iteration improvement", which breaks through the limitation of static training and non-evolution of traditional ranking models. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is an example of the architecture diagram of a large-scale question-answering system for enhanced shipping knowledge graph retrieval. Figure 2 The flowchart below shows the enhanced large-scale question-answering method for shipping knowledge graph retrieval in this embodiment. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] This invention provides an enhanced large-scale question-answering method for shipping knowledge graph retrieval, comprising: S1. Perform entity recognition on the user's input; S2. Generate candidate entities based on entity recognition results; S3. Expand the path based on the candidate entities, generate candidate paths, sort the candidate paths, and obtain a set of candidate paths. S4. Provide the candidate path set to the user for interaction, and optimize the candidate path set based on user feedback; S5. Select the optimal path from the optimized candidate path set; input the optimal path into the large language model in the form of structured prompts, and output professional question and answer output.
[0027] A shipping knowledge graph retrieval enhancement big model question answering method includes: S1. Perform entity recognition on the user's input; Entity recognition is achieved using a three-level sequence labeling network structure of DeBERTa, Linear, and Conditional Random Field. The target entities are proper nouns in the shipping field, including: ship name, port, route, regulatory number, and time.
[0028] By decoupling attention and relative position encoding mechanisms to capture entity boundaries and contextual relationships, and by using conditional random field layers to model label sequence dependencies, the recognition accuracy is improved.
[0029] S2. Generate candidate entities based on entity recognition results; To address the characteristics of shipping entities, such as numerous abbreviations, multiple meanings of the same name, and complex aliases, a multi-strategy integrated entity linking strategy is proposed, including: Generate candidate entities: 1) Mapping dictionary matching: Construct a mapping table containing multiple fields such as Chinese name, English name, pinyin, and alias; 2) Fuzzy string matching: Supports partial matching and inclusion matching; Semantic embedding similarity matching: fuzzy candidates are processed by vector calculation using a language model, and the most relevant entities are selected.
[0030] S3. Expand the path based on the candidate entities, generate candidate paths, and sort the candidate paths to obtain a set of candidate paths: 1. A semantically guided multi-hop path expansion algorithm is used to dynamically generate candidate paths: Starting with candidate entities, semantically related entity relationship paths are expanded hop-by-hop. Only the top k paths with high semantic similarity to the question are retained at each hop; the maximum number of hops is automatically determined based on the question structure. This improves computational efficiency; it merges semantically similar paths to avoid propagating duplicate paths.
[0031] 2. Calculate the overall score of the candidate paths: Calculating multi-perspective semantic similarity constructs path semantic matching features from multiple perspectives to more comprehensively measure the relevance between each candidate path and the user's question, including: 1) The user question and candidate path are transformed into semantic vector representations through a pre-trained model; Preferably, the pre-trained model includes BERT or SimCSE.
[0032] 2) Calculate the cosine similarity based on the user's question semantic vector and the candidate path semantic vector, and use it as the main semantic score, denoted as . .
[0033] 3) Extract the graph structure features from the candidate paths, construct structure vectors, and measure the interpretability and knowledge coverage of the paths, denoted as... The graph structure features include: entity category, relationship type, and path length.
[0034] 4) Determine whether the candidate paths contain entities or relationships that co-occur with other identified entities in the problem, consider contextual co-occurrence features, and construct co-occurrence matching factors. .
[0035] 5) Evaluate whether the path contains all target entities or their aliases in the problem, and generate a coverage score. .
[0036] 6) All features are normalized to the [0,1] interval.
[0037] 3. Sort the candidate paths based on the comprehensive score in descending order, and take the top k paths as the candidate path set for the current question answering task.
[0038] 1) Fuse the score vectors from multiple perspectives to construct a comprehensive score for the candidate path. .
[0039] 2) A score-based ranking strategy is adopted for all candidate paths. according to Sort the paths in descending order and select the top k paths as the candidate path set for the current question answering task. .
[0040] S4, Candidate Path Set It provides users with interactive choices, and the explicit and implicit feedback results are used in reverse to train and optimize the path ranking model, thereby realizing the self-learning ranking model evolution.
[0041] 1. Provide the candidate path set to the user for interactive collection of explicit and implicit feedback, including: 1) Provide a set of candidate paths in the user interface, presented in natural language or structured text; 2) Based on explicit user feedback on candidate paths, refine the candidate paths: a. If the user selects the candidate path that best matches the semantics of the problem, then the selected candidate path is denoted as... and will The sorting weight is set to Set the ranking weight of the remaining candidate paths to 1. .
[0042] b. The user marks that there is no suitable path and provides a new path; the path provided by the user is recorded as the user-selected path. Select path sorting weight set to Set the ranking weight of all candidate paths to 1. .
[0043] c. Reject all candidate paths, trigger a new round of path expansion, and set the weight of all candidate paths to [value missing]. .
[0044] 3) Based on user behavior, the system is designed with the following implicit feedback: a. If a user selects a time exceeding the preset time multiple times, it is determined that the candidate paths are too similar and do not fully meet the user's needs. This feedback has a weight of [weight missing]. .
[0045] b. If a user repeatedly rejects all candidate paths, it is determined that the candidate paths are extremely unsuitable for the user's preferences, and this feedback weight is [weight missing]. .
[0046] c. If a user queries similar questions multiple times within a short period, the candidate path is determined not to fully meet the user's expectations; this feedback has a weight of [weight missing]. .
[0047] d. If a user regularly uses this system, the candidate path is determined to be in line with the user's preferences, and this feedback weight is β4.
[0048] 2. Optimize the candidate path set based on explicit and implicit user feedback; 1) Record the current problem Q and sort the candidate path set. and weighting coefficients User selects path and weighting coefficients and four types of implicit feedback weights , , and And generate feedback log items:
[0049] 2) Construct training samples based on feedback log items, including: For each user interaction sample log, the user's selected path Mark as positive samples; the remaining unselected paths As a negative sample.
[0050] The constructed training samples are in the form of path pairs. Each pair of paths represents a user's choice of paths under a given problem Q. The preference is greater than .
[0051] Positive sample parameters are The negative sample parameters are .
[0052] Path pairs are used as supervision signals for the ranking learning model to train the path score function.
[0053] 3) Path ranking model optimization and updating, specifically including: The ranking model adopts a differentiable neural ranking structure and is based on a dual-tower model with multi-feature fusion (dual-input encoding path and problem). The training uses a ranking learning objective function, with the loss function being:
[0054] in, This is a scoring function for paths in the current ranking model, with the goal of making the user-selected path score higher than other paths. Training cycles can be conducted periodically based on sample accumulation, or online learning can be used to update model parameters immediately after each user interaction.
[0055] S5. Input the selected path into the large language model in the form of structured prompts, and output professional question and answer output.
[0056] Large language models, including ChatGPT and GLM.
[0057] The structured prompting guides the large model to generate content based on real knowledge graphs, thereby achieving professional question-and-answer output with structural constraints and semantic richness.
[0058] Structured knowledge hints, including: Starting entity + multi-hop relationship path + target entity, entity attribute summary and reversible path evidence chain.
[0059] This invention also provides a shipping knowledge graph retrieval enhanced large-scale model question answering system, comprising: The entity recognition module performs entity recognition on the user's input. The entity linking module generates candidate entities based on the entity recognition results; The candidate path sorting module expands the path based on the candidate entity, generates candidate paths, sorts the candidate paths, and obtains a set of candidate paths. The path sorting optimization module provides a set of candidate paths to users for interaction and optimizes the set of candidate paths based on user feedback. The question-and-answer generation module selects the optimal path from the optimized candidate path set; it then inputs the optimal path into the large language model in the form of structured prompts and outputs professional question-and-answer output.
[0060] Example A shipping knowledge graph retrieval enhancement big model question answering method includes: S1. Perform entity recognition on the user's input: The entity recognition task is modeled as a typical sequence labeling problem, which involves classifying characters or words in a natural language query sentence one by one to determine whether they are entities of a specific type.
[0061] The BIO annotation scheme is used to label each character or word in the input sequence as the start, interior, or non-entity of a certain type of entity. For example, the sentence "Beijing is the capital of China" is labeled as: .
[0062] 1. Entity recognition is performed using DeBERTa-Linear-Conditional Random Fields to improve the accuracy of entity recognition and ensure fuller utilization of contextual semantic features, including: 1) DeBERTa coding layer: The DeBERTa model is used to model the contextual semantics of the input text because it introduces a decoupled attention mechanism and relative position encoding, which gives it a better ability to model semantic relationships in word sequences.
[0063] The question to be queried is represented as a sequence. In the problem sequence Preset marker symbol for the end. and , to obtain the formatted sequence Format the sequence Inputting the DeBERTa model yields the context representation vector for each character:
[0064] in, It is the first The vector representation of each character in the context.
[0065] 2) Linear mapping layer: A linear transformation is used to map the context vector output by DeBERTa to the entity label space, and the first linear transformation is obtained. The probability distribution of a position across all labels is expressed by the formula:
[0066] in, It is a weight matrix. This is the bias term. This leads to the predicted label set for the sequence:
[0067] in, The dimension is The number of corresponding entity tags.
[0068] 3) Conditional Random Field Decoding Layer: Because there are dependencies between labels in sequence labeling tasks (e.g., an entity cannot start with 'I'), a conditional random field is added to the output layer for decoding to jointly consider the optimality of the overall label sequence.
[0069] For a given label sequence Calculate relative to the input sequence The score is expressed by the formula:
[0070] in, and These are the start and end tags, respectively; Represents the transition matrix. Indicates from the label Transfer to label The score. The linear mapping layer provides the first... Each character is assigned a label. launch fraction .
[0071] Maximize the log-likelihood function of the correctly labeled sequences in the training set:
[0072] in, This represents all possible label sequences.
[0073] During the inference phase, the Viterbi algorithm is used to search for the highest-scoring label sequence:
[0074] S2. Generate candidate entities based on entity recognition results: 1. Generate candidate entities: Create a static mapping dictionary M to directly map mentioned entities to their corresponding entities in the knowledge graph. Considering issues such as entity aliases or abbreviations, extract additional attributes from the knowledge graph, including: Chinese name, English name, alias, and abbreviation.
[0075] The candidate entities matched from the mapping dictionary will be used as the candidate set:
[0076] in, yes The number of candidate entities.
[0077] For entities that cannot be directly matched with the mapping dictionary, string matching retrieval is performed using two matching conditions: inclusion matching and partial matching. When entity satisfy ,and ,but Match by inclusion.
[0078] When entity satisfy:
[0079] And the entity satisfies one of the following conditions:
[0080]
[0081] and ,but Through partial matching. Wherein, Entities in a knowledge graph.
[0082] Add candidate entities generated by the matching retrieval to the candidate set. , yes The number of candidate entities in the dataset.
[0083] Candidate entities generated by partial matching retrieval are placed into the candidate set. , yes The number of candidate entities in the dataset.
[0084] Semantic embedding similarity matching: Candidate entity set generated by partial matching only Semantic embedding similarity matching is performed; when p>3, the DeBERTa model is used to calculate... The three candidate entities with the highest semantic relevance scores to the entities in the knowledge graph are selected and added to the candidate set. .
[0085] when At that time, candidate set
[0086] when At that time, candidate set .
[0087] 2. Resolve entity ambiguity issues arising from the failure to consider contextual semantic information during candidate entity generation through entity disambiguation: 1) Binary Classifier: The question text and candidate entities are concatenated and input into DeBERTa. The output is a binary label, which indicates whether the candidate entity is relevant to the question. The binary classifier identifies the label by optimizing the following loss function:
[0088] in, This indicates whether the i-th candidate entity is the corresponding entity in the problem.
[0089] 2) Knowledge Denoising: Remove some of the same entities from different key information that are associated with other non-shared entities.
[0090] S3. Expand the path based on the candidate entities, generate candidate paths, sort the candidate paths, and obtain a set of candidate paths. 1. Construct a candidate path set: Based on the entity recognition results and entity linking results, the main entity in the user question is determined, denoted as... ; Will Starting from this point, a multi-hop path expansion algorithm based on semantic relevance is executed in the knowledge graph. This algorithm adopts an improved Beam Search approach, which uses a multi-view semantic similarity calculation method to calculate the semantic similarity between the path and the question in each hop. It compares the semantic similarity between different paths and the question, and only retains the top k paths with the highest similarity to enter the next round of expansion in order to control the size of the path space. An adaptive hop count control mechanism is introduced during the path expansion process. The maximum hop count Nmax is dynamically set according to whether the problem contains complex semantic structures such as time and causality, so as to avoid the result being defective due to too few paths or the computation being too large due to too many paths. A redundant path pruning mechanism is employed to calculate the semantic similarity between paths. When the semantic similarity exceeds a preset threshold, the two paths are identified as redundant. Redundant paths are then merged to reduce computational redundancy.
[0091] Generate a set of candidate paths related to the user's question. .
[0092] 2. Calculate semantic similarity features, including: We construct path semantic matching features from multiple perspectives to more comprehensively measure the relevance between each candidate path and the user's question, including: Text semantic feature calculation: The user question and candidate path are transformed into semantic vector representations, encoded using a pre-trained model (such as BERT or SimCSE), and the cosine similarity between them is calculated as the main semantic score. .
[0093] Structural feature analysis: Extract graph structural features such as entity category, relation type, and path length from candidate paths, construct structural vectors, and measure the interpretability and knowledge coverage of the paths, denoted as . .
[0094] Contextual co-occurrence features: Analyze whether the path contains entities or relationships that co-occur with other identified entities in the problem, and construct co-occurrence matching factors. .
[0095] Entity coverage feature: Evaluates whether the path contains all target entities in the problem or their aliases, generating a coverage score. .
[0096] The main semantic score, structure vector, co-occurrence matching factor, and coverage score are all normalized to... The intervals constitute the input feature vector for comprehensive ranking.
[0097] 3. Construct a comprehensive scoring function based on semantic similarity features, and then select a candidate path set based on the candidate path set according to the comprehensive scoring function: The main semantic score, structure vector, co-occurrence matching factor, and coverage score are fused together to form a comprehensive score function for candidate paths:
[0098] in, , , and For preset weight parameters, satisfy .
[0099] The candidate paths are sorted according to their overall scores, and the top k paths are selected as the candidate path set.
[0100] S4. Provide the candidate path set to the user for interaction, and optimize the candidate path set based on user feedback, thereby realizing the evolution of the self-learning ranking model.
[0101] Path ranking is optimized based on explicit and implicit user feedback, enabling continuous learning and dynamic evolution of the path ranking model: 1) Provide a set of candidate paths in the user interface, presented in natural language or structured text; 2) Update the candidate paths based on explicit user feedback: a. If the user selects the candidate path that best matches the semantics of the problem, then the selected candidate path is denoted as... and will The sorting weight is set to Set the ranking weight of the remaining candidate paths to 1. .
[0102] b. The user marks that there is no suitable path and provides a new path; the path provided by the user is recorded as the user-selected path. Select path sorting weight set to Set the ranking weight of all candidate paths to 1. .
[0103] c. Reject all candidate paths, trigger a new round of path expansion, and set the weight of all candidate paths to [value missing]. .
[0104] 3) Update the candidate paths based on implicit user feedback: a. If a user selects a time exceeding the preset time multiple times, it is determined that the candidate paths are too similar and do not fully meet the user's needs. This feedback has a weight of [weight missing]. .
[0105] b. If a user repeatedly rejects all candidate paths, it is determined that the candidate paths are extremely unsuitable for the user's preferences, and this feedback weight is [weight missing]. .
[0106] c. If a user queries similar questions multiple times within a short period, the candidate path is determined not to fully meet the user's expectations; this feedback has a weight of [weight missing]. .
[0107] d. If a user regularly uses this system, the candidate path is determined to be in line with the user's preferences, and this feedback weight is β4.
[0108] 2. Optimize the candidate path set based on explicit and implicit user feedback; 1) Record the current problem Q and sort the candidate path set. and weighting coefficients User selects path and weighting coefficients and four types of implicit feedback weights , , and And generate feedback log items:
[0109] 2) Construct training samples based on feedback log items, including: For each user interaction sample log, the user's selected path Mark as positive samples; the remaining unselected paths As a negative sample.
[0110] The constructed training samples are in the form of path pairs. Each pair of paths represents a user's choice of paths under a given problem Q. The preference is greater than .
[0111] Positive sample parameters are The negative sample parameters are .
[0112] Path pairs are used as supervision signals for the ranking learning model to train the path score function.
[0113] 3) Path ranking model optimization and updating, specifically including: The ranking model adopts a differentiable neural ranking structure and is based on a dual-tower model with multi-feature fusion (dual-input encoding path and problem). The training uses a ranking learning objective function, with the loss function being:
[0114] in, This is a scoring function for paths in the current ranking model, with the goal of making the user-selected path score higher than other paths. Training cycles can be conducted periodically based on sample accumulation, or online learning can be used to update model parameters immediately after each user interaction.
[0115] Training cycles can be conducted periodically based on sample accumulation, or online learning can be used to update model parameters immediately after each user interaction.
[0116] S5. Input the selected path into the large language model in the form of structured prompts, and output professional question and answer output.
[0117] Large language models, including ChatGPT and GLM.
[0118] The structured prompting guides the large model to generate content based on real knowledge graphs, thereby achieving professional question-and-answer output with structural constraints and semantic richness.
[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for enhancing the large-scale question-answering model of shipping knowledge graph retrieval, characterized in that, include: Perform entity recognition based on user input; Candidate entities are generated based on the entity recognition results; Candidate paths are generated by expanding the paths based on the candidate entities, and the candidate paths are sorted to obtain a set of candidate paths. Provide the candidate path set to users for interaction, and optimize the candidate path set based on user feedback; The optimal path is selected from the optimized candidate path set; the optimal path is input into the large language model in the form of structured prompts, and professional question-and-answer output is generated.
2. The method according to claim 1, characterized in that, The entity recognition of user input includes: Target entity recognition is achieved through a three-level sequence labeling network structure using DeBERTa, Linear, and Conditional Random Field; The target entities are proper nouns in the shipping industry, including: ship name, port, route, regulatory number, and time.
3. The method according to claim 1, characterized in that, The generation of candidate entities based on entity recognition results includes: Construct a static mapping dictionary to map the identified entities to standard entities in the knowledge graph; Extract entity attributes from the knowledge graph: Extract the Chinese name, English name, alias, and abbreviation of each standard entity from the knowledge graph as the basis for mapping; The standard entities matched by the target entity in the mapping dictionary are used as the initial candidate set; For entities that cannot be matched with standard entities, a candidate set and a partial candidate set are generated through inclusion matching retrieval and partial matching retrieval. When the number of entities retrieved by partial matching is greater than the preset number, the semantic relevance scores of the partial candidate set entities and the standard entities are calculated by the DeBERTa model. The preset number of entities with the highest scores are selected and combined with the preliminary candidate set and the included candidate set to construct a candidate set. If the number of entities retrieved by partial matching is less than or equal to the preset number, the partial candidate set is combined with the preliminary candidate set and the included candidate set to construct a candidate set.
4. The method according to claim 1, characterized in that, The process of generating candidate paths based on candidate entities includes: Starting with candidate entities, semantically related entity relationship paths are expanded hop by hop; Each hop retains only the top k paths that have the highest semantic similarity to the problem; Stop when the preset maximum number of entries is reached.
5. The method according to claim 4, characterized in that, The process of sorting the candidate paths to obtain a candidate path set includes: Calculate the comprehensive score of the candidate paths, sort the candidate paths in descending order based on the comprehensive score, and take the top k paths as the candidate path set; The overall score includes: in, , , and Preset weight parameters to satisfy ; The main semantic score; Structural features; Co-occurrence matching factor; For coverage score.
6. The method according to claim 5, characterized in that, The main semantic score includes: The user question and candidate path are transformed into semantic vector representations, encoded using the BERT model, and the cosine similarity between them is calculated as the main semantic score. The structural features include: extracting graph structural features from candidate paths to construct structural vectors; The graph structure features include: entity category, relationship type, and path length; Construct the co-occurrence matching factor by determining whether the path contains entities or relationships that co-occur with other identified entities in the problem; The coverage score is generated by evaluating whether the path contains all target entities or their aliases in the problem.
7. The method according to claim 1, characterized in that, The user feedback includes: explicit feedback and implicit feedback; the explicit feedback includes: The candidate path selected by the user is denoted as and will The sorting weight is set to Set the ranking weight of the remaining candidate paths to 1. ; The user marks that there is no suitable path and provides a new path; the path provided by the user is recorded as the user-selected path. Choose path The sorting weight is set to The ranking weights of all candidate paths that were not selected are set to 1. ; The user rejects all candidate paths, triggering a new round of path expansion, and sets the weight of all candidate paths to [value missing]. ; The implicit feedback: If the user's selection time exceeds the preset time, it is determined that the candidate paths are too similar and do not fully meet the user's needs. This feedback has a weight of [weight missing]. ; If a user rejects all candidate paths more than once, the candidate paths are deemed extremely undesirable to the user. This feedback has a weight of [weight missing]. ; If a user queries similar questions more than once within a preset time period, the candidate path is determined not to fully meet the user's expectations; this feedback weight is [not specified]. ; If a user makes a regular query, the candidate path is determined to match the user's preferences, and this feedback weight is β4.
8. The method according to claim 7, characterized in that, The set of candidate paths optimized based on user feedback includes: Build feedback log items: Training samples are constructed based on feedback log items, including: For each user interaction sample log, the user's selected path Mark as positive samples; the remaining unselected paths As a negative sample; Path pair Each pair of paths represents a user's choice of paths under a given problem Q. The preference is greater than ; Positive sample parameters are The negative sample parameters are ; Path pairs are used as supervision signals for the ranking learning model to train the path score function.
9. A shipping knowledge graph retrieval enhanced large-scale model question-answering system, characterized in that, include: The entity recognition module performs entity recognition on user input. The entity linking module generates candidate entities based on the entity recognition results; The candidate path sorting module expands the path based on the candidate entity to generate candidate paths, and sorts the candidate paths to obtain a candidate path set. The path sorting optimization module provides a set of candidate paths to users for interaction and optimizes the set of candidate paths based on user feedback. The question-and-answer generation module selects the optimal path from the optimized candidate path set; it then inputs the optimal path into the large language model in the form of structured prompts and outputs professional question-and-answer output.