Knowledge enhancement methods, media, vehicles, and products for large language models
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-01
- Publication Date
- 2026-08-11
AI Technical Summary
[0004]有鉴于此,本申请实施例致力于提供一种大语言模型的知识增强方法、介质、车辆及产品,以解决对原始大语言模型重训练所导致的计算资源消耗大和时间成本高的问题;同时,既实现了对原始大语言模型的输出结果进行知识增强和校准,又保护原始大语言模型已习得的语言理解和生成能力
[0010]This application's embodiments, by performing a masking operation on the target training vectors, can simulate the information gaps that may occur when the original large language model faces knowledge queries, making the generated sample input data closer to real-world application scenarios. Simultaneously, by directly determining the expected output label based on the fragment information corresponding to the masked knowledge fragments, the accuracy of the training samples is ensured, and the automatic construction of training samples is achieved, eliminating the need for extensive manual annotation and reducing the cost of training data preparation.
Smart Images

Figure CN122549508A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a knowledge enhancement method, medium, vehicle, and product for a large language model. Background Technology
[0002] Large Language Models (LLMs), trained on massive amounts of text data, enable natural language understanding and generation, and have been widely used in many fields. However, LLMs suffer from illusions in practical applications, manifesting as inconsistent responses, fabricated facts, and outputting content that exceeds the model's knowledge boundaries or is outdated, thus failing to meet the needs of scenarios requiring high accuracy of knowledge.
[0003] Currently, to address the issue of "illusion" in large language models, optimization of the model structure or training strategy is typically required. This involves retraining the large language model to inject new knowledge and suppress the illusion phenomenon. However, this approach consumes significant computational resources and time. Furthermore, adjusting the original parameters of the large language model risks disrupting its already acquired language understanding and generation capabilities, leading to a decline in the model's performance on general tasks. Summary of the Invention
[0004] In view of this, the embodiments of this application are committed to providing a knowledge enhancement method, medium, vehicle and product for a large language model, so as to solve the problems of high computational resource consumption and high time cost caused by retraining the original large language model; at the same time, it not only realizes knowledge enhancement and calibration of the output results of the original large language model, but also protects the language understanding and generation capabilities already learned by the original large language model.
[0005] In a first aspect, one embodiment of this application provides a knowledge enhancement method for a large language model, comprising: generating a training dataset based on knowledge data; wherein the training dataset includes sample input data and expected output labels corresponding to the sample input data; inputting the sample input data into an original large language model, and using the output results of the original large language model and the expected output labels to train a knowledge enhancement processing component to be trained, thereby obtaining a trained target processing component; wherein the number of parameters of the knowledge enhancement processing component is less than the number of parameters of the original large language model; and connecting the target processing component to the output side of the original large language model to obtain a knowledge-enhanced target large language model.
[0006] This application's embodiments generate a training dataset containing sample input data and corresponding expected output labels based on knowledge data. The sample input data is then fed into the original large language model, and its output and expected output labels are used to train a knowledge enhancement processing component. Because the knowledge enhancement processing component has a smaller number of parameters, it solves the problem of high computational resource consumption and time cost caused by retraining the original large language model. Simultaneously, by training a knowledge enhancement processing component with a smaller number of parameters and connecting it to the output side of the original large language model, while keeping the original large language model's parameters unchanged, it achieves both knowledge enhancement and calibration of the original large language model's output, while preserving the language understanding and generation capabilities already learned by the original large language model. This ensures the model's performance in handling general tasks and improves the accuracy and reliability of the model's responses.
[0007] In conjunction with the first aspect, in some implementations of the first aspect, the knowledge data includes knowledge graphs; based on the knowledge data, a training dataset is generated, including: converting the knowledge graph into natural language statements, vectorizing the natural language statements to generate statement vectors; constructing graph structure data representing the connection relationships between entities in the knowledge graph; performing information fusion processing on the statement vectors and graph structure data to obtain target training vectors; and generating a training dataset based on the target training vectors.
[0008] This application's embodiments convert knowledge graphs into natural language statements and vectorize them, while simultaneously constructing graph structure data to represent the connections between entities. These two types of information are then fused to obtain the target training vector, fully utilizing the structured characteristics and semantic information of the knowledge graph. The training dataset generated in this way not only contains the specific content of the knowledge but also preserves the relational structure between knowledge points. This allows the trained knowledge augmentation processing component to more accurately apply knowledge, enabling it to make judgments based on a richer knowledge background when correcting the output of the original large language model, further improving the effectiveness and accuracy of knowledge augmentation.
[0009] In conjunction with the first aspect, in some implementations of the first aspect, generating a training dataset based on the target training vector includes: performing a masking operation on the target training vector to obtain sample input data containing masked knowledge fragments; and determining the expected output label corresponding to the sample input data based on the fragment information corresponding to the masked knowledge fragments in the target training vector.
[0010] This application's embodiments, by performing a masking operation on the target training vectors, can simulate the information gaps that may occur when the original large language model faces knowledge queries, making the generated sample input data closer to real-world application scenarios. Simultaneously, by directly determining the expected output label based on the fragment information corresponding to the masked knowledge fragments, the accuracy of the training samples is ensured, and the automatic construction of training samples is achieved, eliminating the need for extensive manual annotation and reducing the cost of training data preparation.
[0011] In conjunction with the first aspect, in some implementations of the first aspect, natural language statements are vectorized to generate statement vectors, including: vectorizing natural language statements according to the standard processing method adopted by the original large language model to generate statement vectors.
[0012] This application embodiment ensures that the generated sentence vectors match the input content of the original large language model in semantic representation by making the vectorization process of sentence vectors follow the standard processing method of the original large language model. This avoids the problem of incompatibility between the original large language model and the original large language model due to differences in preprocessing methods, and ensures that the subsequently generated training dataset can be accurately understood and processed by the original large language model, thereby improving the effectiveness of training the knowledge augmentation processing component.
[0013] In conjunction with the first aspect, in some implementations of the first aspect, natural language sentences are vectorized according to the standard processing method adopted by the original large language model to generate sentence vectors. This includes: segmenting the natural language sentences according to the word segmentation rules adopted by the original large language model to obtain a word sequence; adding special tags to the word sequence according to the tagging method adopted by the original large language model; uniformizing the length of the word sequence after adding special tags so that the length of the sequence obtained after length uniformization matches the maximum input length supported by the original large language model; using the pre-trained word embedding matrix of the original large language model, converting each word in the word sequence after length uniformization into a word vector; generating a segment vector corresponding to each word according to the segment vector addition method adopted by the original large language model; generating a position code corresponding to each word according to the position encoding method adopted by the original large language model; and superimposing the word vector, segment vector, and position code of each word to obtain a sentence vector.
[0014] This application embodiment processes natural language sentences according to the vectorization process of the original large language model for input text, so that the natural language sentences converted from the knowledge graph are encoded into sentence vectors that meet the format requirements of the original large language model. This ensures the consistency between knowledge data and the original large language model in semantic space and input format, enabling the knowledge to be effectively used by the original large language model.
[0015] In conjunction with the first aspect, in some implementations of the first aspect, the original large language model includes a cockpit interaction model deployed on a vehicle; generating a training dataset based on knowledge data includes: generating a training dataset based on knowledge data in response to training triggering conditions; wherein the training triggering conditions include at least one of the following: detecting an update in vehicle-related knowledge data; the hallucination rate of the cockpit interaction model exceeding a target threshold; receiving a training instruction for the cockpit interaction model.
[0016] This application's embodiments achieve flexible and dynamic updates to the knowledge augmentation processing components by setting multiple training trigger conditions. When vehicle-related knowledge data is updated, the new knowledge can be promptly integrated into the training dataset, ensuring that the cockpit interaction model's knowledge reserves remain synchronized with the latest information. When the hallucination rate exceeds a target threshold, training is proactively initiated to correct the model's erroneous output, ensuring the accuracy of the interaction. Training instructions grant administrators direct control over model training, allowing for flexible adjustments to training timing based on actual needs. This multi-dimensional triggering mechanism ensures the timeliness of injected knowledge and the model's ability to respond to new situations, while avoiding unnecessary frequent training and conserving computational resources.
[0017] In conjunction with the first aspect, in some implementations of the first aspect, there are multiple target processing components, each corresponding to a different application domain; the method also includes: acquiring user-input interaction information and determining the target application domain associated with the interaction information; inputting the interaction information into the original large language model to obtain intermediate output results from the original large language model; inputting the intermediate output results into the target processing component corresponding to the target application domain, and performing knowledge enhancement processing on the intermediate output results through the target processing component to obtain the knowledge-enhanced target response.
[0018] This application embodiment sets corresponding target processing components for multiple different application domains, enabling the original large language model to adapt to diverse application scenarios by calling different target processing components. This avoids the problem of excessive cost caused by training a completely new model for each domain, improves the reusability of the large language model and the flexibility of knowledge enhancement, and ensures that accurate and reliable responses can be provided for interactive information in different domains.
[0019] Secondly, this application provides a knowledge enhancement device for a large language model, comprising: a dataset generation module for generating a training dataset based on knowledge data; wherein the training dataset includes sample input data and expected output labels corresponding to the sample input data; a component training module for inputting the sample input data into the original large language model, and using the output results of the original large language model and the expected output labels to train the knowledge enhancement processing component to be trained, thereby obtaining the trained target processing component; wherein the number of parameters of the knowledge enhancement processing component is less than the number of parameters of the original large language model; and a connection module for connecting the target processing component with the output side of the original large language model to obtain the knowledge-enhanced target large language model.
[0020] Thirdly, one embodiment of this application provides a computer-readable storage medium storing a computer program for performing the method in the first aspect or any possible implementation of the first aspect.
[0021] Fourthly, one embodiment of this application provides a vehicle, the vehicle comprising: a processor; a memory for storing processor-executable instructions; the processor being configured to execute the method in the first aspect or any possible implementation thereof.
[0022] Fifthly, one embodiment of this application provides a computer program product including instructions that, when executed on a vehicle, cause the vehicle to implement the method in the first aspect or any possible implementation of the first aspect.
[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 The diagram shown is a flowchart illustrating a knowledge enhancement method for a large language model provided in an embodiment of this application.
[0026] Figure 2 The diagram shown is a structural schematic of a knowledge enhancement device for a large language model provided in an embodiment of this application.
[0027] Figure 3 The diagram shown is a structural schematic of a vehicle provided in an embodiment of this application. Detailed Implementation
[0028] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0029] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.
[0030] It should be understood that the term "and / or" used in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Furthermore, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship. Additionally, the term "based on" used in this document is not limited to relying solely on one object. For example, determining B based on A can mean: determining B based solely on A, or determining B partially based on A.
[0031] It should be noted that the collection, gathering, updating, analysis, processing, use, transmission, and storage of user personal information involved in the technical solution of this application all comply with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken to prevent unauthorized access to user personal information data and to safeguard user personal information security and network security.
[0032] When using large language models for knowledge augmentation to alleviate their illusionary effects, the current technical approach to inject new knowledge into the model and thus augment its knowledge involves full fine-tuning of the original large language model. Specifically, this approach constructs training samples directly using the knowledge data to be injected, and uses these samples to drive updates to all parameters of the original large language model, thereby achieving knowledge augmentation of the model.
[0033] However, large language models typically have a large number of parameters, and updating all parameters requires extremely high computational resources and a significant time cost. Furthermore, during full fine-tuning, the model's original general language understanding and generation capabilities may be affected by parameter adjustments. In other words, while learning new knowledge, the model may forget previously learned important capabilities, leading to a decline in its performance on general tasks.
[0034] For example, in scenarios such as in-vehicle intelligent cockpit interaction systems, knowledge such as vehicle configuration and service policies needs to be continuously updated. If each update requires a full-scale fine-tuning of the large language model deployed on the vehicle, it will consume huge computing resources and time costs. At the same time, full-scale parameter adjustments can easily destroy the model's basic capabilities such as fluent dialogue and logical reasoning, which have been trained with a large amount of data, leading to the risk of performance degradation introduced during the knowledge enhancement process.
[0035] To address the aforementioned issues, this application proposes a knowledge augmentation method for large language models. This method trains a lightweight knowledge augmentation processing component independent of the original large language model and connects this component to the output of the original large language model to subsequently correct its output. This effectively achieves knowledge augmentation without adjusting or retraining any internal parameters of the original large language model, significantly reducing training resource consumption. In other words, it provides a decoupled knowledge augmentation mechanism to solve the problems of high cost and performance degradation associated with full-scale fine-tuning schemes, achieving low-cost, high-efficiency, and performance-indestructible knowledge injection.
[0036] The following is combined Figure 1 The knowledge enhancement method for large language models provided in the embodiments of this application will be described in detail. Figure 1 The diagram shown is a flowchart illustrating a knowledge enhancement method for a large language model according to an embodiment of this application; as follows: Figure 1 As shown, the method includes the following steps.
[0037] Step S110: Generate a training dataset based on knowledge data; wherein the training dataset includes sample input data and the expected output labels corresponding to the sample input data.
[0038] Knowledge data refers to structured or unstructured data used for knowledge enhancement of the large language model. For example, in a vehicle scenario, knowledge data can include the vehicle's latest configuration parameters (such as engine model, battery capacity, and intelligent driving function version), real-time traffic information, and data on surrounding service facilities (such as charging station locations and usage status, and parking space availability). This knowledge data can originate from official databases, industry standard documents, and real-time updated service system interfaces. Sample input data simulates various commands that users might input into the large language model, while the expected output label is the ideal response to the sample input data that is expected to be generated after making decisions based on the knowledge data.
[0039] In some embodiments, knowledge data can be acquired in advance. Acquisition methods include establishing a data interface with a target database to retrieve knowledge data from the target database in real time or periodically, such as information about vehicle configurations and technical parameters from a vehicle manufacturer's official database; or receiving knowledge data proactively provided by users, such as personalized usage experiences and needs in special scenarios input by vehicle users through an interactive interface.
[0040] In practical implementation, there are various ways to generate sample input data and expected output labels based on knowledge data. For example, key entities and relationships can be extracted from knowledge data to construct samples in the form of question-answer pairs; where the question serves as the sample input data and the answer as the expected output label. Key entities refer to core objects in the knowledge data that have specific meanings. For instance, if the knowledge data is "the vehicle's battery capacity is 80kWh," then the sample input data can be constructed as "What is the battery capacity of this vehicle?", with the corresponding expected output label being "the battery capacity of this vehicle is 80kWh."
[0041] Step S120: Input the sample input data into the original large language model, and use the output of the original large language model and the expected output label to train the knowledge enhancement processing component to be trained, so as to obtain the trained target processing component; wherein, the number of parameters of the knowledge enhancement processing component is less than the number of parameters of the original large language model.
[0042] The original large language model is the base model without knowledge augmentation. It possesses general language understanding and generation capabilities, but may have shortcomings in the accuracy of specific domain knowledge or state-of-the-art knowledge. The original large language model includes any AI model based on a neural network architecture capable of understanding and generating natural language. For example, the original large language model is an LLM (Large Language Model) type model, such as the GPT series and BERT. The knowledge augmentation component to be trained refers to any independently trainable neural network module with fewer parameters than the connected original large language model. For example, it could be a fully connected embedding layer, a lightweight Transformer decoder block, or a gated recurrent network.
[0043] In practice, the sample input data is first fed into the original large language model. The original large language model processes the sample input data to obtain an intermediate output result. This intermediate output result contains answers based on its existing knowledge, but may not be consistent with the latest knowledge data or may not be accurate enough. Next, based on the intermediate output result and the expected output label corresponding to the sample input data, the knowledge enhancement processing component to be trained is iteratively trained. The training objective is to minimize the loss between the final prediction obtained by the knowledge enhancement processing component after processing the intermediate output result and the expected output label, until the loss function converges or reaches the preset number of training rounds, finally obtaining the trained target processing component.
[0044] Step S130: Connect the target processing component to the output side of the original large language model to obtain the knowledge-enhanced target large language model.
[0045] In some embodiments, the connection can be either tightly coupled or loosely coupled. Tight coupling refers to propagating components forward as part of the model at the code level; loose coupling can be achieved through a scheduling service that dynamically selects the appropriate target processing component to process the output of the original large language model based on the input.
[0046] This application's embodiments generate a training dataset containing sample input data and corresponding expected output labels based on knowledge data. The sample input data is then fed into the original large language model, and its output and expected output labels are used to train a knowledge enhancement processing component. Because the knowledge enhancement processing component has a smaller number of parameters, it solves the problem of high computational resource consumption and time cost caused by retraining the original large language model. Simultaneously, by training a knowledge enhancement processing component with a smaller number of parameters and connecting it to the output side of the original large language model, while keeping the original large language model's parameters unchanged, it achieves both knowledge enhancement and calibration of the original large language model's output, while preserving the language understanding and generation capabilities already learned by the original large language model. This ensures the model's performance in handling general tasks and improves the accuracy and reliability of the model's responses.
[0047] In some embodiments, the knowledge data includes a knowledge graph; generating a training dataset based on the knowledge data includes: converting the knowledge graph into natural language statements, vectorizing the natural language statements to generate statement vectors; constructing graph structure data representing the connection relationships between entities in the knowledge graph; performing information fusion processing on the statement vectors and graph structure data to obtain target training vectors; and generating a training dataset based on the target training vectors.
[0048] Knowledge graphs are structured collections of knowledge containing entities, relations, and attributes. They are commonly represented by triples (entity-relationship-entity) or quadruples (entity-relationship-entity-time) and support standard formats such as RDF (Resource Description Framework) and OWL (Web Ontology Language). Natural language statements refer to text described in a way that is understandable to humans. Graph structure data is topological data used to describe the relationships between entities in a knowledge graph. For example, graph structure data includes graph adjacency lists or sparse matrices. Graph adjacency lists record the adjacent entities and their corresponding relations for each entity node in a list format, while sparse matrices use rows and columns to correspond to entity nodes, and matrix elements represent whether a specific relationship exists between entities and the relationship weight.
[0049] In practice, the way to convert a knowledge graph into a natural language statement is as follows: for a triple (entity A, relation R, entity B) in the knowledge graph, it can be converted into a statement such as "there is a relation R between entity A and entity B".
[0050] Furthermore, a pre-trained language model can be used to map sentences to a high-dimensional vector space, obtaining sentence vectors with semantic representations, thus achieving vectorization of natural language sentences. To better capture the structural dependencies between entities in a knowledge graph, a graph structure can be constructed, generating graph structure data. For example, the connection relationships between entities in the graph structure can be extracted using an adjacency list, generating a graph relation adjacency list to avoid the gradient vanishing problem caused by sparse matrices.
[0051] Additionally, a separate graph relationship processing layer can be set up. Statement vectors and graph structure data are used as dual inputs to the graph relationship processing layer. A pre-defined weight matrix is used to perform weighted operations on the vector representations of entities and relationships, with the formula: x = W E A; where W is the preset weight parameter matrix, A is the graph structure data, E is the sentence vector, and x is the fused target training vector. A training dataset containing sample input data and expected output labels is constructed using the target training vector.
[0052] This application's embodiments convert knowledge graphs into natural language statements and vectorize them, while simultaneously constructing graph structure data to represent the connections between entities. These two types of information are then fused to obtain the target training vector, fully utilizing the structured characteristics and semantic information of the knowledge graph. The training dataset generated in this way not only contains the specific content of the knowledge but also preserves the relational structure between knowledge points. This allows the trained knowledge augmentation processing component to more accurately apply knowledge, enabling it to make judgments based on a richer knowledge background when correcting the output of the original large language model, further improving the effectiveness and accuracy of knowledge augmentation.
[0053] Based on the generation of target training vectors, in order to further refine the construction method of training samples and improve the targeting and efficiency of training, this application provides a method for automatically generating structured training samples.
[0054] Specifically, generating a training dataset based on the target training vector includes: performing a masking operation on the target training vector to obtain sample input data containing masked knowledge fragments; and determining the expected output label corresponding to the sample input data based on the fragment information corresponding to the masked knowledge fragments in the target training vector.
[0055] Masking refers to randomly or according to preset rules hiding parts of knowledge in the target training vector, simulating the knowledge content that may be missing or incorrectly expressed in the original large language model. The masked knowledge fragment refers to the part of the target training vector that is hidden. The fragment information is the knowledge content corresponding to the masked knowledge fragment in the target training vector.
[0056] In practice, masking operations can be performed based on MLM (Masked Language Model). For example, in the natural language text corresponding to the target training vector, key entities or relational words can be replaced with special mask symbols (such as "[MASK]") to generate sample input data. For instance, if the natural language statement corresponding to the target training vector is "The battery capacity of this car is 80kWh", after performing the masking operation, the sample input data could be "The battery capacity of this car is [MASK]kWh". The fragment information corresponding to the masked knowledge fragment is "80", therefore, the expected output label corresponding to this sample input data is "80".
[0057] This application's embodiments, by performing a masking operation on the target training vectors, can simulate the information gaps that may occur when the original large language model faces knowledge queries, making the generated sample input data closer to real-world application scenarios. Simultaneously, by directly determining the expected output label based on the fragment information corresponding to the masked knowledge fragments, the accuracy of the training samples is ensured, and the automatic construction of training samples is achieved, eliminating the need for extensive manual annotation and reducing the cost of training data preparation.
[0058] To improve the compatibility between the data and the original large language model during the generation of the training dataset, the aforementioned vectorization process can be further defined. In one implementation, vectorizing natural language sentences to generate sentence vectors includes: vectorizing natural language sentences according to the standard processing method used by the original large language model to generate sentence vectors.
[0059] The standard processing method refers to the fixed process and parameter settings followed by the original large language model to perform preprocessing, word segmentation, embedding and other operations on the input text.
[0060] Specifically, the standard processing methods for the original large language model are usually defined in its published model configuration file, word segmenter, or related preprocessing code. For example, for the BERT (Bidirectional Encoder Representations from Transformers) model, standard methods include using sub-word segmentation algorithms for word segmentation, adding [CLS] tags at the beginning of sentences, and adding [SEP] tags at the end of sentences.
[0061] To ensure that the semantic space of the sentence vectors remains consistent with the input semantic space of the original large language model, the standard processing method of the original large language model is followed when vectorizing natural language sentences. For example, if the original large language model uses the BPE (Byte-Pair Encoding) segmentation algorithm and limits the maximum length of the text sequence to 512 tokens, then when processing natural language sentences converted from knowledge graphs, the same BPE segmenter is used for segmentation. Sentences exceeding 512 tokens are truncated, and sentences with fewer than 512 tokens are padded with specific padding characters. The same processing method as the original large language model is used to convert them into vector representations, thereby generating the final sentence vectors.
[0062] This application embodiment ensures that the generated sentence vectors match the input content of the original large language model in semantic representation by making the vectorization process of sentence vectors follow the standard processing method of the original large language model. This avoids the problem of incompatibility between the original large language model and the original large language model due to differences in preprocessing methods, and ensures that the subsequently generated training dataset can be accurately understood and processed by the original large language model, thereby improving the effectiveness of training the knowledge augmentation processing component.
[0063] To more clearly illustrate how to achieve fully compatible vectorization processing, this application further provides a preferred scheme. Optionally, the natural language sentence is vectorized according to the standard processing method used by the original large language model to generate sentence vectors, including: segmenting the natural language sentence into words according to the word segmentation rules used by the original large language model to obtain a word sequence; adding special tags to the word sequence according to the tagging method used by the original large language model; uniformizing the length of the word sequence after adding special tags so that the length of the sequence after length uniformization matches the maximum input length supported by the original large language model; using the pre-trained word embedding matrix of the original large language model, converting each word in the word sequence after length uniformization into a word vector; generating a segment vector corresponding to each word according to the segment vector addition method used by the original large language model; generating a position code corresponding to each word according to the position encoding method used by the original large language model; and superimposing the word vector, segment vector, and position code of each word to obtain the sentence vector.
[0064] In this embodiment, word segmentation rules refer to the specific rules followed by the original large language model when segmenting text, such as segmentation based on characters, words, or sub-words, and whether to consider the grammatical structure of a specific language. A token sequence refers to an ordered sequence of multiple independent tokens obtained after word segmentation. Special tags are symbols defined by the original large language model to represent specific semantic or structural information when processing text, such as [CLS] (starting tags for classification tasks) and [SEP] (tags for separating different sentences or paragraphs) in the BERT model. Length unification refers to adjusting token sequences of different lengths to the fixed maximum input length supported by the original large language model, usually through truncation or padding. The pre-trained word embedding matrix is a matrix learned by the original large language model during the pre-training stage, used to map tokens to low-dimensional or high-dimensional vector spaces. Each token corresponds to a column of word vectors in the matrix, which contains the semantic information of the token. Segment vectors are used to distinguish different sentences or paragraphs in the input text. For example, in the BERT model, when processing sentence pairs, a segment vector is assigned to the words in the first sentence, and another segment vector is assigned to the words in the second sentence. Position encoding is used to represent the positional information of words in the sequence, enabling the model to understand the sequential relationship between words. Different models may use different position encoding methods, such as absolute position encoding, relative position encoding, etc.
[0065] In the specific implementation, the original large language model is BERT model as an example. First, according to the word segmentation algorithm used by the BERT model, the natural language sentence "The battery capacity of the vehicle is 80kWh" is segmented into words, resulting in the word sequence: ["car", "vehicle", "of", "electricity", "pool", "capacity", "quantity", "for", "80", "k", "Wh"]. Next, according to the BERT model's marking method, [CLS] is added to the beginning of the word sequence and [SEP] is added to the end of the word sequence, resulting in the new word sequence: ["[CLS]", "car", "vehicle", "of", "electricity", "pool", "capacity", "quantity", "for", "80", "k", "Wh", "[SEP]"].
[0066] Furthermore, the BERT model supports a maximum input length of 512 words. If the current word sequence length is less than 512, it is padded with [PAD] markers until the sequence length reaches 512. Then, using the pre-trained word embedding matrix of the BERT model, each word in the sequence (including [CLS], [SEP], and [PAD]) is converted into a corresponding word vector, assuming each word vector has a dimension of 768. Since only a single sentence is processed in this example, all word segment vectors are 0 vectors. For positional encoding, the BERT model uses fixed sine and cosine positional encoding, generating a corresponding positional code based on the position of each word in the sequence (counting from 0), also with a dimension of 768. Finally, the word vector, segment vector, and positional code of each word are added element-wise to obtain the final vector representation of that word. The vectors of all words arranged in order constitute the sentence vector of the entire natural language sentence.
[0067] This application embodiment processes natural language sentences according to the vectorization process of the original large language model for input text, so that the natural language sentences converted from the knowledge graph are encoded into sentence vectors that meet the format requirements of the original large language model. This ensures the consistency between knowledge data and the original large language model in semantic space and input format, enabling the knowledge to be effectively used by the original large language model.
[0068] To improve the timeliness of knowledge enhancement and the efficiency of system resource utilization, and to achieve dynamic knowledge updates, this application provides a preferred scheme for the training triggering mechanism. Optionally, the original large language model includes a cockpit interaction model deployed on a vehicle; generating a training dataset based on knowledge data includes: generating a training dataset based on knowledge data in response to training triggering conditions; wherein the training triggering conditions include at least one of the following: detecting an update in vehicle-related knowledge data; the hallucination rate of the cockpit interaction model exceeding a target threshold; receiving a training instruction for the cockpit interaction model.
[0069] The following provides a detailed explanation of each training trigger condition.
[0070] In some embodiments, when an update to knowledge data is detected—for example, when the vehicle receives a new user manual, new service point information, or new traffic regulations via over-the-air download technology—a new training dataset is automatically generated, and incremental training of the processing components is performed. This ensures that the knowledge of the cockpit interaction model is updated synchronously with the vehicle system. For example, whether knowledge data has been updated can be detected by comparing the knowledge base version number, monitoring changes in the hash value of data files, or listening for specific data update messages.
[0071] In other embodiments, the hallucination rate refers to the frequency with which the cockpit interaction model generates information that is inconsistent with the facts or does not exist during user interaction. For example, by setting up a log recording module in the vehicle system to record the output content of the cockpit interaction model in real time, and combining this with preset fact-checking rules or a manual review mechanism, the proportion of hallucination outputs per unit time to the total number of interactions is calculated, thus obtaining the hallucination rate. Alternatively, the hallucination rate can be evaluated based on user satisfaction feedback data regarding the cockpit interaction model's responses. When the hallucination rate exceeds a preset target threshold (e.g., 5%), it indicates that the knowledge accuracy of the cockpit interaction model can no longer meet the usage requirements. At this point, a training process is triggered to optimize the knowledge augmentation processing components by generating a new training dataset to reduce the hallucination rate.
[0072] In other embodiments, training instructions can be sent by the vehicle administrator via the in-vehicle backend management system, a remote control platform, or a specific physical button. For example, after a vehicle undergoes a software upgrade, the vehicle administrator can proactively send training instructions to forcibly trigger the training of the knowledge augmentation processing component, ensuring that the model can quickly adapt to the new software environment. This proactive triggering mechanism provides the administrator with flexible control methods, allowing them to update the model knowledge at any time according to actual operational needs.
[0073] Furthermore, when deploying the cockpit interaction model for the first time, knowledge data related to the target vehicle model can be acquired. This knowledge data can then be used to trigger the training of the knowledge enhancement processing component, thereby completing the adaptation of the cockpit interaction model to the target vehicle model.
[0074] In practical applications, the above training triggering conditions can be used individually or in combination. For example, knowledge data updates and hallucination rates can be monitored simultaneously, and training can be triggered when either condition is met.
[0075] This application's embodiments achieve flexible and dynamic updates to the knowledge augmentation processing components by setting multiple training trigger conditions. When vehicle-related knowledge data is updated, the new knowledge can be promptly integrated into the training dataset, ensuring that the cockpit interaction model's knowledge reserves remain synchronized with the latest information. When the hallucination rate exceeds a target threshold, training is proactively initiated to correct the model's erroneous output, ensuring the accuracy of the interaction. Training instructions grant administrators direct control over model training, allowing for flexible adjustments to training timing based on actual needs. This multi-dimensional triggering mechanism ensures the timeliness of injected knowledge and the model's ability to respond to new situations, while avoiding unnecessary frequent training and conserving computational resources.
[0076] To enable a large language model to flexibly adapt to knowledge enhancement across multiple different domains and improve its reusability and applicability, this application provides a preferred solution for multi-domain adaptation. In some embodiments, there are multiple target processing components, each corresponding to a different application domain; the method further includes: acquiring user-input interaction information and determining the target application domain associated with the interaction information; inputting the interaction information into the original large language model to obtain an intermediate output result from the original large language model; inputting the intermediate output result into the target processing component corresponding to the target application domain, and performing knowledge enhancement processing on the intermediate output result through the target processing component to obtain the knowledge-enhanced target response.
[0077] The application domain can refer to different professional fields or scenarios, such as vehicle control, navigation services, entertainment and information, and vehicle fault diagnosis. Each target processing component is trained on knowledge specific to its application domain, enabling it to accurately understand the domain's terminology, knowledge structure, and user needs. For example, the processing component for vehicle control can focus on learning vehicle operation commands and functional parameters; while the processing component for navigation services focuses on map data, route planning rules, and traffic information.
[0078] In practice, after acquiring user input interaction information, the target application domain associated with the interaction information is determined through semantic analysis, keyword extraction, or intent recognition. For example, when a user inputs "how to enable automatic parking function," the target application domain can be determined to be vehicle control by recognizing the keyword "automatic parking."
[0079] Furthermore, after the interactive information is input into the original large language model, the original large language model generates intermediate output results based on its general knowledge. Subsequently, the intermediate output results are input into the target processing component corresponding to the target application domain. This component utilizes its domain-specific knowledge enhancement capabilities to supplement, correct, or deepen the intermediate output results. For example, the original large language model may only provide the basic operating steps for automatic parking, while the target processing component in the vehicle control domain can further supplement it with professional knowledge such as the subtle differences in automatic parking for different vehicle models and brands, and operating precautions, thereby generating a more accurate, comprehensive, and user-relevant target response, improving the adaptability of the knowledge-enhanced large language model to different vehicle models.
[0080] This application embodiment sets corresponding target processing components for multiple different application domains, enabling the original large language model to adapt to diverse application scenarios by calling different target processing components. This avoids the problem of excessive cost caused by training a completely new model for each domain, improves the reusability of the large language model and the flexibility of knowledge enhancement, and ensures that accurate and reliable responses can be provided for interactive information in different domains.
[0081] The above text provides a detailed description of the embodiments corresponding to the knowledge enhancement method for large language models. In order to enable those skilled in the art to further understand the technical solution of this method, the following text uses a cockpit interaction system as an example to describe the knowledge enhancement process of large language models.
[0082] The vehicle manufacturer pushed a new version of the user manual knowledge graph to the vehicles via over-the-air download technology. The knowledge enhancement service in the cockpit interaction system detected this update and automatically initiated the training process. The service module extracted the new knowledge graph, converted it into natural language sentence vectors compatible with the cockpit's original large language model, constructed a graph structure, fused it, and generated training samples through masking operations. Subsequently, these samples were used to train a new, lightweight fully connected embedding layer. During training, the parameters of the original large language model were frozen, and only the parameters of this fully connected embedding layer were updated. A masked language model training method was adopted, adjusting the embedding layer weights and biases through the cross-entropy loss function until the embedding layer converged, achieving non-intrusive knowledge enhancement and avoiding damage to the original model's performance.
[0083] The embedding layer adopts a fully connected neural network structure, and the operation formula is: H=σ(W·h+b); where h is the output vector of the large language model, W is the weight matrix of the fully connected embedding layer, b is the bias vector, σ is the activation function, and H is the output vector of the fully connected embedding layer.
[0084] When a user uses the car again, they might ask the voice assistant, "My car is under warranty. At what battery health level can I apply for a free inspection?" This is a technical question involving specific after-sales policies. The original large language model, based on general knowledge, might give a vague or inaccurate answer. However, in this solution, the cockpit interaction system first identifies that the question belongs to the "vehicle knowledge" domain. It then feeds the user's input into the original large language model to obtain an intermediate output, which is then transmitted to a newly trained "vehicle knowledge" enhancement component. This component, based on the precise knowledge learned during training (e.g., "According to the latest service policy, a free inspection can be scheduled if the battery health is below 70% and within the 8-year / 160,000 km warranty period"), corrects and refines the original output. Ultimately, the user hears an accurate and professional explanation.
[0085] This application, through an example of a cockpit interaction system, clearly demonstrates the complete process of the large language model knowledge enhancement method provided, from knowledge data updating, training triggering, model adaptation to final user interaction response. In this process, the knowledge enhancement component does not simply replace the output of the original large language model, but rather optimizes the intermediate output results based on the domain knowledge obtained during training. This fully leverages the advantages of the original large language model in natural language understanding and generation, while simultaneously utilizing the domain knowledge enhancement capabilities of the target processing component to achieve a combination of general intelligence and specialized knowledge. This improves the service quality and user experience of the cockpit interaction system in specific application scenarios.
[0086] The above text combined Figure 1 The document details an embodiment of the knowledge enhancement method for the large language model in this application. The following section combines... Figure 2 This document describes in detail embodiments of the knowledge enhancement apparatus for a large language model. It should be understood that the descriptions of the knowledge enhancement method embodiments for a large language model correspond to the descriptions of the knowledge enhancement apparatus embodiments for a large language model; therefore, any parts not described in detail can be found in the preceding method embodiments.
[0087] Figure 2 The diagram shown is a structural schematic of a knowledge enhancement device for a large language model provided in an embodiment of this application. Figure 2 As shown, the knowledge enhancement device 20 for a large language model provided in this application embodiment includes: The dataset generation module 210 is used to generate a training dataset based on knowledge data; wherein, the training dataset includes sample input data and the expected output labels corresponding to the sample input data; The component training module 220 is used to input sample input data into the original large language model, and use the output results of the original large language model and the expected output labels to train the knowledge enhancement processing component to be trained, so as to obtain the trained target processing component; wherein, the number of parameters of the knowledge enhancement processing component is smaller than the number of parameters of the original large language model. The connection module 230 is used to connect the target processing component to the output side of the original large language model to obtain the knowledge-enhanced target large language model.
[0088] In one embodiment of this application, the knowledge data includes a knowledge graph; the dataset generation module 210 is further configured to convert the knowledge graph into natural language statements, perform vectorization processing on the natural language statements to generate statement vectors; construct graph structure data representing the connection relationships between entities in the knowledge graph; perform information fusion processing on the statement vectors and graph structure data to obtain target training vectors; and generate a training dataset based on the target training vectors.
[0089] In one embodiment of this application, the dataset generation module 210 is further configured to perform a masking operation on the target training vector to obtain sample input data containing mask knowledge fragments; and determine the expected output label corresponding to the sample input data based on the fragment information corresponding to the mask knowledge fragments in the target training vector.
[0090] In one embodiment of this application, the dataset generation module 210 is further configured to vectorize natural language statements according to the standard processing method adopted by the original large language model, and generate statement vectors.
[0091] In one embodiment of this application, the dataset generation module 210 is further configured to: segment the natural language sentence according to the segmentation rules adopted by the original large language model to obtain a word sequence; add special tags to the word sequence according to the tagging method adopted by the original large language model; perform length unification processing on the word sequence after adding special tags so that the length of the sequence obtained after length unification processing matches the maximum input length supported by the original large language model; use the pre-trained word embedding matrix of the original large language model to convert each word in the word sequence after length unification processing into a word vector; generate a segment vector corresponding to each word according to the segment vector addition method adopted by the original large language model; generate a position code corresponding to each word according to the position encoding method adopted by the original large language model; and superimpose the word vector, segment vector and position code of each word to obtain a sentence vector.
[0092] In one embodiment of this application, the original large language model includes a cockpit interaction model deployed on a vehicle; the dataset generation module 210 is further configured to generate a training dataset based on knowledge data in response to training triggering conditions; wherein the training triggering conditions include at least one of the following: detecting that knowledge data related to the vehicle has been updated; the hallucination rate of the cockpit interaction model exceeds a target threshold; or receiving a training instruction for the cockpit interaction model.
[0093] In one embodiment of this application, there are multiple target processing components, each corresponding to a different application domain; the device also includes an information acquisition module, used to acquire user-input interaction information, determine the target application domain associated with the interaction information; input the interaction information into the original large language model to obtain intermediate output results from the original large language model; input the intermediate output results into the target processing component corresponding to the target application domain, and perform knowledge enhancement processing on the intermediate output results through the target processing component to obtain the knowledge-enhanced target response.
[0094] It is worth noting that in the embodiments of the knowledge enhancement device of the above-mentioned large language model, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0095] Below, for reference Figure 3 To describe the vehicle according to embodiments of this application. Figure 3 The diagram shown is a structural schematic of a vehicle provided in an exemplary embodiment of this application.
[0096] like Figure 3 As shown, vehicle 30 includes one or more processors 301 and memory 302.
[0097] The processor 301 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the vehicle 30 to perform desired functions.
[0098] Memory 302 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and processor 301 may execute the program instructions to implement the knowledge enhancement methods for large language models of the various embodiments of this application described above, and / or other desired functions.
[0099] In one example, vehicle 30 may also include input device 303 and output device 304, which are interconnected via a bus system and / or other forms of connection mechanism (not shown).
[0100] The input device 303 may include, for example, a keyboard, a mouse, etc.
[0101] The output device 304 can output various information to the outside. The output device 304 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0102] Of course, for the sake of simplicity, Figure 3 Only some of the components of vehicle 30 relevant to this application are shown in this illustration; components such as buses, input / output interfaces, etc., are omitted. In addition, vehicle 30 may include any other suitable components depending on the specific application.
[0103] In addition to the methods and apparatus described above, embodiments of this application may also be computer program products, which include computer program instructions that, when executed by a processor, cause the processor to perform the steps in the knowledge enhancement methods for large language models according to various embodiments of this application as described above.
[0104] Computer program products can be written in any combination of one or more programming languages to perform the operations of the embodiments of this application. The programming languages include object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0105] Furthermore, embodiments of this application may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps in the knowledge enhancement methods for large language models according to various embodiments of this application described above.
[0106] Computer-readable storage media may take the form of any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may, for example, include, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0107] The basic principles of this application have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this application are merely examples and not limitations, and should not be considered as essential features of each embodiment of this application. Furthermore, the specific details of the above application are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the application to the necessity of employing the aforementioned specific details for implementation.
[0108] The block diagrams of devices, apparatuses, devices, and systems involved in this application are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0109] It should also be noted that in the apparatus, equipment, and methods of this application, the components or steps can be disassembled and / or recombined. These disassemblies and / or recombinations should be considered as equivalent solutions of this application.
[0110] The above description of the claimed aspects is provided to enable any person skilled in the art to make or use this application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of this application. Therefore, this application is not intended to be limited to the aspects shown herein, but rather to be applied within the widest scope consistent with the principles and novel features of this application.
[0111] The above description has been given for illustrative and descriptive purposes. Furthermore, this description is not intended to limit the embodiments of this application to the forms described herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A knowledge enhancement method of a large language model, characterized by, include: A training dataset is generated based on knowledge data; wherein the training dataset includes sample input data and the expected output labels corresponding to the sample input data; The sample input data is input into the original large language model. The output of the original large language model and the expected output label are used to train the knowledge enhancement processing component to be trained, so as to obtain the trained target processing component. The number of parameters of the knowledge enhancement processing component is less than the number of parameters of the original large language model. The target processing component is connected to the output side of the original large language model to obtain the knowledge-enhanced target large language model.
2. The method of claim 1, wherein, The knowledge data includes a knowledge graph; the generation of a training dataset based on the knowledge data includes: The knowledge graph is converted into natural language statements, and the natural language statements are vectorized to generate statement vectors. Construct graph-structured data that represents the connection relationships between entities in the knowledge graph; The statement vector and the graph structure data are fused to obtain the target training vector. The training dataset is generated based on the target training vectors.
3. The method according to claim 2, characterized in that, The process of generating the training dataset based on the target training vectors includes: Perform a masking operation on the target training vector to obtain sample input data containing masked knowledge fragments; Based on the fragment information corresponding to the mask knowledge fragment in the target training vector, the expected output label corresponding to the sample input data is determined.
4. The method of claim 2, wherein, The step of vectorizing the natural language statement to generate statement vectors includes: The natural language statement is vectorized according to the standard processing method used in the original large language model to generate statement vectors.
5. The method of claim 4, wherein, The step of vectorizing the natural language statement according to the standard processing method adopted by the original large language model to generate statement vectors includes: The natural language sentence is segmented according to the word segmentation rules adopted by the original large language model to obtain a word sequence; According to the marking method used in the original large language model, special markers are added to the word sequence; The word sequence after adding the special marker is subjected to length unification processing so that the length of the sequence obtained after length unification processing matches the maximum input length supported by the original large language model; Using the pre-trained word embedding matrix of the original large language model, each word in the word sequence after uniform length processing is converted into a word vector; According to the segmented vector addition method used in the original large language model, generate the segmented vector corresponding to each word element; According to the positional encoding method used in the original large language model, generate the positional code corresponding to each word element; The sentence vector is obtained by superimposing the word vector, the segment vector, and the positional encoding of each word element.
6. The method of claim 1, wherein, The original large language model includes a cockpit interaction model deployed in the vehicle; the training dataset generated based on knowledge data includes: In response to the training triggering conditions, a training dataset is generated based on the knowledge data; The training triggering conditions include at least one of the following: An update to knowledge data related to the vehicle was detected; The hallucination rate of the cockpit interaction model exceeded the target threshold; The training instruction for the cockpit interaction model was received.
7. The method of claim 1, wherein, The target processing components are multiple, each corresponding to a different application domain; the method further includes: Obtain user-inputted interaction information and determine the target application domain associated with the interaction information; The interactive information is input into the original large language model to obtain the intermediate output result of the original large language model; The intermediate output is input to the target processing component corresponding to the target application domain. The target processing component performs knowledge enhancement processing on the intermediate output to obtain the knowledge-enhanced target response.
8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the knowledge enhancement method for the large language model according to any one of claims 1 to 7.
9. A vehicle characterized by comprising: include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the knowledge enhancement method for a large language model as described in any one of claims 1 to 7.
10. A computer program product, characterised in that, The computer program product includes instructions that, when executed on a vehicle, cause the vehicle to implement the knowledge enhancement method for a large language model as described in any one of claims 1 to 7.