Vehicle maintenance knowledge retrieval enhancement generation method based on organization structure tree
By introducing a combination of organizational structure tree and vector database in vehicle maintenance knowledge retrieval, the accuracy of vehicle maintenance answers generated by large language models is solved, achieving more accurate and richer answer generation, and improving retrieval efficiency and accuracy.
Patent Information
- Application Number
- CN202510076990.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-03-04
AI Technical Summary
In the prior art, the accuracy of using large language models to generate vehicle maintenance answers is low, and there is a problem of error output.
The enhanced generation method of vehicle maintenance knowledge retrieval based on organizational structure tree is adopted. By obtaining user input questions and vehicle maintenance knowledge bases (including vector databases and knowledge-level databases), vector search and knowledge-level search are performed, target vector fragments and target maintenance knowledge units are obtained, and answers are generated in combination with large language models.
It improves the accuracy and richness of the output answers of large language models, enhances the accuracy of searching information and paths, and improves the efficiency and accuracy of vehicle maintenance knowledge retrieval.
Smart Images

Figure CN119557425A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of big data knowledge retrieval, and in particular to a vehicle maintenance knowledge retrieval enhancement generation method based on an organizational structure tree. Background Art
[0002] In modern vehicle maintenance, vehicle maintenance manuals and parts manuals provide maintenance technicians with important information on vehicle fault diagnosis, maintenance operations, and parts installation, and also allow car owners to understand vehicle maintenance requirements and how to use parts in more detail. In actual vehicle maintenance work, it is often necessary to consult vehicle maintenance manuals and parts manuals to confirm how to repair the vehicle and ensure the quality of the repair. However, the content of vehicle maintenance manuals and parts manuals is usually very rich, and it takes a lot of time to read and understand them, which will reduce maintenance efficiency.
[0003] In the prior art, with the development of artificial intelligence technology, there has emerged a technical means of using large language models to provide artificial intelligence responses to vehicle maintenance questions raised by users, that is, to provide corresponding solutions to vehicle maintenance problems. However, the answers generated by large language models in the prior art have low accuracy and may even produce erroneous outputs.
[0004] Therefore, it is necessary to provide a new technical solution to improve one or more problems existing in the above solutions.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0006] The purpose of this application is to provide a vehicle maintenance knowledge retrieval enhancement generation method based on an organizational structure tree, to provide more accurate and rich retrieval information and retrieval paths for large language models, and thus to improve the accuracy of the answers output by large language models.
[0007] According to an embodiment of the present application, a vehicle maintenance knowledge retrieval enhancement generation method based on an organizational structure tree is provided, comprising: Obtaining a user's input question and a vehicle maintenance knowledge base, wherein the vehicle maintenance knowledge base includes a vector database and a knowledge hierarchy database, wherein the vector database stores vector fragments for representing vehicle maintenance knowledge, and the knowledge hierarchy database is constructed in the form of an organizational structure tree and stores maintenance knowledge units, secondary maintenance hierarchies, and advanced maintenance hierarchies; Based on the input question and the vector database, a search is performed to obtain a target vector segment associated with the input question in the vector database, wherein the target vector segment is represented as: (1) in, represents the target vector segment, Indicates input problem. represents a vector database, represents the similarity between the input question and the vector database, Indicates selecting the vector segment corresponding to the maximum similarity from the vector database; Based on the input question and the knowledge hierarchy database, a search is performed to obtain a target maintenance knowledge unit associated with the input question in the knowledge hierarchy database, and then according to the knowledge hierarchy database, a target secondary maintenance level and a target high-level maintenance level associated with the target maintenance knowledge unit are determined, wherein the target maintenance knowledge unit is represented as: (2) in, represents the target maintenance knowledge unit, represents the knowledge hierarchy database, represents the correlation between the input question and the knowledge hierarchy database, It means selecting the maintenance knowledge unit corresponding to the maximum correlation from the knowledge hierarchy database; Based on the input question and the retrieved target vector fragment, the target maintenance knowledge unit, the target secondary maintenance level and the target high-level maintenance level, a large language model is applied to generate an answer to obtain an answer to the input question.
[0008] In an embodiment of the present application, before searching based on the input question and the vector database, the process further includes: The input problem is vectorized by formula (3) to obtain the first vector segment after vectorization: (3) in, represents the first vector fragment, Indicates vectorization of the input problem, which is used to convert the text input problem into a vector input problem; The vector database is segmented and vectorized by formula (4) to obtain a second vector segment set: (4) in, represents the second vector fragment set, express The total number of second vector fragments in , , Representation Vector Database The documents, Representation Vector Database The documents, Express The vectorized processing results in The second vector fragment, Express The vectorized processing results in The second vector fragment.
[0009] In an embodiment of the present application, the searching based on the input question and the vector database to obtain a target vector segment associated with the input question in the vector database includes: Selecting and processing the second vector segment set according to the input question to obtain a candidate vector segment set; Based on the first vector segment, a maximum margin correlation algorithm is used to perform redundancy processing on the candidate vector segment set to obtain the target vector segment.
[0010] In an embodiment of the present application, the method of performing redundancy processing on the candidate vector segment set by using a maximum boundary correlation algorithm based on the first vector segment to obtain the target vector segment includes: The most relevant vector segment is selected from the candidate vector segment set by formula (5) as the selected vector segment: (5) in, represents the selected vector fragment, represents a set of candidate vector fragments, j represents exist The position sequence number in Represents a candidate vector fragment, i represents exist The position sequence number in represents a first similarity between the candidate vector segment and the first vector segment; According to the first similarity and the second similarity between the candidate vector segment and the selected vector segment, the relevance score of the candidate vector segment is calculated by formula (6): (6) in, represents the relevance score of the candidate vector fragment, represents the first similarity between the candidate vector segment and the first vector segment, represents the second similarity between the candidate vector segment and the selected vector segment, represents the hyperparameter, , represents the first vector fragment; Based on the relevance scores of the candidate vector segments, the candidate vector segments are sorted and selected by formula (7) to obtain the target vector segment: (7) in, represents the target vector segment, Relevance score The size of The front The candidate vector fragments are sorted. Indicates the number of candidate vector fragments selected.
[0011] In an embodiment of the present application, the knowledge hierarchy database stores a plurality of the high-level maintenance hierarchies, the plurality of the high-level maintenance hierarchies are in a parallel relationship, each high-level maintenance hierarchy is provided with a plurality of the secondary maintenance hierarchies, and the plurality of the secondary maintenance hierarchies under each high-level maintenance hierarchy are in a parallel relationship; Wherein, the maintenance knowledge unit belongs to the secondary maintenance level.
[0012] In an embodiment of the present application, the retrieval is performed based on the input question and the knowledge hierarchy database to obtain a target maintenance knowledge unit associated with the input question in the knowledge hierarchy database, and then according to the knowledge hierarchy database, a target secondary maintenance level and a target high-level maintenance level associated with the target maintenance knowledge unit are determined, including: Based on the input question, query and search the maintenance knowledge units in the knowledge hierarchy database to obtain the target maintenance knowledge unit; Based on the target maintenance knowledge unit, query the secondary maintenance level to which the target maintenance knowledge unit belongs to obtain the target secondary maintenance level; Based on the target secondary maintenance level, the high-level maintenance level to which the target secondary maintenance level belongs is queried to obtain the target high-level maintenance level.
[0013] In an embodiment of the present application, based on the input question and the retrieved target vector fragment, the target maintenance knowledge unit, the target secondary maintenance level, and the target high-level maintenance level, a large language model is applied to generate an answer to obtain the answer to the input question, including: The target vector segment, the target maintenance knowledge unit, the target secondary maintenance level and the target high-level maintenance level are preprocessed by formula (8) to obtain preprocessed sample data: (8) in, represents the preprocessed sample data, represents the target vector segment, represents the target maintenance knowledge unit, Indicates the target maintenance level unit, , represents the target secondary maintenance level, Indicates the target advanced maintenance level, Express , and Perform data preprocessing; Based on the input question and the preprocessed sample data, the answer prompt text is determined by formula (9): (9) in, Indicates the answer hint text. Represents the template function used to construct the answer prompt text; The answer prompt text is input into the large language model, and the answer to the question output by the large language model is obtained by formula (10): (10) in, Indicates the answer to the question, Represents a large language model.
[0014] In an embodiment of the present application, the data preprocessing includes data cleaning and / or deduplication processing.
[0015] In an embodiment of the present application, before applying a large language model to generate an answer, the method further includes: Construct training data set based on vehicle maintenance knowledge organization documents; The large language model is trained using the training data set.
[0016] In an embodiment of the present application, the step of constructing a training data set based on the vehicle maintenance knowledge organization document includes: Parsing the vehicle maintenance knowledge organization document to obtain a text format document; The text format document is divided into blocks by formula (11) to obtain multiple document blocks, and the question and answer are extracted from each document block by formula (12) to generate a question-answer pair: (11) (12) in, Represents the vehicle maintenance knowledge organization document, Represents the organization of vehicle maintenance knowledge documents The document block collection after block processing, Indicates the total number of document blocks, , Indicates Document blocks, Indicates Document blocks, Indicates that the question and answer are correct. Indicates the extraction operation of question and answer on the document block; The question-answer pairs are aggregated, and the aggregated question-answer pairs are deduplicated using formula (13) to obtain the training data set: (13) in, represents the training data set, Indicates that duplicate question and answer pairs are removed.
[0017] The technical solution provided by this application may have the following beneficial effects: In the embodiments of the present application, on the one hand, by constructing the knowledge hierarchy database in the form of an organizational structure tree, when searching based on the input question and the knowledge hierarchy database, not only the target maintenance knowledge unit associated with the input question can be retrieved, but also the target secondary maintenance level to which the target maintenance knowledge unit belongs and the target high-level maintenance level to which the target secondary maintenance level belongs can be traced back from the target maintenance knowledge unit, thereby ensuring both the query search rate and accuracy; on the other hand, based on the vector database and the knowledge hierarchy database, when searching, not only the search is performed based on the input question and the vector database to obtain the target vector fragment, but also the search is performed based on the input question and the knowledge hierarchy database to obtain the target maintenance knowledge unit, the target secondary maintenance level and the target high-level maintenance level, thereby providing the large language model with more accurate and rich search information and search paths when applying the large language model for answer generation, thereby improving the accuracy of the answer output by the large language model.
[0018] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 A flowchart showing the steps of a vehicle maintenance knowledge retrieval enhancement generation method based on an organizational structure tree in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0021] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0022] This example embodiment provides a vehicle maintenance knowledge retrieval enhancement generation method based on an organizational structure tree. Figure 1 As shown, the method includes: step S101 to step S104.
[0023] Among them, step S101: obtain the user's input question and vehicle maintenance knowledge base, the vehicle maintenance knowledge base includes a vector database and a knowledge hierarchy database, wherein the vector database stores vector fragments for representing vehicle maintenance knowledge, and the knowledge hierarchy database is constructed in the form of an organizational structure tree and stores maintenance knowledge units, secondary maintenance levels and advanced maintenance levels.
[0024] Step S102: Search based on the input question and the vector database to obtain a target vector segment associated with the input question in the vector database, wherein the target vector segment is represented as: (1) in, represents the target vector segment, Indicates input problem. represents a vector database, represents the similarity between the input question and the vector database, It indicates that the vector segment corresponding to the maximum similarity is selected from the vector database. It should be noted that the processed vector database includes multiple vector segments. Here, the vector segment corresponding to the maximum similarity selected from the vector database is used as the target vector segment.
[0025] Step S103: searching based on the input question and the knowledge hierarchy database to obtain the target maintenance knowledge unit associated with the input question in the knowledge hierarchy database, and then determining the target secondary maintenance level and target high-level maintenance level associated with the target maintenance knowledge unit according to the knowledge hierarchy database, wherein the target maintenance knowledge unit is represented as: (2) in, represents the target maintenance knowledge unit, represents the knowledge hierarchy database, represents the correlation between the input question and the knowledge hierarchy database, It means selecting the maintenance knowledge unit corresponding to the maximum correlation from the knowledge hierarchy database. It should be noted that the knowledge hierarchy database stores multiple maintenance knowledge units. Here, the maintenance knowledge unit corresponding to the maximum correlation selected from the knowledge hierarchy database is used as the target maintenance knowledge unit.
[0026] It should also be noted that, based on the knowledge hierarchy database constructed in the form of an organizational structure tree, there is a hierarchical association relationship between the maintenance knowledge unit, the secondary maintenance level and the advanced maintenance level. Therefore, it is possible to trace back from the target maintenance knowledge unit to the secondary maintenance level and the advanced maintenance level associated with it, and use the traced secondary maintenance level and the advanced maintenance level as the target secondary maintenance level and the target advanced maintenance level.
[0027] Step S104: Based on the input question and the retrieved target vector segments, target maintenance knowledge units, target secondary maintenance levels and target high-level maintenance levels, a large language model is applied to generate answers to obtain answers to the input question.
[0028] In the embodiments of the present application, on the one hand, by constructing the knowledge hierarchy database in the form of an organizational structure tree, when searching based on the input question and the knowledge hierarchy database, not only the target maintenance knowledge unit associated with the input question can be retrieved, but also the target secondary maintenance level to which the target maintenance knowledge unit belongs and the target high-level maintenance level to which the target secondary maintenance level belongs can be traced back from the target maintenance knowledge unit, thereby ensuring both the query search rate and accuracy; on the other hand, based on the vector database and the knowledge hierarchy database, when searching, not only the search is performed based on the input question and the vector database to obtain the target vector fragment, but also the search is performed based on the input question and the knowledge hierarchy database to obtain the target maintenance knowledge unit, the target secondary maintenance level and the target high-level maintenance level, thereby providing the model with more accurate and rich search information when applying a large language model for answer generation, thereby improving the accuracy of the answer.
[0029] It should be noted that the knowledge hierarchy database is constructed in the form of an organizational structure tree, which can be understood as follows: the maintenance knowledge units, secondary maintenance levels and advanced maintenance levels stored in the knowledge hierarchy database are arranged in the form of an organizational structure tree, wherein the hierarchical relationship between the maintenance knowledge units and the secondary maintenance levels is represented by an organizational structure tree, and the hierarchical relationship between the secondary maintenance levels and the advanced maintenance levels is represented by an organizational structure tree, showing the hierarchical relationship between the maintenance knowledge units, secondary maintenance levels and advanced maintenance levels in the knowledge hierarchy database.
[0030] Below, each step of the above method in this example implementation will be described in more detail.
[0031] In one embodiment, before performing the search based on the input question and the vector database in step S102, the method further includes: The input problem is vectorized using formula (3) to obtain the first vector fragment after vectorization: (3) in, represents the first vector fragment, Indicates vectorization of the input problem, which is used to convert the text input problem into a vector input problem; The vector database is segmented and vectorized by formula (4) to obtain the second vector segment set: (4) in, represents the second vector fragment set, express The total number of second vector fragments in , , Representation Vector Database The documents, Representation Vector Database The documents, Express The vectorized processing results in The second vector fragment, Express The vectorized processing results in The second vector fragment.
[0032] By vectorizing the input question as described above, the documents initially stored in the vector database are segmented and vectorized, so as to convert the content of the input question and the content of the vector database into a format that conforms to subsequent vector retrieval, i.e., a first vector segment and a second vector segment, so as to facilitate subsequent vector retrieval based on the input question and the vector database, thereby obtaining the target vector segment.
[0033] It should be noted that the documents initially stored in the above-mentioned vector database can be understood as documents recording vehicle maintenance knowledge, and the second vector segments obtained after the above-mentioned segmentation and vectorization processing can be understood as vector segments used to represent vehicle maintenance knowledge.
[0034] Furthermore, in step S102, a search is performed based on the input question and the vector database to obtain a target vector segment associated with the input question in the vector database, including: Selecting and processing the second vector segment set according to the input question to obtain a candidate vector segment set; Based on the first vector segment, a maximum boundary correlation algorithm is used to perform redundancy processing on the candidate vector segment set to obtain a target vector segment.
[0035] The above method can calculate the similarity between the input problem and the second vector fragment, select multiple second vector fragments with relatively high similarity to form a candidate vector fragment set, so as to ensure that the initially selected candidate vector fragment has a certain correlation with the input problem; and then use the maximum boundary correlation algorithm to process the redundancy of the candidate vector fragment, which can quickly and effectively eliminate the candidate vector fragments with small correlation, so as to ensure that the target vector fragment finally obtained has a stronger correlation with the input problem.
[0036] It should be explained that the maximum margin relevance algorithm is an information retrieval algorithm that extracts keywords or sentences with the largest margin by calculating the similarity between texts.
[0037] Specifically, based on the first vector segment, the maximum boundary correlation algorithm is used to perform redundancy processing on the candidate vector segment set to obtain the target vector segment, including: The most relevant vector segment is selected from the candidate vector segment set by formula (5) as the selected vector segment: (5) in, represents the selected vector fragment, represents a set of candidate vector fragments, j represents exist The position sequence number in Represents a candidate vector fragment, i represents exist The position sequence number in represents a first similarity between the candidate vector segment and the first vector segment; According to the first similarity and the second similarity between the candidate vector segment and the selected vector segment, the relevance score of the candidate vector segment is calculated by formula (6): (6) in, represents the relevance score of the candidate vector fragment, represents the first similarity between the candidate vector segment and the first vector segment, represents the second similarity between the candidate vector segment and the selected vector segment, represents the hyperparameter, , represents the first vector fragment; Based on the relevance scores of the candidate vector segments, the candidate vector segments are sorted and selected using formula (7) to obtain the target vector segment: (7) in, represents the target vector segment, Relevance score The size of The front The candidate vector fragments are sorted. Indicates the number of selected candidate vector fragments; Among them, the target vector fragment obtained by formula (7) is the one with the highest relevance score. candidate vector fragments.
[0038] It should be noted that when the hyperparameter When the value of is set larger, it is more likely to obtain a target vector segment that is highly correlated with the first vector segment; when the hyperparameter When the value of is set to a small value, it is more inclined to select the target vector segment that is more different from the selected vector segment. Therefore, by adjusting the hyperparameter According to the value of , the appropriate target vector fragment is selected as needed.
[0039] In one embodiment, a plurality of high-level maintenance levels are stored in a knowledge hierarchy database, and the plurality of high-level maintenance levels are in a parallel relationship with each other. A plurality of secondary maintenance levels are arranged under each high-level maintenance level, and a plurality of secondary maintenance levels under each high-level maintenance level are in a parallel relationship with each other; wherein maintenance knowledge units are subordinate to secondary maintenance levels, and each secondary maintenance level is provided with at least one maintenance knowledge unit.
[0040] In the above-mentioned knowledge hierarchy database, the superior-subordinate relationship between the maintenance knowledge unit and the secondary maintenance level, and the superior-subordinate relationship between the secondary maintenance level and the high-level maintenance level are represented in the form of an organizational structure tree. In this way, the hierarchical relationship between the high-level maintenance level, the secondary maintenance level and the maintenance knowledge unit in the knowledge hierarchy database can be displayed, so that when searching based on the input question and the knowledge hierarchy database, the target maintenance knowledge unit and the target secondary maintenance level and target high-level maintenance level associated with the target maintenance knowledge unit can be quickly queried.
[0041] For example, in step S103, searching based on the input question and the knowledge hierarchy database to obtain the target maintenance knowledge unit associated with the input question in the knowledge hierarchy database, and then determining the target secondary maintenance level and the target high-level maintenance level associated with the target maintenance knowledge unit according to the knowledge hierarchy database may include the following steps: Based on the input question, the maintenance knowledge units in the knowledge hierarchy database are queried and searched to obtain the target maintenance knowledge units; Based on the target maintenance knowledge unit, query the secondary maintenance level to which the target maintenance knowledge unit belongs to obtain the target secondary maintenance level; Based on the target secondary maintenance level, the high-level maintenance level to which the target secondary maintenance level belongs is queried to obtain the target high-level maintenance level.
[0042] The above bottom-up query search process, i.e., first locking the target maintenance knowledge unit, then locking the target secondary maintenance level of the upper level to which the target maintenance knowledge unit belongs, and finally locking the target high-level maintenance level of the upper level to which the target secondary maintenance level belongs, not only ensures the query search rate, but also helps to improve the accuracy of the generated answers when a large language model is subsequently applied to generate answers.
[0043] It should be noted that the above-mentioned maintenance knowledge units in the knowledge hierarchy database are queried and searched based on the input question to obtain the target maintenance knowledge unit. Specifically, the correlation between the input question and each maintenance knowledge unit in the knowledge hierarchy database can be calculated by formula (2), and the maintenance knowledge unit corresponding to the maximum correlation is selected as the target maintenance knowledge unit.
[0044] For example, the above-mentioned advanced maintenance levels can be specifically understood as "maintenance of major systems" and "maintenance of auxiliary systems"; taking "maintenance of major systems" as an example, its subordinate secondary maintenance levels may include "power system", "transmission system", "driving system", "braking system", "steering system", "lighting system", "electrical system" and "fuel supply system", etc., and further, taking "power system" as an example, its subordinate maintenance knowledge units may include "engine maintenance", "transmission maintenance" and "drive axle maintenance", etc.; taking "auxiliary system maintenance" as an example, its subordinate secondary maintenance levels may include "air conditioning and heating system", "cooling system" and "exhaust system", etc.; further, taking "exhaust system" as an example, its subordinate maintenance knowledge units may include "exhaust manifold", "exhaust temperature sensor" and "exhaust tail pipe", etc.
[0045] It should be noted that in this embodiment, the maintenance knowledge units, secondary maintenance levels and advanced maintenance levels stored in the knowledge hierarchy database need to be encoded into a format accessible and usable by a large language model so that the large language model can be subsequently applied to generate answers.
[0046] In one embodiment, in step S104, based on the input question and the retrieved target vector segments, target maintenance knowledge units, target secondary maintenance levels, and target high-level maintenance levels, a large language model is applied to generate an answer to obtain the answer to the input question, including: The target vector fragment, target maintenance knowledge unit, target secondary maintenance level and target advanced maintenance level are preprocessed by formula (8) to obtain preprocessed sample data: (8) in, represents the preprocessed sample data, represents the target vector segment, represents the target maintenance knowledge unit, Indicates the target maintenance level unit, , represents the target secondary maintenance level, Indicates the target advanced maintenance level, Express , and Perform data preprocessing; Based on the input question and preprocessed sample data, the answer prompt text is determined by formula (9): (9) in, Indicates the answer hint text. Represents the template function used to construct the answer prompt text; The answer prompt text is input into the large language model, and the answer to the question output by the large language model is obtained through formula (10): (10) in, Indicates the answer to the question, Represents a large language model.
[0047] Through the above steps, a large language model can be used to process the input questions and preprocessed sample data to determine the answer prompt text. After the answer prompt text is input into the large language model, the large language model is used to output the answer to the question and feed the answer to the question back to the user.
[0048] Optionally, data preprocessing includes data cleaning and / or deduplication processing. Through data cleaning, the target vector segments, target maintenance knowledge units, target secondary maintenance levels, and target advanced maintenance levels can be standardized to remove noise and irrelevant content therein, for example, correcting typos, unifying wording, etc., to improve the accuracy and readability of the information. Through deduplication processing, duplicate information in the large amount of information obtained can be detected and removed to ensure the uniqueness of the information and avoid duplication.
[0049] It should be noted that the large language model in this embodiment can select the Llama-3 model, which is the third generation version of the large-scale pre-trained language model series and can be obtained from the Baidu Smart Cloud Qianfan Large Model Platform. The full name of Llama in English is Large Language Model Meta AI, which can be directly translated into Chinese as Large Language Model Meta AI. After training the Llama-3 model, an exclusive large language model used in this implementation can be obtained.
[0050] It should also be noted that a greedy algorithm can be used to control the output of a large language model. For example, an initialization step is first performed, starting from the starting state of the large language model, given an input text or prompt; then a step-by-step answer generation step is performed. In each step of the answer generation step, the large language model predicts the next word based on the previously generated word and assigns a probability to each word; in each step of the answer generation step, the word with the highest probability is continuously selected and added to the generated sequence; when the generated sequence reaches a predetermined maximum length or encounters a sequence end marker (such as an End of Sentence marker), the answer generation stops and the generated sequence is output as the answer to the question.
[0051] In one embodiment, before applying a large language model to generate an answer, the method further includes: Construct training data set based on vehicle maintenance knowledge organization documents; Train a large language model using the training dataset.
[0052] Before applying the large language model to generate answers, the large language model is trained using a training data set, which is conducive to improving the generalization of the large language model so as to output more reliable answers to users.
[0053] Furthermore, the above-mentioned training data set constructed based on the vehicle maintenance knowledge organization document includes: Parse and process the vehicle maintenance knowledge organization document to obtain a text format document; The text format document is divided into blocks by formula (11) to obtain multiple document blocks, and the question and answer are extracted from each document block by formula (12) to generate question-answer pairs: (11) (12) in, Represents the vehicle maintenance knowledge organization document, Represents the organization of vehicle maintenance knowledge documents The document block collection after block processing, Indicates the total number of document blocks, , Indicates Document blocks, Indicates Document blocks, Indicates that the question and answer are correct. Indicates the extraction operation of question and answer on the document block; Summarize the question-answer pairs and remove duplicates from the summarized question-answer pairs using formula (13) to obtain the training dataset: (13) in, represents the training data set, Indicates that duplicate question and answer pairs are removed.
[0054] By parsing the vehicle maintenance knowledge organization document into a text format document, it is convenient to subsequently divide the vehicle maintenance knowledge organization document into blocks and extract questions and answers. It should be noted that when dividing the text format document into blocks, the text format document can be divided into blocks according to chapters, that is, each document block contains the text content of a chapter, so that the questions and answers extracted from each document block are for the same type of maintenance problems, which is conducive to the accurate generation of question and answer pairs and also facilitates the subsequent aggregation of question and answer pairs.
[0055] It should also be noted that the above-mentioned vehicle maintenance knowledge organization document is an existing knowledge document related to vehicle maintenance in this field, which can be obtained through a library database or a web version database.
[0056] Optionally, in the step of training a large language model using a training data set, a low-rank adaptive algorithm can be used to train the large language model. This method can reduce the number of model parameters that need to be updated during the training process, thereby reducing the amount of calculation and saving time.
[0057] It should be explained that in the above training steps, Represents the input of a large language model, using Represents the output of a large language model, using represents the weight matrix of a large language model, where represents the matrix, represents the number of rows of the matrix, Indicates the number of columns of the matrix. During training, the weight matrix Keep the state frozen and only update a set of low-rank matrices and ,in, , , satisfy ; The output of a large language model can be expressed as: ,in, and The corresponding input is Therefore, the number of parameters that need to be updated is , which is much smaller than the total number of parameters of a large language model.
[0058] It should also be noted that the Low-Rank Adaptation (LoRA) algorithm is an algorithm for efficient training based on a pre-trained model, and is particularly suitable for large language models. This embodiment uses a low-rank adaptive algorithm to train a large language model, which is a prior art method, and the detailed steps are not repeated here.
[0059] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary technical means in the art that are not disclosed in the present application.
Claims
1. A vehicle maintenance knowledge retrieval enhancement generation method based on an organizational structure tree, characterized in that: include: Obtaining a user's input question and a vehicle maintenance knowledge base, wherein the vehicle maintenance knowledge base includes a vector database and a knowledge hierarchy database, wherein the vector database stores vector fragments for representing vehicle maintenance knowledge, and the knowledge hierarchy database is constructed in the form of an organizational structure tree and stores maintenance knowledge units, secondary maintenance hierarchies, and advanced maintenance hierarchies; Based on the input question and the vector database, a search is performed to obtain a target vector segment associated with the input question in the vector database, wherein the target vector segment is represented as: (1) in, represents the target vector segment, Indicates input problem. represents a vector database, represents the similarity between the input question and the vector database, Indicates selecting the vector segment corresponding to the maximum similarity from the vector database; Based on the input question and the knowledge hierarchy database, a search is performed to obtain a target maintenance knowledge unit associated with the input question in the knowledge hierarchy database, and then according to the knowledge hierarchy database, a target secondary maintenance level and a target high-level maintenance level associated with the target maintenance knowledge unit are determined, wherein the target maintenance knowledge unit is represented as: (2) in, represents the target maintenance knowledge unit, represents the knowledge hierarchy database, represents the correlation between the input question and the knowledge hierarchy database, It means selecting the maintenance knowledge unit corresponding to the maximum correlation from the knowledge hierarchy database; Based on the input question and the retrieved target vector fragment, the target maintenance knowledge unit, the target secondary maintenance level and the target high-level maintenance level, a large language model is applied to generate an answer to obtain an answer to the input question.
2. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 1 is characterized in that: Before searching based on the input question and the vector database, the method further includes: The input problem is vectorized by formula (3) to obtain the first vector segment after vectorization: (3) in, represents the first vector fragment, Indicates vectorization of the input problem, which is used to convert the text input problem into a vector input problem; The vector database is segmented and vectorized by formula (4) to obtain a second vector segment set: (4) in, represents the second vector fragment set, express The total number of second vector fragments in , , Representation Vector Database The documents, Representation Vector Database The documents, Express The vectorized processing results in The second vector fragment, Express The vectorized processing results in The second vector fragment.
3. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 2 is characterized in that: The searching based on the input question and the vector database to obtain a target vector segment associated with the input question in the vector database includes: Selecting and processing the second vector segment set according to the input question to obtain a candidate vector segment set; Based on the first vector segment, a maximum margin correlation algorithm is used to perform redundancy processing on the candidate vector segment set to obtain the target vector segment.
4. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 3 is characterized in that: The step of performing redundancy processing on the candidate vector segment set by using a maximum boundary correlation algorithm based on the first vector segment to obtain the target vector segment includes: The most relevant vector segment is selected from the candidate vector segment set by formula (5) as the selected vector segment: (5) in, represents the selected vector fragment, represents a set of candidate vector fragments, j represents exist The position sequence number in Represents a candidate vector fragment, i represents exist The position sequence number in represents a first similarity between the candidate vector segment and the first vector segment; According to the first similarity and the second similarity between the candidate vector segment and the selected vector segment, the relevance score of the candidate vector segment is calculated by formula (6): (6) in, represents the relevance score of the candidate vector fragment, represents the first similarity between the candidate vector segment and the first vector segment, represents the second similarity between the candidate vector segment and the selected vector segment, represents the hyperparameter, , represents the first vector fragment; Based on the relevance scores of the candidate vector segments, the candidate vector segments are sorted and selected by formula (7) to obtain the target vector segment: (7) in, represents the target vector segment, Relevance score The size of The front The candidate vector fragments are sorted. Indicates the number of candidate vector fragments selected.
5. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 1 is characterized in that: The knowledge hierarchy database stores a plurality of the high-level maintenance hierarchies, the plurality of the high-level maintenance hierarchies are in a parallel relationship, each high-level maintenance hierarchy is provided with a plurality of the secondary maintenance hierarchies, and the plurality of the secondary maintenance hierarchies under each high-level maintenance hierarchy are in a parallel relationship; Wherein, the maintenance knowledge unit belongs to the secondary maintenance level.
6. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 5 is characterized in that: The searching based on the input question and the knowledge hierarchy database to obtain a target maintenance knowledge unit associated with the input question in the knowledge hierarchy database, and then determining a target secondary maintenance level and a target high-level maintenance level associated with the target maintenance knowledge unit according to the knowledge hierarchy database, includes: Based on the input question, query and search the maintenance knowledge units in the knowledge hierarchy database to obtain the target maintenance knowledge unit; Based on the target maintenance knowledge unit, query the secondary maintenance level to which the target maintenance knowledge unit belongs to obtain the target secondary maintenance level; Based on the target secondary maintenance level, the high-level maintenance level to which the target secondary maintenance level belongs is queried to obtain the target high-level maintenance level.
7. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 1 is characterized in that: The step of applying a large language model to generate an answer based on the input question and the retrieved target vector segment, the target maintenance knowledge unit, the target secondary maintenance level, and the target high-level maintenance level to obtain an answer to the input question includes: The target vector segment, the target maintenance knowledge unit, the target secondary maintenance level and the target high-level maintenance level are preprocessed by formula (8) to obtain preprocessed sample data: (8) in, represents the preprocessed sample data, represents the target vector segment, represents the target maintenance knowledge unit, Indicates the target maintenance level unit, , represents the target secondary maintenance level, Indicates the target advanced maintenance level, Express , and Perform data preprocessing; Based on the input question and the preprocessed sample data, the answer prompt text is determined by formula (9): (9) in, Indicates the answer hint text. Represents the template function used to construct the answer prompt text; The answer prompt text is input into the large language model, and the answer to the question output by the large language model is obtained by formula (10): (10) in, Indicates the answer to the question, Represents a large language model.
8. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 7 is characterized in that: The data preprocessing includes data cleaning and / or deduplication processing.
9. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 1 is characterized in that: Before applying the large language model to generate answers, the method further includes: Construct training data set based on vehicle maintenance knowledge organization documents; The large language model is trained using the training data set.
10. The vehicle maintenance knowledge retrieval enhancement generation method based on the organizational structure tree according to claim 9 is characterized in that: The method of constructing a training data set based on the vehicle maintenance knowledge organization document includes: Parsing the vehicle maintenance knowledge organization document to obtain a text format document; The text format document is divided into blocks by formula (11) to obtain multiple document blocks, and the question and answer are extracted from each document block by formula (12) to generate a question-answer pair: (11) (12) in, Represents the vehicle maintenance knowledge organization document, Represents the organization of vehicle maintenance knowledge documents The document block collection after block processing, Indicates the total number of document blocks, , Indicates Document blocks, Indicates Document blocks, Indicates that the question and answer are correct. Indicates the extraction operation of question and answer on the document block; The question-answer pairs are aggregated, and the aggregated question-answer pairs are deduplicated using formula (13) to obtain the training data set: (13) in, represents the training data set, Indicates that duplicate question and answer pairs are removed.
Citation Information
Cited By
Vehicle after-sales maintenance document analysis and maintenance knowledge acquisition system and method based on AD-RAG
CN121029913A
AD-RAG-based vehicle after-sales maintenance document analysis and maintenance knowledge acquisition system and method
CN121029913B
Vectorization construction method and system for manufacturing equipment maintenance knowledge
CN122240677A