Ship equipment maintenance information retrieval method based on large language model
By fine-tuning the instructions and implementing multi-strategy fusion retrieval in the field of ship equipment maintenance using a large language model, the problems of accuracy and completeness in information retrieval in ship equipment maintenance were solved, and deep reasoning and reliable answer generation were achieved.
Patent Information
- Application Number
- CN202511622961.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-07
- Publication Date
- 2026-03-03
AI Technical Summary
Large language models suffer from knowledge illusions and factual errors, lack of deep reasoning capabilities, and limitations of single retrieval methods in the field of ship equipment maintenance, resulting in inaccurate and incomplete information retrieval.
By constructing a knowledge dataset in the field of ship equipment maintenance, instructions are fine-tuned and enhanced with multi-strategy retrieval, including text block vector matching, question-answer pair fuzzy matching, and knowledge graph retrieval, fusion retrieval results are formed. A large-scale model dedicated to ship equipment maintenance is then used for deep understanding and reasoning.
It significantly improves the accuracy of question answering and the reasoning ability for complex questions, suppresses knowledge illusion, increases the recall and precision of information retrieval, and provides reliable answer traceability.
Smart Images

Figure CN121597877A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, and in particular relates to a method for retrieving ship equipment maintenance information based on a large language model. Background Technology
[0002] With the rapid development of large language model technology, its application in question answering systems is becoming increasingly widespread. However, when general large language models are directly applied to fields with high professionalism and high safety requirements, such as ship equipment maintenance, a series of serious problems are exposed: (1) Knowledge illusion and factual errors: General large models lack precise internal knowledge such as ship equipment structure, failure modes, and maintenance procedures. When answering professional questions, they are prone to "fabricating" seemingly reasonable but actually wrong or non-existent information, which is extremely dangerous in actual maintenance work. (2) Lack of deep reasoning ability: Ship equipment failures are often the result of multiple factors coupled together. General models have difficulty understanding complex failure chains, mutual influence between components, and the logical process of troubleshooting, resulting in their answers being superficial and lacking depth. (3) Limitations of the singularity of retrieval augmentation generation (RAG): Existing RAG systems mostly use single vector similarity retrieval. This method is unstable when dealing with professional terms, synonyms, and long-tail complex questions. For example, if a user asks "What should I do if the engine EGT is high?", the document may use "exhaust temperature overheating". A single semantic retrieval may not be able to match effectively. Meanwhile, a single retrieval method cannot verify the consistency of information from different perspectives, easily leading to retrieval omissions or biases, which can then be amplified into illusions by large models. Therefore, there is an urgent need in this field for an intelligent question-answering solution that can deeply integrate domain expertise and ensure the accuracy and completeness of information retrieval from multiple dimensions and methods to overcome the shortcomings of the aforementioned existing technologies. Summary of the Invention
[0003] This application provides a method for retrieving ship equipment maintenance information based on a large language model. Through the deep integration of domain-adaptive fine-tuning and multi-strategy retrieval enhancement, it significantly improves the system's question-answering accuracy, factual reliability, and reasoning ability for complex problems in the field of ship equipment maintenance, fundamentally suppressing the phenomenon of knowledge illusion.
[0004] This application provides a method for retrieving ship equipment maintenance information based on a large language model, comprising: constructing a knowledge dataset for the ship equipment maintenance domain; obtaining a dedicated large model for ship equipment maintenance by fine-tuning the knowledge dataset; wherein, fine-tuning the dataset includes: extracting maintenance questions from the documents in the knowledge dataset and using the corresponding chapter content as the standard answer; constructing complex questions that require multiple contexts to answer; and selecting an open-source basic large language model to fine-tune the knowledge dataset. S1: Segment the documents in the knowledge dataset of ship equipment maintenance, convert the text blocks into vectors, and store them in the vector database; during retrieval, convert the user's question into a vector as well, and return the Top-K most similar text blocks as candidate results by calculating the cosine similarity. S2: Extract high-frequency and key questions and their corresponding question-answer pairs from the text blocks returned by S1 to construct a structured question-answer pair knowledge base; calculate the similarity between the input retrieval information and all questions in the question-answer pair knowledge base, and return the answer texts corresponding to question-answer pairs with similarity exceeding a preset threshold as candidate results; S3: Treat ship equipment components, fault phenomena, and maintenance operations as entities, construct the relationships between entities, and form a knowledge graph containing multi-dimensional relationships between components, faults, and operations. Link entities according to user questions, identify entities involved in the questions, and use graph queries to query other entities and relationship paths that are directly or indirectly connected to these entities in the knowledge graph. Use text descriptions or paragraphs related to the query path as candidate results. The candidate results of S1, S2 and S3 are merged to form a fused search result; the fused search result is input into the large-scale model for ship equipment maintenance to generate the final search result.
[0005] In one implementation, the base model for instruction fine-tuning is Qwen2.5-14B-Instruct, and the parameters for instruction fine-tuning include learning rate, number of training iterations, batch size, training method, LoRA rank, validation set split ratio, Dropout rate, and maximum number of tokens.
[0006] In one implementation, the fusion retrieval mechanism uses inverted fusion scores to combine the three sorted lists formed by S1, S2 and S3 into a comprehensive sort. The result set of the comprehensive sort is input into the large language model along with the user's original question, and the large language model outputs the final retrieval result.
[0007] In one implementation, S1 involves segmenting documents in a knowledge dataset related to ship equipment maintenance, including: S11: Employs a multi-format dedicated parser to extract text and its style information, identifies and labels semantic units such as headings, paragraphs, lists and tables through rules and heuristics, and then constructs a document structure tree with headings as the skeleton based on a hierarchical stack algorithm to form a machine-understandable hierarchical data model. S12: Define strict semantic boundaries to ensure that atomic units are not destroyed, and then implement a hierarchical priority and sliding window merging strategy to generate text blocks; S13: Long content is handled through length verification and forced segmentation. An overlap mechanism is introduced to maintain the contextual coherence between text blocks. Invalid information is removed using a quality filter. A closed-loop optimization is formed through a self-checking verification process for the leading block.
[0008] In one implementation, in S11, a stack data structure is used to simulate the nested hierarchical relationship of the document. The hierarchical stack algorithm traverses the sequence of semantic units. When a title is encountered, the depth of the stack is adjusted according to its level, and the title node is taken as the child node of the current top node of the stack. Subsequent paragraphs and lists will be continuously placed under the title node until a higher-level or same-level title is encountered, thereby opening a new branch and finally obtaining the document structure tree.
[0009] In one implementation, in S12, the sliding window algorithm sequentially traverses the paragraphs and accumulates their content to generate text blocks until the total length approaches a threshold. For each generated text block, a set of descriptive metadata is dynamically generated and attached. The descriptive metadata includes: source file identifier; path of the text block in the document structure tree; parent title chain that directly governs the text block; unique identifier of the text block; and its order within the document.
[0010] In one implementation, in S12, the beginning of the next text block in the sliding window algorithm includes a fixed-length section of content from the end of the previous text block.
[0011] In one implementation, in S12, the hierarchy-first algorithm starts from the leaf nodes of the document structure tree and merges from bottom to top; it prioritizes merging all content under the same parent title into a single text block; if the merged content exceeds a preset size threshold, it then performs finer-grained segmentation based on its subtitles.
[0012] In one implementation, in S2, when calculating the similarity between the input retrieval information and all questions in the question-answer knowledge base, a string fuzzy matching algorithm is used to calculate the similarity between the user's question and all questions in the question-answer knowledge base. The calculation method for lev(s,u) of the similarity between the two strings s and u in the string fuzzy matching algorithm is as follows:
[0013] Where |s| represents the length of string s, s[0] represents the first character of string s, and s[1:] represents the substring from the second character to the end.
[0014] In one implementation, in S3, the LightRag framework is used to process unstructured or structured documents and extract entities and relationships from the text; the Neo4j graph database is used for storage; when the user enters a question, entity links are first established to identify the entities involved in the question; then, the graph query language is used to query the graph database for other entities and relationship paths that are directly or indirectly connected to these entities.
[0015] In the technical solution of this application, a large-scale model specifically for ship equipment maintenance is obtained by fine-tuning the knowledge dataset in the field of ship equipment maintenance, making the large language model "knowledgeable" and reducing the possibility of nonsensical statements from the source; accurate and rich context is provided by the fusion of multiple retrieval strategies, which constrains the output of the large language model from the input; the two work together to form a dual guarantee to suppress illusions.
[0016] Furthermore, S1 in this application converts text blocks into vectors. During retrieval, the user's question is also converted into a vector. By calculating cosine similarity, candidate results are returned, which has the characteristic of capturing broad semantic-level correlations. S2 calculates the similarity between the input retrieval information and all questions in the question-and-answer knowledge base, and then returns candidate results. It has a very high hit rate for standard terms and fixed question-and-answer pairs, and the response is fast. S3 forms a knowledge graph containing multi-dimensional relationships between components, faults, and operations. Graph queries are used to query other entities and relationship paths that are directly or indirectly connected to these entities in the knowledge graph, and then return candidate results. It is more adept at discovering deep logical relationships between entities and fault propagation paths, and solving complex reasoning problems. The integration of the above three aspects ensures that no matter how the user asks the question, the system can find the most relevant information from different dimensions, which greatly improves the recall and precision of the retrieval.
[0017] Furthermore, the introduction of knowledge graphs transforms the system from a mere "document finder" into an "analyst" capable of understanding component relationships and fault chains. Combined with the reasoning capabilities of the fine-tuned model, the system can handle complex problems such as "inferring the most likely cause of failure from phenomena A and B," meaning that this application possesses deep reasoning capabilities through the retrieval process of fusion and interoperability.
[0018] Furthermore, this application can output the source text fragments on which its answer is based by relying on S1, the question-answer pairs matched by relying on S2, and the related knowledge graph paths by relying on S3, providing users with clear answer tracing, strong interpretability, and enhanced credibility of the results. Attached Figure Description
[0019] Figure 1 A flowchart illustrating the ship equipment maintenance information retrieval method based on a large language model provided in Embodiment 1 of this application; Figure 2This is a flowchart illustrating the fine-tuning method for a large-scale model specifically designed for ship equipment maintenance in Embodiment 1 of this application. Figure 3 This is a schematic diagram of the fusion search process in Embodiment 1 of this application. Detailed Implementation
[0020] The present invention will now be described in detail with reference to the accompanying drawings and embodiments. The principles and features of the present invention are described below with reference to the accompanying drawings. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0021] Example 1 Reference Figure 1 and Figure 2 This embodiment provides a method for retrieving ship equipment maintenance information based on a large language model. This method comprises two core components: fine-tuning of a dedicated large-scale model for ship equipment maintenance and multi-strategy fusion retrieval. In summary, the workflow is as follows: After the user inputs a question, a multi-strategy fusion parallel retrieval is first performed to obtain multiple sets of candidate document fragments. Then, these candidate fragments, along with the original question input by the user, are fed into a fine-tuned dedicated large-scale model for ship equipment maintenance for reasoning and integration, ultimately generating a high-quality, reliable answer, such as... Figure 1 As shown.
[0022] Specifically, in the process of constructing a knowledge dataset for the field of ship equipment maintenance, a large-scale model specifically for ship equipment maintenance is obtained by fine-tuning the knowledge dataset with instructions. This fine-tuning includes: extracting maintenance questions from the documents in the knowledge dataset and using the corresponding chapter content as the standard answer; constructing complex questions that require multiple contextual contexts to answer; and selecting an open-source basic language model to fine-tune the knowledge dataset with instructions. S1: Segment the documents in the knowledge dataset of ship equipment maintenance, convert the text blocks into vectors, and store them in the vector database; during retrieval, convert the user's question into a vector as well, and return the Top-K most similar text blocks as candidate results by calculating the cosine similarity. S2: Extract high-frequency and key questions and their corresponding question-answer pairs from the text blocks returned by S1 to construct a structured question-answer pair knowledge base; calculate the similarity between the input retrieval information and all questions in the question-answer pair knowledge base, and return the answer texts corresponding to question-answer pairs with similarity exceeding a preset threshold as candidate results; S3: Treat ship equipment components, fault phenomena, and maintenance operations as entities, construct the relationships between entities, and form a knowledge graph containing multi-dimensional relationships between components, faults, and operations. Link entities according to user questions, identify entities involved in the questions, and use graph queries to query other entities and relationship paths that are directly or indirectly connected to these entities in the knowledge graph. Use text descriptions or paragraphs related to the query path as candidate results. The candidate results of S1, S2 and S3 are merged to form a fused search result; the fused search result is input into the large-scale model for ship equipment maintenance to generate the final search result.
[0023] Compared with the prior art, this embodiment has the following significant advantages: Dual safeguards effectively suppress illusions: Domain-specific fine-tuning enables the model to "understand its domain," reducing the likelihood of nonsensical statements from the outset; multi-strategy RAG provides accurate and rich context, constraining the model's output from the input. These two measures work together to form a dual safeguard against illusions.
[0024] Comprehensive retrieval with significantly improved accuracy: Three retrieval methods complement each other's advantages. S1 (vector matching) excels at capturing broad semantic-level associations.
[0025] S2 (fuzzy matching) has an extremely high hit rate for standard terms and fixed questions and answers, and responds quickly.
[0026] S3 (Knowledge Graph) excels at discovering deep logical relationships between entities and fault propagation paths, solving complex reasoning problems.
[0027] The integration of these three elements ensures that no matter how a user asks a question, the system can find the most relevant information from different dimensions, greatly improving the recall and precision of the search.
[0028] Possessing deep reasoning capabilities: The introduction of knowledge graphs transforms the system from a mere "document finder" into an "analyst" capable of understanding component relationships and fault chains. Combined with the reasoning capabilities of the finely tuned model, the system can handle complex problems such as "given phenomena A and B, what is the most likely cause of the failure?"
[0029] High interpretability: The system can output the source text fragments (from S1), the matching question-answer pairs (from S2), and the relevant knowledge graph paths (from S3) on which its answers are based, providing users with clear answer tracing and enhancing the credibility of the results.
[0030] The process of constructing a knowledge dataset for the field of ship equipment maintenance includes: (a) Data preprocessing: Collect unstructured documents related to ship equipment maintenance, including maintenance manuals, fault analysis reports, component manuals, service bulletins, etc. Clean, deduplicate, and standardize the format of these documents.
[0031] (b) Fine-tuning dataset construction: Transform the preprocessed documents into a dataset suitable for fine-tuning instructions.
[0032] Specifically, this includes: (1) Instruction-answer pairs: extracting common maintenance questions from documents (such as "How to check for cracks in high-pressure turbine blades?") and using the corresponding chapter content as the standard answer. (2) Contextual learning data: constructing complex questions that require combining multiple contexts to answer in order to train the model's comprehensive reasoning ability.
[0033] (c) Model Fine-tuning: An open-source basic large language model, Qwen2.5-14B, was selected. Using the domain dataset constructed above, parameter efficient fine-tuning technology (LoRA) was employed for instruction fine-tuning, resulting in a "dedicated large model for ship equipment maintenance" specializing in this field. This model deeply understands ship equipment terminology, fault logic, and maintenance procedures, such as... Figure 2 As shown.
[0034] In this embodiment, the basic model for instruction fine-tuning is Qwen2.5-14B-Instruct, and the parameters for instruction fine-tuning include learning rate, number of training iterations, batch size, training method, LoRA rank, validation set split ratio, Dropout rate, and maximum number of tokens.
[0035] Combination Figure 3 In S1 of this embodiment, the documents in the knowledge dataset of ship equipment maintenance are segmented, including: S11: Employs a multi-format dedicated parser to extract text and its style information, identifies and labels semantic units such as headings, paragraphs, lists and tables through rules and heuristics, and then constructs a document structure tree with headings as the skeleton based on a hierarchical stack algorithm to form a machine-understandable hierarchical data model. S12: Define strict semantic boundaries to ensure that atomic units are not destroyed, and then implement a hierarchical priority and sliding window merging strategy to generate text blocks; the former aggregates content from bottom to top within the directory structure until a threshold is reached, while the latter provides overlapping streaming segmentation for unstructured documents and embeds metadata containing information such as structural path and parent title into each generated text block. S13: Long content is handled through length verification and forced segmentation. An overlapping mechanism is introduced to maintain the contextual coherence between text blocks. Invalid information is removed using a quality filter. A closed-loop optimization is formed through the verification process of the output block self-check, ensuring that the output text blocks have both semantic integrity and retrieval applicability.
[0036] The above achieves dynamic text segmentation, which facilitates subsequent vector similarity matching.
[0037] In S11 of this embodiment, a stack data structure is used to simulate the nested hierarchical relationship of the document. The hierarchical stack algorithm traverses the sequence of semantic units. When a title is encountered, the depth of the stack is adjusted according to its level, and the title node is taken as the child node of the current top node of the stack. Subsequent paragraphs and lists will be continuously placed under the title node until a higher-level or same-level title is encountered, thereby opening a new branch and finally obtaining the document structure tree.
[0038] In S12 of this embodiment, the sliding window algorithm traverses the paragraphs sequentially and accumulates their content to generate text blocks. Until the total length approaches the threshold; For each generated text block, a set of descriptive metadata is dynamically generated and attached. The descriptive metadata includes: source file identifier; path of the text block in the document structure tree; parent title chain that directly governs the text block; unique identifier of the text block; and its order within the document.
[0039] In this embodiment, in S12, the starting part of the next text block in the sliding window algorithm will include a fixed-length section of content from the end of the previous text block.
[0040] In this embodiment, in S12, the hierarchy priority algorithm starts from the leaf nodes of the document structure tree and merges from bottom to top; it prioritizes merging all content under the same parent title into a text block; if the merged content exceeds a preset size threshold, it then performs finer-grained segmentation based on its subtitles.
[0041] In S2 of this embodiment, a question-answer pair library is constructed: The Easy Dataset data processing tool is used to automatically extract high-frequency, key question-answer pairs from the text blocks formed by Strategy 1, for example, from the FAQ section or generated by a model. A structured question-answer pair knowledge base is then constructed. Fuzzy matching is then performed: When calculating the similarity between the input retrieval information and all questions in the question-answer pair knowledge base, a string fuzzy matching algorithm is used to calculate the similarity between the user's question and all questions in the question-answer knowledge base. The answer text corresponding to question-answer pairs with similarity exceeding a preset threshold is returned as candidate results.
[0042] The similarity lev(s,u) between two strings s and u in the fuzzy string matching algorithm is calculated as follows:
[0043] Where |s| represents the length of string s, s[0] represents the first character of string s, and s[1:] represents the substring from the second character to the end.
[0044] In S3 of this embodiment, the LightRag framework is used to process unstructured or structured documents and extract entities and relationships from the text, identifying ship equipment components (such as "high-pressure compressor" and "fuel pump"), fault phenomena (such as "high vibration value" and "start-up failure"), and maintenance operations (such as "borehole inspection" and "part number replacement"). Then, the relationships between entities are constructed to form a knowledge graph of multi-dimensional relationships such as "component-fault-operation," which is stored using the Neo4j graph database. When a user inputs a question, entity links are first established to identify the entities involved in the question. Then, a graph query language (such as Cypher) is used to query the graph database for other entities and relationship paths directly or indirectly connected to these entities. Text descriptions or paragraphs related to the query path are used as candidate search results.
[0045] This embodiment employs three parallel and complementary retrieval methods and fuses their retrieval results, such as... Figure 3 As shown. Specifically, the fusion retrieval mechanism uses inverted fusion scores to combine the three sorted lists formed by S1, S2 and S3 into a comprehensive sort. The comprehensive sort result set, along with the user's original question, is input into the large language model, which then outputs the final retrieval result.
[0046] The multi-strategy fusion matching refers to combining dynamic text segmentation with vector similarity matching, question-answer pair string fuzzy matching, and knowledge graph-based semantic relationship retrieval methods to form a fusion retrieval mechanism. This fusion retrieval mechanism uses a reciprocal ranking fusion score to combine multiple ranking lists into a single fusion ranking. The result set of this fusion ranking, along with the user's original question, is input into a large-scale model for ship equipment maintenance. Based on its profound domain knowledge and powerful reasoning capabilities, the model understands, identifies, summarizes, and refines multi-source information, ultimately generating an accurate, comprehensive, and reliable answer.
[0047] The present invention will be described in detail below with reference to a preferred embodiment, taking the engine maintenance of ship equipment as an example.
[0048] Data preparation and model fine-tuning phase: More than 500 documents, including engine equipment maintenance manuals and fault isolation manuals, were collected. The text was extracted using document parsing tools, and the data was cleaned.
[0049] Build a fine-tuned dataset: Generate 3,000 high-quality instruction-output pairs using the Easy Dataset dataset build tool and human review, and format them as JSON files.
[0050] Fine-tuning parameters (on local computing resources): learning rate set to 0.0001, training iterations (epochs) to 10, batch size to 8, training method to LoRA, LoRA rank to 8, validation set split ratio to 0.01, dropout rate to 0.05, maximum number of tokens to 32768. The Qwen2.5-14B-Instruct base model was fine-tuned on 4 Nvidia-A100 GPUs to obtain "Engine Equipment Repair Model: Qwen2.5-14B-JC".
[0051] Multi-strategy fusion retrieval stage: S1: Implementation of dynamic text segmentation and vector similarity matching: S11: Document Parsing and Structure Recognition First, a multimodal parser group is employed: For different document formats, specially optimized parser libraries are called. For example, for PDF documents, the PyMuPDF parsing library, which can extract detailed style information such as text coordinates, font size, bold, and italics, is used; for Word documents, its native API or the python-docx parsing library is used to read styles and paragraph structure; for HTML and Markdown documents, the corresponding BeautifulSoup and markdown parsing libraries are used to convert their tags or markup symbols into structural information. Using the style and format information extracted in the previous stage, the text stream is segmented and classified according to a predefined set of rules. Specifically: 1) Headings: Identified by larger font size, bold attribute, number of # symbols in Markdown or "Heading" style in Word, and assigned a hierarchy (such as H1, H2, H3) based on their visual weight or number of symbols.
[0052] 2) Paragraph: Recognized as a continuous block of text separated by newline characters.
[0053] 3) List items: Identified and categorized by bullet points (e.g., -, •), numbering (e.g., 1., (a)), and indentation level.
[0054] 4) Tables: They are recognized as independent semantic units by their unique enclosing symbols (such as Markdown's #####), special alignment, or tags.
[0055] The output of this method is a sequence of semantic units labeled with type and hierarchy attributes.
[0056] Secondly, a stack data structure is used to simulate the nested hierarchical relationship of the document. The algorithm traverses the sequence of semantic units generated in the previous stage. When a title is encountered, the depth of the stack is adjusted according to its level, and the title node is made a child node of the current top node of the stack. Subsequent paragraphs, lists, and other content will be continuously placed under this title node until a higher-level or same-level title is encountered, thus starting a new branch. This transforms the linear text sequence into a tree structure, clearly defining the parent, child, and sibling relationships of each semantic unit. It reproduces the document's table of contents at the data structure level, laying a solid foundation for the intelligent segmentation in the next stage.
[0057] S12: Segmentation Strategy and Block Generation: First, define the method for dividing the boundary. Based on unit type boundary rules, the segmentation operation is explicitly defined and only allowed after specific semantic boundaries. These boundaries include, but are not limited to: the end of any level of heading, the end of a paragraph, the end of an entire list, and the end of a table or code block. This means that a paragraph, a list item, or a code block can never be cut in the middle.
[0058] Secondly, formulate merger strategies and methods. The merging strategy prioritizes hierarchical merging. This is the primary strategy for well-structured documents. The algorithm starts from the leaf nodes of the document's tree structure (the finest-grained paragraphs and list items) and merges from the bottom up. It prioritizes merging all content under the same parent heading (such as an H2 section) into a single text block. If the merged content exceeds a preset size threshold (such as 500 words), it then performs further fine-grained segmentation based on its subheadings (such as H3).
[0059] The merging strategy includes a sliding window merging method. This is an alternative strategy for documents without headings or with unclear structure. The algorithm sequentially traverses paragraphs and accumulates their content until the total length approaches a threshold. At this point, it splits at the end of the current paragraph. To maintain contextual coherence between blocks, an overlap mechanism is introduced: the beginning of the next text block includes a small portion (e.g., 50 words) of the end of the previous text block, effectively preventing information breaks. Finally, for each generated text block, a set of descriptive metadata is dynamically generated and appended. This metadata includes: 1) source_file: Source file identifier.
[0060] 2) structure_path: The path of this block in the document structure tree (e.g., H1->H2->H3->Paragraph).
[0061] 3) parent_headings: The parent header chain that directly governs this block.
[0062] 4) chunk_id and position: unique identifiers of the chunk and its order within the document.
[0063] This allows the metadata to immediately reconstruct the position and context of a text block in the original text, even if the text block is used alone, during subsequent retrieval or analysis.
[0064] S13: Post-processing and optimization: To handle potential anomalies in the earlier stages and further improve overall output quality, despite dynamic segmentation, extremely long content (such as lengthy technical specifications) may still be encountered. This is addressed by setting an absolute maximum length limit (e.g., 1000 words). For blocks exceeding this limit, the system will fall back to a "mild" segmentation mode, such as secondary segmentation based on sentence boundaries or punctuation, ensuring breakage at the end of a complete sentence. This represents a necessary trade-off between ensuring semantic integrity and preventing excessively large blocks.
[0065] Context-aware overlapping generation: When using a sliding window strategy or forced segmentation, this method proactively calculates and extracts a short, coherent segment (such as the last few sentences) from the end of the previous text block and uses it as the starting part of the next text block. This operation is systematic, ensuring that the logical flow across segmentation points is maintained. Through the collaborative work of these three stages, unstructured long text is successfully transformed into a semantically complete, A collection of text blocks that are reasonably sized and rich in contextual metadata.
[0066] Vector similarity matching in S1: After completing the dynamic text segmentation in the previous stage, each text block is converted into a high-dimensional vector using an embedding model (bge-large-zh-v1.5), and the generated vectors and their associated metadata are stored in a dedicated vector database (Weaviate). During retrieval, the user query content is first vectorized using the same embedding model. The similarity score between the question vector and all text block vectors in the vector database is calculated using the cosine similarity formula. Based on the similarity score, the top-k most similar text blocks are returned (K is usually 3-10, adjusted according to the application). The returned text blocks include their content and metadata, which are used for subsequent answer generation or text block tracing.
[0067] Cosine similarity formula:
[0068] in, and It is a vector.
[0069] Implement S2, question-answering fuzzy string matching S21: Question-answering database construction: Using the Easy Dataset data processing tool, the text blocks from Strategy 1 were automatically extracted and manually reviewed to form 500 high-frequency, key "question-answer" pairs, thus constructing a structured question-answer knowledge base.
[0070] For example: Q: What are some common malfunctions of Weichai natural gas engines? A: The following are common faults of Weichai natural gas engines: 1. **Engine cannot start:** This can be caused by a variety of reasons, such as electronic control system failure or fuel supply problems.
[0071] 2. **Difficulty starting the engine:** This manifests as a long starting time or the need for multiple attempts.
[0072] 3. **Automatic engine shutdown**: The engine suddenly shuts off during operation.
[0073] 4. **Insufficient engine power:** The engine feels underpowered, affecting vehicle performance.
[0074] 5. **Unstable engine idling speed:** The engine speed fluctuates significantly and is unstable at idle.
[0075] 6. **Engine backfiring**: Abnormal combustion process, resulting in loud exhaust noise.
[0076] 7. **High engine gas consumption:** Natural gas consumption exceeds the normal range, increasing operating costs.
[0077] These faults cover the main problems that Weichai natural gas engines may encounter during operation.
[0078] S22 Fuzzy Matching: Compared to vector-based retrieval, the main advantage of fuzzy matching lies in its robustness to word variations and grammatical errors. Furthermore, by utilizing keyword matching, fuzzy matching can improve recall for similar questions. Specifically, Levenshtein Distance is used to measure the similarity between two strings, defined as follows:
[0079] Where s and u represent two strings, |s| represents the length of string s, s[0] represents the first character of string s, s[1:] represents the substring from the second character to the end, and lev(s,u) represents the similarity between the two strings s and u.
[0080] Implementing S3: Strategy Three - Semantic Relationship Retrieval Based on Knowledge Graphs: S31 Text Preprocessing: Uses dynamically generated document blocks based on Strategy 1.
[0081] The LightRag framework is used to process unstructured or structured documents and extract entities and relationships from the text. For example, it extracts (high-pressure turbine blade, failure mode, thermal fatigue crack) and (thermal fatigue crack, detection method, borehole inspection). A knowledge graph with 50,000 entities and 80,000 relationships is built using the Neo4j graph database for storage.
[0082] Graph retrieval: When a user enters a question, entity links are first established to identify the entities involved in the question. Then, the graph query language (Cypher) is used to query the graph database for other entities and relationship paths that are directly or indirectly connected to these entities. Text descriptions or paragraphs related to the query paths are then used as candidate search results. Implement a fusion matching mechanism: A fusion retrieval mechanism is generated by combining retrieval methods based on text block vectors, question-answer pair fuzzy matching, and knowledge graph retrieval. This mechanism employs Reciprocal Rank Fusion (RRF) scores to combine three ranking lists—one based on text block vectors, the other on question-answer pair fuzzy matching, and the other on knowledge graph retrieval—into a more comprehensive ranking. Given the ranking lists based on text block vectors, question-answer pair fuzzy matching, and knowledge graph retrieval, the RRF score of element d is calculated as follows:
[0083] in , and rank(d) represents the ranking of element d in the sorted lists of text block vector retrieval results, question-answer pair string fuzzy matching results, and knowledge graph retrieval results, respectively. If element d is not in any of the lists, then rank(d) should be positive infinity. C represents a constant to suppress the influence of lower rankings. rank(d) represents the ranking of element d in the sorted list of a certain type of retrieval or matching result.
[0084] The final calculated RRF(d) result set, along with the user's original question, is input into the ship equipment maintenance model. Based on its profound domain knowledge and powerful reasoning ability, the model understands, identifies, summarizes, and refines multi-source information, ultimately generating an accurate, comprehensive, and reliable answer.
[0085] This embodiment illustrates an application example (taking ship engine maintenance as an example). A user asked: "What could be causing the excessively high EGT (exhaust temperature) when starting the engine? How should I fix it?" Internal system processing flow: Multi-strategy parallel retrieval: S1 (Vector Similarity Matching): Converts the user's question into a vector and retrieves the most relevant text blocks from a vector database. For example: The "Exhaust Gas Temperature Overtemp" section of the "Engine Starter Troubleshooting Manual" provides a detailed description.
[0086] The section on "Abnormal Startup Parameters" in the Quick Reference Guide.
[0087] S2 (Question-Answer Pair String Fuzzy Matching): Using a fuzzy matching algorithm, a highly similar question is found in a pre-defined question-answer database. Q: What should I do if the exhaust temperature is high when starting the engine? A: "Possible causes: 1. Clogged fuel injectors; 2. Insufficient starter motor power; 3. Faulty EGT sensor... Preliminary solutions: Check the ignition system and verify fuel quality..." S3 (Knowledge Graph Semantic Retrieval): Identifies the entities "engine", "EGT", and "start", queries the graph database, and returns a reasoning path: (Engine) -[Has_Fault]-> (EGT High) -[Caused_By]-> (Fuel Injection Problems) -[Related_To]-> (Fuel Injector) -[Maintenance_Action]-> (Hole Probe Inspection / Replacement).
[0088] Search result fusion: The fusion score is calculated using the RRF formula. Assuming the "exhaust temperature overheating" related results rank 1, 1, and 2 respectively among the three strategies, and the constant C=60, the fusion score is: RRF = 1 / (60+1) + 1 / (60+1) + 1 / (60+2) ≈ 0.0328, ranking first, and is used as the core candidate information.
[0089] Assume that the highest-ranking entries are the "Exhaust Temperature Overheating" section in the "Engine Starter Troubleshooting Manual" and the "Fuel Injector" association path provided by the knowledge graph.
[0090] Answer generation and reasoning: The merged TOP search results (as context) and the user's original question are input together into the fine-tuned "Engine Equipment Repair Model: Qwen2.5-14B-JC".
[0091] Based on its deep domain knowledge (obtained through fine-tuning), the model understands that "high EGT" and "exhaust temperature exceeding the limit" are the same concept and performs deep reasoning by integrating multi-source information. Instead of simply listing documents, it generates a structured, professional, and secure answer. [Final Answer] An excessively high EGT during engine start-up is a phenomenon that requires close monitoring and may be caused by one or more of the following reasons: Possible reasons: Fuel system problems: Partial blockage or poor atomization of the fuel injectors leads to incomplete combustion. This is one of the most common causes.
[0092] Ignition system malfunction: Insufficient ignition energy or carbon buildup on the spark plugs can cause ignition delay or misfire.
[0093] Starting system malfunction: The starter motor power is reduced, causing the engine to inject fuel before reaching the specified speed, resulting in fuel-rich combustion.
[0094] False alarm by sensor: The EGT sensor itself is faulty or there is a problem with the signal transmission line, resulting in an incorrect reading.
[0095] Suggested steps: First, refer to Section 5.2 "Exhaust Temperature Overheating Checklist" of the "XX Engine Fault Isolation Manual" to perform a quick check.
[0096] Prioritize troubleshooting: Connect to the engine condition monitoring system and compare with other parameters (such as FF, N2) to confirm whether it is a genuine high temperature. Additionally, it is recommended to perform a borescope inspection on the fuel injectors to confirm their condition.
[0097] Safety Warning: If accompanied by severe vibration or smoke, immediately stop the start-up and contact a senior maintenance engineer to avoid damaging the high-pressure turbine components.
[0098] Source tracing basis: [Click to view relevant chapters of the "Repair Manual"] [Related knowledge graph path] [Matching standard question and answer pairs].
[0099] This example demonstrates that the system ensures the comprehensiveness and accuracy of retrieved information through multi-strategy RAG, and then performs in-depth understanding and intelligent integration of information through a domain-fine-tuned large model. Ultimately, it generates an answer that far surpasses simple keyword matching, possessing professional depth and reliability, effectively suppressing "knowledge illusion," and demonstrating powerful reasoning capabilities for complex problems.
[0100] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.
[0101] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.
Claims
1. A method for retrieving ship equipment maintenance information based on a large language model, characterized in that, The method includes: constructing a knowledge dataset for the field of ship equipment maintenance; obtaining a large-scale model specifically for ship equipment maintenance by fine-tuning the knowledge dataset; wherein, fine-tuning the dataset includes: extracting maintenance questions from the documents in the knowledge dataset and using the corresponding chapter content as the standard answer; constructing complex questions that require multiple contexts to answer; and selecting an open-source basic language model to fine-tune the knowledge dataset. S1: Segment the documents in the knowledge dataset of ship equipment maintenance, convert the text blocks into vectors, and store them in the vector database; during retrieval, convert the user's question into a vector as well, and return the Top-K most similar text blocks as candidate results by calculating the cosine similarity. S2: Extract high-frequency and key questions and their corresponding question-answer pairs from the text blocks returned by S1 to construct a structured question-answer pair knowledge base; calculate the similarity between the input retrieval information and all questions in the question-answer pair knowledge base, and return the answer texts corresponding to question-answer pairs with similarity exceeding a preset threshold as candidate results; S3: Treat ship equipment components, fault phenomena, and maintenance operations as entities, construct the relationships between entities, and form a knowledge graph containing multi-dimensional relationships between components, faults, and operations. Link entities according to user questions, identify entities involved in the questions, and use graph queries to query other entities and relationship paths that are directly or indirectly connected to these entities in the knowledge graph. Use text descriptions or paragraphs related to the query path as candidate results. The candidate results of S1, S2 and S3 are merged to form a fused search result; the fused search result is input into the large-scale model for ship equipment maintenance to generate the final search result.
2. The ship equipment maintenance information retrieval method according to claim 1, characterized in that, The basic model for instruction fine-tuning is Qwen2.5-14B-Instruct. The parameters for instruction fine-tuning include learning rate, number of training iterations, batch size, training method, LoRA rank, validation set split ratio, Dropout rate, and maximum number of tokens.
3. The ship equipment maintenance information retrieval method according to claim 1, characterized in that, The fusion retrieval mechanism uses inverted sorting fusion scores to combine the three sorted lists formed by S1, S2 and S3 into a comprehensive sort. The comprehensive sort result set and the user's original question are input into the large language model, and the large language model outputs the final retrieval results.
4. The ship equipment maintenance information retrieval method according to claim 1, characterized in that, S1 segments the documents in the knowledge dataset for ship equipment maintenance, including: S11: Employs a multi-format dedicated parser to extract text and its style information, identifies and labels semantic units such as headings, paragraphs, lists and tables through rules and heuristics, and then constructs a document structure tree with headings as the skeleton based on a hierarchical stack algorithm to form a machine-understandable hierarchical data model. S12: Define strict semantic boundaries to ensure that atomic units are not destroyed, and then implement a hierarchical priority and sliding window merging strategy to generate text blocks; S13: Long content is handled through length verification and forced segmentation. An overlap mechanism is introduced to maintain the contextual coherence between text blocks. Invalid information is removed using a quality filter. A closed-loop optimization is formed through a self-checking verification process for the leading block.
5. The ship equipment maintenance information retrieval method according to claim 4, characterized in that, In S11, a stack data structure is used to simulate the nested hierarchical relationship of the document. The hierarchical stack algorithm traverses the sequence of semantic units. When a title is encountered, the depth of the stack is adjusted according to its level, and the title node is taken as the child node of the current top node of the stack. Subsequent paragraphs and lists will be continuously placed under the title node until a higher-level or same-level title is encountered, thereby starting a new branch and finally obtaining the document structure tree.
6. The ship equipment maintenance information retrieval method according to claim 5, characterized in that, In S12, the sliding window algorithm traverses the paragraphs sequentially and accumulates their content to generate text blocks until the total length approaches the threshold. For each generated text block, a set of descriptive metadata is dynamically generated and attached. The descriptive metadata includes: source file identifier; path of the text block in the document structure tree; parent title chain that directly governs the text block; unique identifier of the text block; and its order within the document.
7. The ship equipment maintenance information retrieval method according to claim 6, characterized in that, In S12, the beginning of the next text block in the sliding window algorithm will contain a fixed-length section of content from the end of the previous text block.
8. The ship equipment maintenance information retrieval method according to claim 5, characterized in that, In S12, the hierarchy-first algorithm starts from the leaf nodes of the document structure tree and merges from the bottom up; it prioritizes merging all content under the same parent title into a single text block; if the merged content exceeds a preset size threshold, it then performs finer-grained segmentation based on its subtitles.
9. The ship equipment maintenance information retrieval method according to claim 1, characterized in that, In S2, when calculating the similarity between the input retrieval information and all questions in the question-answering knowledge base, a string fuzzy matching algorithm is used to calculate the similarity between the user's question and all questions in the question-answering knowledge base. The calculation method for lev(s,u) of the similarity between the two strings s and u in the string fuzzy matching algorithm is as follows: ; Where |s| represents the length of string s, s[0] represents the first character of string s, and s[1:] represents the substring from the second character to the end.
10. The method for retrieving ship equipment maintenance information according to claim 1, characterized in that, In S3, the LightRag framework is used to process unstructured or structured documents and extract entities and relationships from the text; the Neo4j graph database is used for storage; when a user enters a question, entity links are first established to identify the entities involved in the question; then, the graph query language is used to query the graph database for other entities and relationship paths that are directly or indirectly connected to these entities.