Large language model training method for golden wine knowledge questions and answers

By simplifying the parameter scale of the large language model and introducing the deep learning model of the importance of gin wine knowledge, dynamically adjusting the proportion of training data, the problem of poor Q&A effect in the field of gin wine professional knowledge is solved, and efficient model fine-tuning and accurate Q&A effects are achieved.

CN119646515APending Publication Date: 2025-03-18SHANGHAI YUEXUAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411792969.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-08
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The existing large language models have poor Q&A in the field of gin wine expertise, and cannot have a deep understanding of professional knowledge. In addition, the model fine-tuning requires a large amount of manual data cleaning and hyperparameter adjustment, which is inefficient.

Method used

A large language model training method for gin wine knowledge Q&A is proposed. By simplifying the parameter scale of pre-trained large language model, and introducing the deep learning model of gin wine knowledge importance, dynamically adjusting the proportion of training data and improving model performance.

Benefits of technology

It has achieved a significant reduction in time cost without manual review of gin wine expertise, dynamically adjusting the weight of training data, and improving the accuracy of gin wine questions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646515A_ABST
    Figure CN119646515A_ABST
Patent Text Reader

Abstract

According to the big language model training method for Jinjiang knowledge questions and answers designed by the invention, a simplified pre-training big language model is designed to provide basic text completion and logic dialogue ability, the training cost is greatly reduced, and a Jinjiang knowledge importance deep learning model is constructed. The professional knowledge of the golden wine does not need to be manually reviewed, and the time cost is greatly reduced. Through the above design, the big language model training method for Jinjiang knowledge questions and answers designed by the application can dynamically adjust the weight of the training data, effectively realize fine adjustment of model parameters, and further improve the question and answer accuracy of Jinjiang questions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of data processing, and in particular relates to a large language model training method for gin knowledge question and answer. Background Art

[0002] Large Language Model (LLM) is an artificial intelligence model based on deep learning, which is usually trained with a large amount of text data to generate natural language text, answer questions, translate language, etc. Representatives of large language models include OpenAI's GPT series, Google's BERT, T5, etc. These models can understand and generate human-like language by learning massive amounts of text data.

[0003] Although the large language model has demonstrated certain general performance, its performance in some vertical segments is still insufficient. For example, in the field of gin expertise, a lot of expertise data comes from within gin manufacturing companies and is usually not disclosed to the public. This makes it impossible for the large language model to truly understand more expertise during the pre-training process. On the other hand, with the development of time, the knowledge in the field of gin will also expand. If the parameters of the pre-trained large language model are updated synchronously, it will take a lot of time and money, and the purpose of real-time updating cannot be achieved. Therefore, the performance of the pre-trained large language model in the question-and-answer effect of gin expertise is average, and it only stays at the level of general public knowledge, making it difficult to form an in-depth understanding.

[0004] In order to solve the problems at the above two levels, the common solution in the industry is to fine-tune the parameters of the existing pre-trained large language model or use the knowledge base of gin for retrieval. However, when fine-tuning the model, it is impossible to distinguish the importance of gin professional knowledge, and it is time-consuming and inefficient to clear manual data; and the weight of gin professional data in the model fine-tuning stage depends on experience adjustment, and the hyperparameter adjustment efficiency is low. Therefore, the fine-tuning of the large language model for gin professional knowledge still cannot meet the production usage standards in actual applications, and the accuracy of question answering needs to be further improved. Summary of the invention

[0005] In order to solve the above problems, the present invention proposes a large language model training method for gin knowledge quiz, which on the one hand simplifies the parameter scale of the pre-trained large language model, and on the other hand dynamically adjusts the proportion of training data by introducing a deep learning model of the importance of gin knowledge, thereby improving the overall performance of the final large language model.

[0006] A large language model training method for gin knowledge question answering, comprising the following steps:

[0007] Step S1: construct a pre-trained large language model and train the pre-trained large language model;

[0008] Step S2, constructing a deep learning model of the importance of gin knowledge;

[0009] Step S3: Use the pre-trained large language model as the base model and freeze all parameter values; use the low-rank decomposition model to add additional trainable model parameters on the basis of the base model to obtain a hybrid model;

[0010] Step S4: select training data and pass it into the deep learning model of gin knowledge importance as input to obtain the importance weight parameter of each parameter;

[0011] Step S5: pass the training data into the hybrid model to obtain the loss function value; multiply the loss function value by the corresponding importance weight parameter, and pass the obtained value to the low-rank decomposition model for dynamic adjustment;

[0012] Step S6: Repeat the process from step S4 to step S5 until the training converges to obtain the final large language model.

[0013] Preferably, the method for constructing the pre-trained large language model includes:

[0014] Step S101, fixing the number of layers of the existing large language model to 16;

