Large language model generation method and device, question and answer knowledge verification method and device and vehicle
By constructing professional field knowledge data sets from multiple data sources, pre-training and supervised fine-tuning training of large language models, the problem of large language models generating factual error information is solved, and the accuracy of responses and prediction capabilities in professional fields are improved.
Patent Information
- Application Number
- CN202311551027.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-20
- Publication Date
- 2025-05-27
AI Technical Summary
The problem of large language models generating factual error messages leads to frequent responses to incorrect answers. How to improve the accuracy of large language models is an urgent problem to be solved at present.
By obtaining the target professional field knowledge data from multiple data sources, the first training data set is constructed, the initial large language model is pre-trained, and the pre-set large language model is obtained; then the structured data of the target professional field knowledge data is obtained, the second training data set is constructed, and the pre-set large language model is supervised and fine-tuned training is carried out to obtain the target large language model.
It improves the prediction accuracy of the model in professional field scenarios, solves the shortcomings of the fantasy problem of large language models, and ensures the accuracy of the response.
Smart Images

Figure CN120045648A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of natural language processing, and in particular, to a large language model generation method, a question and answer knowledge verification method, an apparatus, and a vehicle. Background Art
[0002] A large language model (LLM), also known as a large-scale language model, is an artificial intelligence model designed to understand and generate human language. The large language model is trained on a large amount of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, etc. The characteristic of the LLM is its huge scale, containing billions of parameters, which helps to learn complex patterns in language data. Although the large language model performs well in various natural language tasks in the general field, there are still some limitations. In the actual use process, the large language model has the problem of generating factual error information, resulting in the situation of giving wrong answers.
[0003] In the related art, the training method of the large language model is as follows: through an unsupervised learning method to learn the structure, grammar, and word meaning of human language. In self-supervised learning, the model generates its own labels for the input data by predicting the next word or token in the sequence and gives the previous words. The training process includes two main steps: pre-training and fine-tuning. In the pre-training stage, the model learns from a huge and diverse dataset, usually containing billions of words from different sources, such as websites, books, and articles, etc. This stage allows the model to learn general language patterns and representations. That is, the pre-training stage mainly helps the large language model learn more knowledge and make it have more powerful reasoning ability. In the fine-tuning stage, the model is further trained on a more specific and smaller dataset related to the target task or domain. The manually annotated fine-tuning guidance mainly helps the large language model give responses in the way expected by users. However, this method has limited effect on factual error problems. Therefore, how to improve the response accuracy of the large language model is an urgent problem to be solved currently. Summary of the Invention
[0004] To solve the above technical problems, the present disclosure provides a large language model generation method, a question and answer knowledge verification method, an apparatus, and a vehicle.
[0005] In a first aspect, the present disclosure provides a large language model generation method, including:
[0006] Obtain target professional field knowledge data collected from multiple data sources and construct a first training dataset;
[0007] Based on the first training dataset, pre-train an initial large language model to obtain a preset large language model;
[0008] Obtain the structured data of the target professional field knowledge data and construct a second training dataset;
[0009] Perform supervised fine-tuning training on the preset large language model based on the second training dataset to obtain a target large language model.
[0010] As an optional implementation manner of an embodiment of the present disclosure, obtaining the structured data of the target professional field knowledge data and constructing a second training dataset includes:
[0011] Analyze the target professional field knowledge data and extract multiple entities and the attribute information corresponding to the multiple entities from the target professional field knowledge data;
[0012] Construct multiple structured data of the target professional field knowledge data according to the association relationship between the attribute information of the multiple entities;
[0013] Construct a second training dataset according to the multiple structured data of the target professional field knowledge data.
[0014] As an optional implementation manner of an embodiment of the present disclosure, the constructing multiple structured data of the target professional field knowledge data according to the association relationship between the attribute information of the multiple entities includes:
[0015] Obtain the names of multiple entities and the association relationship between the attribute information of the multiple entities, and generate multiple data Q&A pairs;
[0016] Based on the multiple data Q&A pairs, construct multiple structured data of the target professional field knowledge data by extracting the relevant keywords in each data Q&A pair.
[0017] As an optional implementation manner of an embodiment of the present disclosure, the obtaining the names of multiple entities and the association relationship between the attribute information of the multiple entities and generating multiple data Q&A pairs includes:
[0018] Based on the names of at least two entities among the names of the multiple entities, construct the questions of each Q&A pair in a preset format;
[0019] Obtain the attribute information of the entity associated with the names of the at least two entities and construct the answers of each Q&A pair;
[0020] Based on the questions of each Q&A pair and the answers of each Q&A pair, construct multiple data Q&A pairs.
[0021] As an alternative implementation manner of the embodiments of the present disclosure, performing supervised fine-tuning training on the preset large language model based on the second training data set to obtain a target large language model, including:
[0022] Inputting the question of each question-answer pair into the preset large language model to obtain the output answer of each question-answer pair;
[0023] Adjusting the weight parameters of the preset large language model according to the output answer of each question-answer pair, the answer of each question-answer pair, and a preset loss function to obtain a target large language model.
[0024] In a second aspect, an embodiment of the present disclosure provides a method for verifying question-answer knowledge, and the method includes:
[0025] Obtaining the question text input by the user;
[0026] Inputting the question text into the target large language model to obtain the answer text corresponding to the question text; the target large language model is obtained based on the large language model generation method according to any one of claims 1-5;
[0027] Verifying the answer text corresponding to the question text based on an expert system knowledge base;
[0028] If the answer text passes the verification, outputting the answer text of the question text;
[0029] If the answer text fails to pass the verification, identifying the answer text of the question text.
[0030] As an alternative implementation manner of the embodiments of the present disclosure, when the answer text fails to pass the verification, it further includes:
[0031] If the answer text fails to pass the verification, inputting the question text into the target large language model again. Within a preset number of times, if the answer texts generated by the target large language model all fail to pass the verification, outputting a prompt message; the prompt message is used to prompt the user that the target large language model is temporarily unable to generate a correct answer.
[0032] In a third aspect, an embodiment of the present disclosure provides a large language model generation device, including:
[0033] A first construction module, configured to obtain target professional field knowledge data collected from multiple data sources and construct a first training data set;
[0034] A pre-training module, configured to perform pre-training on an initial large language model based on the first training data set to obtain a preset large language model;
[0035] A second construction module, configured to obtain the structured data of the target professional domain knowledge data and construct a second training data set;
[0036] A generation module, configured to perform supervised fine-tuning training on the preset large language model based on the second training data set to obtain a target large language model.
[0037] As an optional implementation manner of an embodiment of the present disclosure, the second construction module includes:
[0038] An extraction unit, configured to analyze the target professional domain knowledge data and extract multiple entities and the attribute information corresponding to the multiple entities from the target professional domain knowledge data;
[0039] A construction unit, configured to construct multiple structured data of the target professional domain knowledge data according to the association relationship between the attribute information of the multiple entities;
[0040] A generation unit, configured to construct a second training data set according to the multiple structured data of the target professional domain knowledge data.
[0041] As an optional implementation manner of an embodiment of the present disclosure, the construction unit is specifically configured to:
[0042] Obtain the names of multiple entities and the association relationship between the attribute information of the multiple entities, and generate multiple data question-and-answer pairs;
[0043] Based on the multiple data question-and-answer pairs, construct multiple structured data of the target professional domain knowledge data by extracting the associated keywords in each data question-and-answer pair.
[0044] As an optional implementation manner of an embodiment of the present disclosure, the obtaining the names of multiple entities and the association relationship between the attribute information of the multiple entities, and generating multiple data question-and-answer pairs includes:
[0045] Based on the names of at least two entities among the names of the multiple entities, construct the question of each question-and-answer pair in a preset format;
[0046] Obtain the attribute information of the entity associated with the names of the at least two entities, and construct the answer of each question-and-answer pair;
[0047] Based on the question of each question-and-answer pair and the answer of each question-and-answer pair, construct multiple data question-and-answer pairs.
[0048] As an optional implementation manner of an embodiment of the present disclosure, the generation module is specifically configured to:
[0049] Input the question of each question-and-answer pair into the preset large language model to obtain the output answer of each question-and-answer pair;
[0050] Adjust the weight parameters of the preset large language model according to the output answer of each Q&A pair, the answer of each Q&A pair, and a preset loss function to obtain a target large language model.
[0051] In a fourth aspect, an embodiment of the present disclosure provides a Q&A knowledge verification device, including:
[0052] An acquisition module, configured to acquire the question text input by the user;
[0053] An input module, configured to input the question text into the target large language model to obtain an answer text corresponding to the question text; the target large language model is obtained based on the large language model generation method according to any one of claims 1-5.
[0054] A verification module, configured to verify the answer text corresponding to the question text based on an expert system knowledge base;
[0055] An output module, configured to output the answer text of the question text if the answer text passes the verification;
[0056] An identification module, configured to identify the answer text of the question text if the answer text fails to pass the verification.
[0057] As an optional implementation manner of an embodiment of the present disclosure, the language model correction device further includes:
[0058] A correction device, configured to, if the answer text fails to pass the verification, input the question text into the target large language model again. If the answer texts generated by the target large language model all fail to pass the verification within a preset number of times, a prompt message is output; the prompt message is used to prompt the user that the target large language model is temporarily unable to generate a correct answer.
[0059] In a fifth aspect, an embodiment of the present disclosure provides a vehicle-mounted terminal, including: a memory and a processor; the memory stores a computer program, and when the processor executes the computer program, the large language model generation method according to the first aspect or any one of the embodiments of the first aspect is implemented.
[0060] In a sixth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the large language model generation method according to any one of the embodiments in the first aspect is implemented.
[0061] In a seventh aspect, an embodiment of the disclosure provides a vehicle, including: the vehicle-mounted terminal according to the third aspect.
[0062] The technical solutions provided by the embodiments of the present disclosure have the following advantages compared with the prior art: Obtain the target professional field knowledge data collected from multiple data sources, construct the first training dataset, and based on the first training dataset, pre-train the initial large language model to obtain a preset large language model. Obtain the structured data of the target professional field knowledge data, construct the second training dataset, and based on the second training dataset, perform supervised fine-tuning training on the preset large language model to obtain the target large language model. Among them, the target professional field knowledge data is text data. Since the first training dataset is composed of the target professional field text data collected from multiple data sources, the model can learn the domain common sense and professional knowledge in the professional field through the first training dataset. Also, since the second training dataset is constructed from more precise structured data, the knowledge expression method of the structured data is more direct, which can make up for the problem that the accurate factual knowledge cannot be learned well in the first stage by abstracting knowledge from text. In this stage, continuous iteration can be carried out based on the structured knowledge, thereby improving the prediction accuracy of the model in the professional field scenario and solving the hallucination problem of the large model to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.
[0064] To more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0065] Figure 1 It is a flowchart showing a method for generating a large language model provided by an embodiment of the present disclosure;
[0066] Figure 2 It is a flowchart showing a method for verifying question-and-answer knowledge provided by an embodiment of the present disclosure;
[0067] Figure 3 It is a schematic structural diagram of a device for generating a large language model provided by an embodiment of the present disclosure;
[0068] Figure 4 It is a schematic structural diagram of a device for verifying question-and-answer knowledge provided by an embodiment of the present disclosure;
[0069] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0070] To better understand the above objects, features, and advantages of the present disclosure, the following further describes the solutions of the present disclosure. It should be noted that, without conflict, the embodiments of the present disclosure and the features in the embodiments may be combined with each other.
[0071] In the following description, numerous specific details are set forth to facilitate a thorough understanding of the present disclosure, but the present disclosure may be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only a part of the embodiments of the present disclosure, rather than all of the embodiments.
[0072] The relational terms such as "first" and "second" in the specification and claims of the present disclosure are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0073] In the embodiments of the present disclosure, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present disclosure should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific manner. In addition, in the description of the embodiments of the present disclosure, unless otherwise specified, the meaning of "a plurality" refers to two or more.
[0074] Glossary:
[0075] LLM: (Large Language Model), an artificial intelligence model designed to understand and generate human language. They are trained on a large amount of text data and can perform a wide range of tasks, including text summarization, translation, sentiment analysis, etc.
[0076] In some embodiments, as Figure 1 shown, a method for generating a large language model is provided, including the following steps S11 - S14:
[0077] S11. Obtain target professional field knowledge data collected from multiple data sources and construct a first training data set.
[0078] Among them, the target professional field knowledge data is text data. The first training data set may be target professional field knowledge data crawled from different web pages of different web browsers, and the multiple data sources may include: knowledge platforms such as Q&A communities, encyclopedia websites, open - source knowledge graphs, search engine logs, etc. The target professional field may be the automotive field, the financial field, the entertainment field, etc.
[0079] Specifically, in the pre-training stage, the corpus learning in the target professional field is enhanced. Text knowledge data in the target field collected from multiple data sources is obtained, and based on the text knowledge data in the target field, a first training dataset is constructed.
[0080] Exemplarily, for example, the target field can be the automotive field, and knowledge data in the automotive field is obtained from web pages of different browsers such as Baidu, Sohu, 360, and Autohome.
[0081] S12. Based on the first training dataset, the initial large language model is pre-trained to obtain a preset large language model.
[0082] Among them, the initial large language model refers to the large language model trained on general materials, that is, the basic training samples, rather than the initial model without any training. That is, the initial large language model obtained through the basic training samples usually only generates a text sequence as a result based on the text input in multiple fields and the knowledge contained in the initial large model parameters. However, due to the overly complex corpus of knowledge data contained in this basic training sample, the results output by the initial large language model may have hallucination problems.
[0083] Specifically, based on the knowledge data in the target professional field collected from multiple data sources, the initial large language model is pre-trained to obtain a preset large language model. In this step, the first training set is used as the fine-tuning training set, and for the initial large language model that has been pre-trained before, the pre-training on the materials in the target professional field is increased to generate a preset large language model.
[0084] Exemplarily, taking the target professional field as the automotive field as an example, first, relevant text knowledge in the automotive field is obtained from web pages of multiple browsers to construct a first training dataset.
[0085] After the pre-training on general materials is completed, the pre-training on the materials in the target professional field is increased. The pre-training corpus of the materials in the target professional field requires the quality requirement of the corpus to be close to the application level, and it is expected that the model can learn the reasoning ability, domain common sense, and some professional knowledge in the target professional field at this stage.
[0086] S13. Obtain the structured data of the knowledge data in the target professional field and construct a second training dataset.
[0087] Among them, structured data generally refers to data that can be represented and stored using a relational database, for example, data that can be logically expressed and implemented using a two-dimensional table. The general characteristics are: the data is in rows, and one row of data represents the information of an entity, and the attributes of each row of data are the same and stored in the database; it can be represented by data or a unified structure, such as numbers, symbols, etc.
[0088] In some embodiments, step S13 (obtaining structured data of the target professional domain knowledge data and constructing a second training data set) can be implemented as follows:
[0089] a. Analyze the target professional domain knowledge data, and extract multiple entities and attribute information corresponding to the multiple entities from the target professional domain knowledge data.
[0090] Specifically, the target professional field knowledge data can be analyzed, and the structured data of the target homepage field knowledge data can be obtained from the text data through information extraction to achieve efficient construction of the training data set. Among them, IE (Information Extraction) is a text processing technology that extracts factual information such as entities, attributes, relationships and events from natural language text. It is an important foundation for artificial intelligence applications such as information retrieval, intelligent question and answer, and intelligent dialogue. Structured data crawling can also be performed through vertical sites. For example, some automotive vertical sites and encyclopedia pages have structured data that have been sorted and open to the public. Vertical categories, that is, vertical categories, can be understood as professional fields, subdivided tracks, etc. In addition, it is also possible to obtain knowledge data in professional fields organized by various departments within the enterprise, such as vehicle-related configuration parameters, usage, after-sales service issues and other information.
[0091] For example, the common knowledge data expression can be expressed as a triple, namely SPO, for example, XX Automobile Company-Founder-XX. SPO (subject-predicate-object). Information extraction, the input of this task is a sentence, and the output is an SPO triple. SPO triples are often used to represent the structure of knowledge graphs and are widely used in machine learning, natural language processing and other fields.
[0092] b. Constructing multiple structured data of the target professional domain knowledge data according to the association relationship between the attribute information of the multiple entities.
[0093] Optionally, the above step b (constructing multiple structured data of the target professional domain knowledge data according to the association relationship between the attribute information of the multiple entities) can be implemented as follows:
[0094] (1) Obtain the names of multiple entities and the association relationship between the attribute information of the multiple entities, and generate multiple data question-answer pairs.
[0095] Each data question-answer pair includes a question and an answer.
[0096] Specifically, analyze the knowledge data of the target professional field, extract the names of multiple entities and the attribute information of multiple entities, and generate multiple data Q&A pairs according to the association relationship between the attribute information of multiple entities.
[0097] Exemplarily, the names of multiple entities can be: automotive component A, maintenance method, maintenance cycle. The corresponding attribute information of multiple entities can be: shock absorber, regular maintenance (such as cleaning, tightening, inspection, lubrication, etc.), 3 - 4 years; or, windshield wiper blade, regular maintenance (such as cleaning, tightening, inspection, replacement, etc.), every year.
[0098] Optionally, the above step (1) can be implemented in the following way:
[0099] Based on at least two entity names among the names of the multiple entities, construct the question of each Q&A pair in a preset format.
[0100] Specifically, constructing the question of the Q&A pair requires at least two entity names. Determine at least two entity names from the names of multiple entities and form the question of the Q&A pair in a preset format. Among them, the preset format can be set according to the actual application scenario and is not specifically limited here. For example, the preset format can be: "What is the xx of xx?", "How to xx?", etc.
[0101] Exemplarily, the questions formed according to the entity names "automotive component A" and "maintenance cycle" are: "What is the maintenance cycle of automotive component A?" The questions formed according to the entity names "automotive component A" and "maintenance method" are: "What is the maintenance method of automotive component A?" The questions formed according to the entity names "automobile", "maintenance", and "shock absorber" are "How to maintain the shock absorber of the automobile?" or "What is the way to maintain the shock absorber of the automobile?".
[0102] Obtain the attribute information of the entity associated with the at least two entity names and construct the answer of each Q&A pair.
[0103] Based on the question of each Q&A pair and the answer of each Q&A pair, construct multiple data Q&A pairs.
[0104] Specifically, construct the answer of each Q&A pair according to the attribute information of the entity associated with the at least two entity names. Based on the question of each Q&A pair and the answer of each Q&A pair, construct multiple data Q&A pairs.
[0105] Exemplarily, the following data Q&A pairs can be constructed:
[0106] Q: What is the maintenance cycle of the automotive shock absorber?
[0107] A: The maintenance cycle of the automotive shock absorber is 3 - 4 years.
[0108] Q: How to maintain the car shock absorber?
[0109] A: The car shock absorber can be maintained by cleaning, fastening, checking, lubricating, etc.
[0110] (2) Based on the multiple data Q&A pairs, by extracting the associated keywords in each data Q&A pair, construct multiple structured data of the target professional field knowledge data.
[0111] Specifically, based on multiple data Q&A pairs, by extracting the associated keywords in each data Q&A pair, construct multiple structured data of the target professional field knowledge data. The structured data can be managed using a relational database or a structured query language database. The relational database is based on a relational model and represents data in the form of tables. For enterprise users, structured data is easier to use because users do not need to have a lot of data science knowledge to use it. As long as users understand the topics involved in the data, they can access and analyze the data.
[0112] Exemplarily, the Q&A pair can be "Q: What is the maintenance cycle of the car shock absorber? A: The maintenance cycle of the car shock absorber is 3 - 4 years." By extracting the associated keywords, such as "car", "shock absorber", "maintenance cycle", "3 - 4 years", etc., the constructed structured data can be "Automobile part A - Maintenance method", "Automobile part A - Maintenance cycle", etc.
[0113] c. According to the multiple structured data of the target professional field knowledge data, construct a second training dataset.
[0114] S14. Perform supervised fine-tuning training on the preset large language model based on the second training dataset to obtain a target large language model.
[0115] Specifically, input the second training dataset into the preset large language model for supervised fine-tuning training to obtain a target large language model.
[0116] Exemplarily, during the supervised fine-tuning training process, "system" and "user" can be used as inputs, and the model is required to generate the content of "assistant".
[0117] {
[0118] "system": "You are an expert in the automotive field and can answer users' questions in detail and accurately."
[0119] "user": [Question in the Q&A pair]
[0120] "assistant": [Answer in the Q&A pair]
[0121] }
[0122] In some embodiments, the above step S14 (supervised fine-tuning training the preset large language model based on the second training dataset to obtain a target large language model) can be implemented in the following manner:
[0123] Input the question of each question-answer pair into the preset large language model to obtain the output answer of each question-answer pair;
[0124] Adjust the weight parameters of the preset large language model according to the output answer of each question-answer pair, the answer of each question-answer pair, and a preset loss function to obtain a target large language model.
[0125] Specifically, train the preset large language model based on newly constructed training samples so that the trained target large language model has the capabilities expected by the user. Input the question of each question-answer pair into the preset large language model to obtain the output answer of each question-answer pair, and adjust the weight parameters of the preset large language model according to the output answer of each question-answer pair, the answer of each question-answer pair, and a preset loss function to obtain a target large language model.
[0126] Exemplarily, the preset loss function can be selected as the cross-entropy loss function, or other reasonable loss functions can also be selected. There is no specific limitation here and it can be set according to the actual situation.
[0127] In addition, it should be noted that knowledge verification is not performed during pre-training, but there are requirements for knowledge accuracy, which is ensured by the reliability of the data source and data cleaning work in the structured data construction process. Among them, the main purpose of data cleaning is to remove duplicate data, invalid data, and missing data, etc. from multiple text data. Or, perform format conversion on the obtained multiple text data and convert the obtained multiple text data into a preset format, such as txt format, excel format, etc.
[0128] The large language model generation method provided by the present disclosure obtains target professional field knowledge data collected from multiple data sources, constructs a first training data set, and based on the first training data set, pre-trains an initial large language model to obtain a preset large language model. Then, it obtains the structured data of the target professional field knowledge data, constructs a second training data set, and based on the second training data set, performs supervised fine-tuning training on the preset large language model to obtain a target large language model. Among them, the target professional field knowledge data is text data. Since the first training data set is composed of target professional field text data collected from multiple data sources, the model can learn domain common sense and professional knowledge in the professional field through the first training data set. Also, since the second training data set is constructed from more precise structured data, and the knowledge expression method of the structured data is more direct, it can make up for the problem that the learning of precise factual knowledge is not in place in the first stage by the way of abstracting knowledge from text. In this stage, continuous iteration can be carried out based on the structured knowledge, thereby improving the prediction accuracy of the model in the professional field scenario and solving the hallucination problem of the large language model to a certain extent.
[0129] Figure 2 It is a schematic flowchart of a question-and-answer knowledge verification method provided by an embodiment of the present disclosure. As Figure 2 shown, a question-and-answer knowledge verification method provided by an embodiment of the present disclosure includes:
[0130] S21. Obtain the question text input by the user.
[0131] Specifically, obtain the question text input by the user in a dialogue manner or through a text input manner.
[0132] Exemplarily, for a vehicle-mounted system, the voice input by the user can be obtained, and the voice can be converted into text through a voice assistant. Or the text information input by the user on the display interface can also be obtained.
[0133] S22. Input the question text into the target large language model to obtain the answer text corresponding to the question text.
[0134] Among them, the target large language model is obtained based on the large language model generation method described in any one of claims 1-5.
[0135] Specifically, input the question text into the target large language model to obtain the answer text corresponding to the question text.
[0136] Exemplarily, the question text input by the user is: "Who is the founder of L Automobile Company?" The output answer text is: "L". Or, the question text input by the user is "What is the relationship between L Automobile Company and L?", and the output answer text is: "L is the founder of L Automobile Company".
[0137] S23. Verify the answer text corresponding to the problem text based on the expert system knowledge base.
[0138] Specifically, in the online reasoning stage, result verification is added to enhance the risk controllability of the output result. After the target large language model outputs, based on technologies such as expert systems, reasoning networks, and small model integration systems, an actuality discrimination system is organized to intercept the output of the target large model. The actuality discrimination system verifies the answer corresponding to the problem text according to the content in the expert system knowledge base. Among them, the expert system knowledge base can be set in the system or independently of the actuality discrimination system, and no specific limitation is made here. Due to the capacity limitations of such systems, it is set based on the white-box strategy. For example, in this step, if the actuality discrimination system identifies a factual error, the result will either be directly rejected or the target large model will be requested to reorganize the output for retry, so as to achieve a transparent and controllable output for the output of the target large model.
[0139] Verifying the answer text corresponding to the problem text through the expert system knowledge base can achieve a transparent and controllable output of the result. Therefore, in terms of design, this part requires a more interpretable judgment strategy to implement. For example, expert systems based on symbolic reasoning, traditional and learning models based on features, etc. can all be applied.
[0140] Among them, an expert system: also called symbolicism, based on rule reasoning, especially when there is no dataset or the data volume is very small, such as in the field of financial risk control, etc. The generation process of the expert system knowledge base includes: First, a group of experts in the target field are needed to output work experience; Second, knowledge engineers are needed to convert the experts' experience into a form that can be recognized by a computer and encode the experts to form a knowledge base.
[0141] Expert systems can be used to handle uncertainty, form knowledge representation, be interpretable, and perform knowledge reasoning. Among them, knowledge representation: normal data is unstructured data, which can be converted into the format of a knowledge graph to form structured data; compared with neural networks, expert systems are rule-based and highly interpretable.
[0142] In addition, MRKL (Modular Reasoning, Knowledge and Language, modular reasoning, knowledge and language system) attempts to combine existing neural network models, such as large-scale language models LLM, and external knowledge bases, as well as past popular symbolic expert systems, so as to balance neural model and symbolic reasoning capabilities.
[0143] S24. If the answer text passes the verification, output the answer text of the problem text.
[0144] Specifically, if the answer text passes the verification of the expert system knowledge base, the answer text to the question text is output.
[0145] Exemplarily, the question text input by the user is "What is the relationship between L Automobile Company and L?", and the output answer text is: "L is the founder of L Automobile Company". Assuming that this answer text passes the verification, this answer text is output.
[0146] S25. If the answer text fails to pass the verification, then identify the answer text to the question text.
[0147] Specifically, if the answer text fails to pass the verification of the expert system knowledge base, then perform result identification.
[0148] Exemplarily, the question text input by the user is: "Who is the founder of L Automobile Company?" The output answer text is: "C". Assuming that this answer fails to pass the verification of the expert system knowledge base, then perform result identification.
[0149] The purpose of performing result verification through the expert system knowledge base is to intercept results that do not conform to facts and avoid misjudgment or misoperation by users due to incorrect information output. For example, diagnosis and repair steps of vehicle faults, vehicle power, query of configuration information, etc.
[0150] In some embodiments, if the answer text fails to pass the verification, the following steps can also be executed:
[0151] Re-enter the question text into the target large language model. Within a preset number of times, if the answer texts generated by the target large language model all fail to pass the verification, then output a prompt message.
[0152] Among them, the prompt message is used to prompt the user that the target large language model is temporarily unable to generate the correct answer. The preset number of times can be set according to actual needs. For example, it can be 2 times, 3 times, 5 times, etc., and no specific limitation is made here.
[0153] Specifically, if the answer text fails the verification, then re-enter the question text into the target large language model to obtain the first answer text output by the target large language model, and verify the first answer text based on the expert system knowledge base. If the verification passes, then output the first answer text; if the verification fails, then output a prompt message, for example, "Sorry, Xiao L is temporarily unable to provide you with the correct answer."
[0154] The Q&A knowledge verification method provided by the present disclosure obtains the question text input by the user, inputs the question text into the target large language model to obtain the answer text corresponding to the question text, and verifies the answer text corresponding to the question text based on the expert system knowledge base. If the answer text passes the verification, the answer text of the question text is output. If the answer text fails to pass the verification, the answer text of the question text is identified. After the target large language model outputs the answer text, the answer text is verified based on the expert system knowledge base, and the output of the target large language model is intercepted and identified. By adding result verification, the risk controllability of the output is enhanced, and the hallucination problem of the large language model is solved to a certain extent.
[0155] In some embodiments, as shown in Figure 3 a large language model generation device 300 is provided, including:
[0156] A first construction module 310, configured to obtain target professional field knowledge data collected from multiple data sources and construct a first training data set;
[0157] A pre-training module 320, configured to pre-train an initial large language model based on the first training data set to obtain a preset large language model;
[0158] A second construction module 330, configured to obtain structured data of the target professional field knowledge data and construct a second training data set;
[0159] A generation module 340, configured to perform supervised fine-tuning training on the preset large language model based on the second training data set to obtain a target large language model.
[0160] As an optional implementation manner of an embodiment of the present disclosure, the second construction module includes:
[0161] An extraction unit, configured to analyze the target professional field knowledge data and extract multiple entities and attribute information corresponding to the multiple entities from the target professional field knowledge data;
[0162] A construction unit, configured to construct multiple structured data of the target professional field knowledge data according to the association relationship between the attribute information of the multiple entities;
[0163] A generation unit, configured to construct a second training data set according to the multiple structured data of the target professional field knowledge data.
[0164] As an optional implementation manner of an embodiment of the present disclosure, the construction unit is specifically configured to:
[0165] Obtain the names of multiple entities and the association relationship between the attribute information of the multiple entities, and generate multiple data Q&A pairs;
[0166] Based on the multiple data Q&A pairs, by extracting the associated keywords in each data Q&A pair, multiple structured data of the target professional domain knowledge data are constructed.
[0167] As an optional implementation manner of the embodiments of the present disclosure, the obtaining the association relationship between the names of multiple entities and the attribute information of the multiple entities to generate multiple data Q&A pairs includes:
[0168] Based on the names of at least two entities among the names of the multiple entities, construct the questions of each Q&A pair in a preset format;
[0169] Obtain the attribute information of the entity associated with the names of the at least two entities, and construct the answers of each Q&A pair;
[0170] Based on the questions of each Q&A pair and the answers of each Q&A pair, construct multiple data Q&A pairs.
[0171] As an optional implementation manner of the embodiments of the present disclosure, the generating module is specifically configured to:
[0172] Input the questions of each Q&A pair into the preset large language model to obtain the output answers of each Q&A pair;
[0173] According to the output answers of each Q&A pair, the answers of each Q&A pair, and a preset loss function, adjust the weight parameters of the preset large language model to obtain a target large language model.
[0174] The large language model generation device provided by the present disclosure obtains the target professional domain knowledge data collected from multiple data sources, constructs a first training dataset, pre-trains an initial large language based on the first training dataset to obtain a preset large language model, obtains the structured data of the target professional domain knowledge data, constructs a second training dataset, and performs supervised fine-tuning training on the preset large language model based on the second training dataset to obtain a target large language model. Among them, the target professional domain knowledge data is text data. Since the first training dataset is composed of the target professional domain text data collected from multiple data sources, the model can learn the domain common sense and professional knowledge in the professional domain through the first training dataset. Also, since the second training dataset is constructed by more precise structured data, and the knowledge expression method of the structured data is more direct, it can make up for the problem that the first stage fails to learn accurate factual knowledge well through the way of abstracting knowledge from text. In this stage, continuous iteration can be carried out based on the structured knowledge, thereby improving the prediction accuracy of the model in the professional domain scenario and solving the hallucination problem of the large model to a certain extent.
[0175] An embodiment of the present disclosure provides a question-and-answer knowledge verification device 400, and the question-and-answer knowledge verification device 400 includes:
[0176] An acquisition module 410, configured to acquire a question text input by a user;
[0177] An input module 420, configured to input the question text into the target large language model to obtain an answer text corresponding to the question text; the target large language model is obtained based on the large language model generation method according to any one of claims 1-5;
[0178] A verification module 430, configured to verify the answer text corresponding to the question text based on an expert system knowledge base;
[0179] An output module 440, configured to output the answer text of the question text if the answer text passes the verification;
[0180] A knowledge recognition module 450, configured to recognize the answer text of the question text if the answer text fails to pass the verification.
[0181] As an optional implementation manner of an embodiment of the present disclosure, the language model correction device further includes:
[0182] A correction device, configured to, if the answer text fails to pass the verification, input the question text into the target large language model again. Within a preset number of times, if the answer texts generated by the target large language model all fail to pass the verification, a prompt message is output; the prompt message is used to prompt the user that the target large language model is temporarily unable to generate a correct answer.
[0183] The question-and-answer knowledge verification method provided by the present disclosure acquires a question text input by a user, inputs the question text into a target large language model to obtain an answer text corresponding to the question text, verifies the answer text corresponding to the question text based on an expert system knowledge base. If the answer text passes the verification, the answer text of the question text is output. If the answer text fails to pass the verification, the answer text of the question text is recognized. After the target large language model outputs the answer text, the answer text is verified based on the expert system knowledge base, and the output of the target large language model is intercepted and recognized. By increasing the result verification method, the risk controllability of the output is enhanced, and the hallucination problem of the large language model is solved to a certain extent.
[0184] For the specific limitations of the large language model generation device and the question and answer knowledge verification device, reference can be made to the limitations of the large language model generation method and the question and answer knowledge verification method in the above text, which will not be elaborated here. Each module in the above large language model generation device and question and answer knowledge verification device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in or independent of the processor of the electronic device in the form of hardware, or stored in the processor of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0185] Embodiments of the present disclosure also provide an electronic device. Figure 5 It is a schematic structural diagram of the electronic device provided by the embodiments of the present disclosure. As Figure 5 shown, the electronic device provided in this embodiment includes: a memory 51 and a processor 52. The memory 51 is used to store computer programs; the processor 52 is used to execute the steps performed in any of the embodiments of the fault identification method of the image acquisition device provided by the above method embodiments when calling the computer program. The electronic device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The computer program, when executed by the processor, implements a fault identification method for an image acquisition device. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen. The input device of the electronic device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0186] Those skilled in the art can understand that Figure 5 the structure shown in is only a block diagram of some structures related to the solution of the present disclosure, and does not constitute a limitation on the computer device to which the solution of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0187] In some embodiments, the large language model generation device provided by the present disclosure can be implemented in the form of a computer, and the computer program can run on an electronic device as Figure 5 shown. The computer program composed of each program module enables the processor to execute the steps in the fault identification method of the image acquisition device of the electronic device in each embodiment described in this specification.
[0188] Embodiments of the present disclosure also provide a computer-readable storage medium with a computer program stored thereon. When the computer program is executed by a processor, it implements the fault identification method of the image acquisition device provided in the above method embodiments.
[0189] Those skilled in the art should understand that the embodiments of the present disclosure may be provided as a method, a system, or a computer program product. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0190] The processor may be a central judgment unit (Central Processing Unit, CPU), or may also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0191] The memory may include non-permanent memory in the computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of, for example, read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
[0192] Computer-readable media include both permanent and non-permanent, removable and non-removable storage media. The storage media can implement information storage by any method or technology, and the information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0193] It should be noted that in this document, the terms "include", "comprise", or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements but also other elements not explicitly listed, or also includes elements inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device that includes the said element.
[0194] The above are only specific embodiments of the present disclosure, enabling those skilled in the art to understand or implement the present disclosure. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to these embodiments described herein, but rather will conform to the broadest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating a large language model, characterized in that, the method includes: Obtain the target professional field knowledge data collected from multiple data sources and construct a first training data set; the target professional field knowledge data is text data; Based on the first training data set, pre-train the initial large language model to obtain a preset large language model; Obtain the structured data of the target professional field knowledge data and construct a second training data set; Based on the second training data set, perform supervised fine-tuning training on the preset large language model to obtain a target large language model.
2. The method according to claim 1, characterized in that, the obtaining the structured data of the target professional field knowledge data and constructing a second training data set includes: Analyze the target professional field knowledge data and extract multiple entities and the attribute information corresponding to the multiple entities from the target professional field knowledge data; According to the association relationship between the attribute information of the multiple entities, construct multiple structured data of the target professional field knowledge data; According to the multiple structured data of the target professional field knowledge data, construct a second training data set.
3. The method according to claim 2, characterized in that, the constructing multiple structured data of the target professional field knowledge data according to the association relationship between the attribute information of the multiple entities includes: Obtain the names of multiple entities and the association relationship between the attribute information of the multiple entities, and generate multiple data question-and-answer pairs; Based on the multiple data question-and-answer pairs, construct multiple structured data of the target professional field knowledge data by extracting the relevant keywords in each data question-and-answer pair.
4. The method according to claim 3, characterized in that, the obtaining the names of multiple entities and the association relationship between the attribute information of the multiple entities and generating multiple data question-and-answer pairs includes: Based on at least two of the names of the multiple entities, construct the question of each question-and-answer pair in a preset format; Obtain the attribute information of the entity associated with the names of the at least two entities and construct the answer of each question-and-answer pair; Based on the question of each question-and-answer pair and the answer of each question-and-answer pair, construct multiple data question-and-answer pairs.
5. The method according to claim 4, characterized in that, the performing supervised fine-tuning training on the preset large language model based on the second training data set to obtain a target large language model includes: Input the question of each question-and-answer pair into the preset large language model to obtain the output answer of each question-and-answer pair; According to the output answer of each question-and-answer pair, the answer of each question-and-answer pair, and a preset loss function, adjust the weight parameters of the preset large language model to obtain a target large language model.
6. A method for verifying question-and-answer knowledge, characterized in that, the method includes: Obtain the question text input by the user; Input the question text into the target large language model to obtain the answer text corresponding to the question text; the target large language model is obtained based on the large language model generation method according to any one of claims 1-5. Verify the answer text corresponding to the problem text based on the expert system knowledge base; If the answer text passes the verification, output the answer text of the problem text; If the answer text fails the verification, identify the answer text of the problem text.
7. The method according to claim 6, wherein, when the answer text fails the verification, it further includes: If the answer text fails the verification, input the problem text into the target large language model again. Within a preset number of times, if the answer texts generated by the target large language model all fail the verification, output a prompt message; the prompt message is used to prompt the user that the target large language model is temporarily unable to generate the correct answer.
8. A large language model generation device, wherein, the large language model generation device includes: A first construction module for obtaining target professional field knowledge data collected from multiple data sources and constructing a first training data set; A pre-training module for pre-training an initial large language model based on the first training data set to obtain a preset large language model; A second construction module for obtaining structured data of the target professional field knowledge data and constructing a second training data set; A generation module for performing supervised fine-tuning training on the preset large language model based on the second training data set to obtain a target large language model.
9. A question and answer knowledge verification device, wherein, the question and answer knowledge verification device includes: An acquisition module for acquiring the problem text input by the user; An input module for inputting the problem text into the target large language model to obtain the answer text corresponding to the problem text; the target large language model is obtained based on the large language model generation method according to any one of claims 1-5; A verification module for verifying the answer text corresponding to the problem text based on the expert system knowledge base; An output module for outputting the answer text of the problem text if the answer text passes the verification; An identification module for identifying the answer text of the problem text if the answer text fails the verification.
10. A vehicle, wherein, it includes the large language model generation device according to claim 8, or the question and answer knowledge verification device according to claim 9.
11. An in-vehicle terminal includes a memory and a processor, and the memory stores a computer program, wherein, when the processor executes the computer program, it implements the large language model generation method according to any one of claims 1 to 5, or the question and answer knowledge verification method according to any one of claims 6-7.
12. A computer-readable storage medium, wherein, a computer program is stored thereon, and when the computer program is executed by a processor, it implements the large language model generation method according to any one of claims 1 to 5, or the question and answer knowledge verification method according to any one of claims 6-7.
Citation Information
Cited By
Large model workflow-based data processing and fine tuning data synthesis method, system and device, and medium
CN121053667A