[0015] Step S102, modifying the position encoding of the large language model to RoPE relative position encoding;

[0016] Step S103: modify the normalization method of the large language model to a post-layer normalization method.

[0017] Preferably, the feedforward network layer of the pre-trained large language model includes: two linear transformations and one non-linear activation function.

[0018] Preferably, the activation function uses a SwiGLU function.

[0019] Preferably, the attention mechanism network is defined as:

[0020]

[0021] Where Q = W q *F, K = W k *F, V = W v *F, F represents the latent space state of the text after word embedding, W q is the query parameter matrix, W k is the key parameter matrix, W vis the value parameter matrix, d is the size of the feature vector dimension, Q is the query vector, K is the key vector, and V is the value vector.

[0022] Preferably, the training method of the pre-trained large language model includes:

[0023] Step S111: For a given word sequence u={u t , ..., u t}, the goal of the language modeling task is defined as the word prediction task:

[0024] Step S112: based on the word sequence u before the current position in the sequence <t , using autoregressive method for the target word u t Make predictions;

[0025] Step S113: During the training process, the model is usually optimized according to the likelihood function of formula (2):

[0026]

[0027] Among them, P(u t |u <t ) means that given an input text word sequence u <t Next, output the next word u t The probability of, log represents the logarithmic operation, It means that a word sequence with an input length of T is decomposed into T segments, and the logarithm of the word output probability of each segment is superimposed to obtain the final loss function L(u);

[0028] Step S114: The training data is passed into the model in batches of 256, and finally the AdamW optimizer is used to iteratively optimize and update the network model parameters.

[0029] Preferably, the method for constructing the deep learning model of the importance of gin knowledge includes:

[0030] Step S21, inputting the input data text into the encoder, the encoder converts the input data text into a word vector, and inputs the word vector and the professional data vector corresponding to the input data text into the cross attention mechanism network together;

[0031] Step S22: the cross attention mechanism network fuses the word vector and the professional data vector together to obtain a fused feature vector, and transmits the fused feature vector to the fully connected network;

[0032] Step S23, the fully connected network processes the fused feature vector to obtain an importance score value q;

[0033] Step S24: The obtained importance score q and the manually annotated importance score q' together form a mean square error loss function:

[0034] L(q,q′)=E[(qq′) 2 ]

[0035] Among them, E represents the expectation of the data set; finally, the Adam optimizer is used to iteratively optimize and update the network model parameters.

[0036] The advantages and effects of this application are as follows:

[0037] The present application designs a large language model training method for gin knowledge question and answer, including: step S1, constructing a pre-trained large language model, and training the pre-trained large language model; step S2, constructing a deep learning model of gin knowledge importance; step S3, using the pre-trained large language model as a base model, and freezing all parameter values; using a low-rank decomposition model to add additional trainable model parameters on the basis of the base model to obtain a hybrid model; step S4, selecting training data, passing it into the deep learning model of gin knowledge importance as input, and obtaining the importance weight parameter of each parameter; step S5, passing the training data into the hybrid model to obtain the loss function value; multiplying the loss function value by the corresponding importance weight parameter, and passing the obtained value to the low-rank decomposition model for dynamic adjustment; step S6, repeating the process from step S4 to step S5 until the training converges to obtain the final large language model. The present application designs a simplified pre-trained large language model to provide basic text completion and logical dialogue capabilities, greatly reducing the training cost, and constructing a deep learning model of gin knowledge importance, realizing the need for manual review of gin professional knowledge, and greatly reducing the time cost. Through the above design, a large language model training method for gin knowledge question and answer designed in this application can dynamically adjust the weight of training data, effectively realize model parameter fine-tuning, and thus improve the accuracy of gin question and answer.

[0038] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application so that it can be implemented in accordance with the contents of the specification, and to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the following is a detailed description of the preferred embodiments of the present application in conjunction with the accompanying drawings as follows.

[0039] Based on the detailed description of the specific embodiments of the present application in combination with the accompanying drawings below, those skilled in the art will become more aware of the above and other objects, advantages and features of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings without creative work. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, each element or part is not necessarily drawn according to the actual scale.

[0041] Figure 1 A flowchart of a large language model training method for gin knowledge question and answer designed for this application;

[0042] Figure 2 Diagram of the construction structure of the deep learning model of gin knowledge importance designed for this application;

[0043] Figure 3 Flowchart for fine-tuning model parameters for the Gin Quiz designed for this application. DETAILED DESCRIPTION

[0044] To make the purpose, technical scheme and advantages of the embodiment of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiment of the present application. Obviously, the described embodiment is a part of the embodiment of the present application, rather than all of the embodiments. In the following description, specific details such as specific configuration and components are provided only to help fully understand the embodiments of the present application. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. In addition, for clarity and brevity, the description of known functions and structures is omitted in the embodiment.

[0045] It should be understood that the references to "one embodiment" or "this embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "one embodiment" or "this embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0046] In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplicity and clarity, and does not in itself indicate the relationship between the various embodiments and / or settings discussed.

[0047] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist at the same time. The term " / and" in this article describes another type of association object relationship, indicating that there can be two relationships. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " in this article generally indicates that the previous and next associated objects are in an "or" relationship.

[0048] The term "at least one" in this article is merely a description of the association relationship of associated objects, indicating that there may be three relationships. For example, at least one of A and B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0049] It should also be noted that, in this article, relational terms such as first and second, etc. 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. Moreover, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusions.

[0050] Example:

[0051] At present, the parameters of the mainstream pre-trained large language models in the industry are all over 10 billion, and some even reach the level of 100 billion. A complete training of such a large language model usually takes several weeks to several months, and the hardware requirements are also high, with an overall cost of about several million to tens of millions of dollars. Different from the universality pursued by such large language models, the large language model for gin domain knowledge only needs to ensure basic language logic, while expanding knowledge in a fixed vertical field. Therefore, based on different functional requirements, the requirements for data and parameter scale of large language models are also different.

[0052] Please refer to Figure 1 and Figure 3 This embodiment mainly introduces a large language model training method for gin knowledge question answering, including the following steps:

[0053] Step S1: construct a pre-trained large language model and train the pre-trained large language model;

[0054] Step S2, constructing a deep learning model of the importance of gin knowledge;

[0055] Step S3: Use the pre-trained large language model as the base model and freeze all parameter values; use the low-rank decomposition model to add additional trainable model parameters on the basis of the base model to obtain a hybrid model;

[0056] Step S4: select training data and pass it into the deep learning model of gin knowledge importance as input to obtain the importance weight parameter of each parameter;

[0057] Step S5: pass the training data into the hybrid model to obtain the loss function value; multiply the loss function value by the corresponding importance weight parameter, and pass the obtained value to the low-rank decomposition model for dynamic adjustment;

[0058] Step S6: Repeat the process from step S4 to step S5 until the training converges to obtain the final large language model.

[0059] Furthermore, for the training data of deep learning models, the importance of each data is usually different. However, the evaluation of the importance of training data has its own definition in different fields and functional categories, and there is no unified standard. The common method in the industry is to use manual labeling, but this requires a lot of manual effort and requires data labelers to have certain professional knowledge, and the overall efficiency is relatively low. Therefore, please refer to Figure 2 , the method for constructing the pre-trained large language model described in this application includes:

[0060] Step S101, fixing the number of layers of the existing large language model to 16;

[0061] Step S102, modifying the position encoding of the large language model to RoPE relative position encoding;

[0062] Step S103: modify the normalization method of the large language model to a post-layer normalization method.

[0063] Furthermore, the feedforward network layer of the pre-trained large language model includes: two linear transformations and one nonlinear activation function.

[0064] Furthermore, the activation function uses the SwiGLU function.

[0065] Furthermore, the definition of the attention mechanism network is:

[0066]

[0067] Where Q = W q *F, K = W k *F, V = W v *F, F represents the latent space state of the text after word embedding, W q is the query parameter matrix, W k is the key parameter matrix, W v is the value parameter matrix, d is the size of the feature vector dimension, Q is the query vector, K is the key vector, and V is the value vector.

[0068] Furthermore, the training method of the pre-trained large language model includes:

[0069] Step S111: For a given word sequence u={u t , ..., u t}, the goal of the language modeling task is defined as the word prediction task:

[0070] Step S112: based on the word sequence u before the current position in the sequence <t , using autoregressive method for the target word u t Make predictions;

[0071] Step S113: During the training process, the model is usually optimized according to the likelihood function of formula (2):

[0072]

[0073] Among them, P(u t |u <t ) means that given an input text word sequence u <t Next, output the next word u t The probability of, log represents the logarithmic operation, It means that a word sequence with an input length of T is decomposed into T segments, and the logarithm of the word output probability of each segment is superimposed to obtain the final loss function L(u);

[0074] Step S114: The training data is passed into the model in batches of 256, and finally the AdamW optimizer is used to iteratively optimize and update the network model parameters.

[0075] Furthermore, the method for constructing the deep learning model of the importance of gin knowledge includes:

[0076] Step S21, inputting the input data text into the encoder, the encoder converts the input data text into a word vector, and inputs the word vector and the professional data vector corresponding to the input data text into the cross attention mechanism network together;

[0077] Step S22: the cross attention mechanism network fuses the word vector and the professional data vector together to obtain a fused feature vector, and transmits the fused feature vector to the fully connected network;

[0078] Step S23, the fully connected network processes the fused feature vector to obtain an importance score value q;

[0079] Step S24: The obtained importance score q and the manually annotated importance score q' together form a mean square error loss function:

[0080] L(q,q′)=E[(qq′) 2 ]

[0081] Among them, E represents the expectation of the data set; finally, the Adam optimizer is used to iteratively optimize and update the network model parameters.

[0082] The large language model training method designed by the present application for gin knowledge question and answer has constructed a simplified pre-trained large language model to provide basic text completion and logical dialogue capabilities, which greatly reduces the training cost. At the same time, the present application has also constructed a deep learning model of the importance of gin knowledge, which realizes the need for manual review of gin professional knowledge, greatly reducing the time cost. Through the above design, the large language model training method designed by the present application for gin knowledge question and answer can realize dynamic adjustment of the weight of training data, effectively realize fine-tuning of model parameters, and thus improve the accuracy of question and answer of gin questions.

[0083] The above description is only the preferred embodiment of the present invention, which does not limit the protection scope of the present invention. For those skilled in the art, the present invention can be modified and varied in various ways. Within the spirit and principle of the present invention, any change, modification, replacement, integration and parameter change of these embodiments by conventional substitution or capable of achieving the same function without departing from the principle and spirit of the present invention shall fall within the protection scope of the present invention.

Claims

1. A large language model training method for gin knowledge question answering, characterized in that: The following steps are involved: Step S1: construct a pre-trained large language model and train the pre-trained large language model; Step S2, constructing a deep learning model of the importance of gin knowledge; Step S3: Use the pre-trained large language model as the base model and freeze all parameter values; Use the low-rank decomposition model to add additional trainable model parameters on the basis of the base model to obtain a hybrid model; Step S4: select training data and pass it into the deep learning model of gin knowledge importance as input to obtain the importance weight parameter of each parameter; Step S5: pass the training data into the hybrid model to obtain the loss function value; multiply the loss function value by the corresponding importance weight parameter, and pass the obtained value to the low-rank decomposition model for dynamic adjustment; Step S6: Repeat the process from step S4 to step S5 until the training converges to obtain the final large language model.

2. A large language model training method for gin knowledge question and answer according to claim 1, characterized in that: The method for constructing the pre-trained large language model includes: Step S101, fixing the number of layers of the existing large language model to 16; Step S102, modifying the position encoding of the large language model to RoPE relative position encoding; Step S103: modify the normalization method of the large language model to a post-layer normalization method.

3. A large language model training method for gin knowledge question and answer according to claim 2, characterized in that: The feedforward network layer of the pre-trained large language model includes: two linear transformations and a nonlinear activation function.

4. A large language model training method for gin knowledge question and answer according to claim 2, characterized in that: The activation function uses the SwiGLU function.

5. A large language model training method for gin knowledge question and answer according to claim 2, characterized in that: The definition of the attention mechanism network is: Where Q = W q *F, K = W k *F, V = W v *F, F represents the latent space state of the text after word embedding, W q is the query parameter matrix, W k is the key parameter matrix, W v is the value parameter matrix, d is the size of the feature vector dimension, Q is the query vector, K is the key vector, and V is the value vector.

6. A large language model training method for gin knowledge question and answer according to claim 2, characterized in that: The training method of the pre-trained large language model includes: Step S111: For a given word sequence u={u t , ..., u t }, the goal of the language modeling task is defined as the word prediction task: Step S112: based on the word sequence u before the current position in the sequence <t , using autoregressive method for the target word u t Make predictions; Step S113: During the training process, the model is usually optimized according to the likelihood function of formula (2): Among them, P(u t |u <t ) means that given an input text word sequence u <t Next, output the next word u t The probability of, log represents the logarithmic operation, It means that a word sequence with an input length of T is decomposed into T segments, and the logarithm of the word output probability of each segment is superimposed to obtain the final loss function L(u); Step S114: The training data is passed into the model in batches of 256, and finally the AdamW optimizer is used to iteratively optimize and update the network model parameters.

7. A large language model training method for gin knowledge question and answer according to claim 2, characterized in that: The method for constructing the deep learning model of the importance of gin knowledge includes: Step S21, inputting the input data text into the encoder, the encoder converts the input data text into a word vector, and inputs the word vector and the professional data vector corresponding to the input data text into the cross attention mechanism network together; Step S22: the cross attention mechanism network fuses the word vector and the professional data vector together to obtain a fused feature vector, and transmits the fused feature vector to the fully connected network; Step S23, the fully connected network processes the fused feature vector to obtain an importance score value q; Step S24: The obtained importance score q and the manually annotated importance score q' together form a mean square error loss function: L(q,q′)=E[(q-q′) 2 ] Among them, E represents the expectation of the data set; finally, the Adam optimizer is used to iteratively optimize and update the network model parameters.