Large language model training method

By converting the node and branch information of the decision tree into an encoded dictionary, the problem of excessive resource consumption during the training of large language models is solved, enabling smooth training and inference of the model while maintaining its general capabilities.

CN121457548APending Publication Date: 2026-02-03汤文巍
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410090901.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-23
Publication Date
2026-02-03

AI Technical Summary

Technical Problem

In existing technologies, large language models suffer from excessive resource consumption during training due to overly long decision trees, leading to difficulties in training or inference.

Method used

The node and branch information of the decision tree are converted into node dictionaries and branch dictionaries, respectively, and the jump relationships are converted into jump dictionaries. These dictionaries are used as training sets to fine-tune the large language model. The number of tokens and resource consumption are reduced by encoding representation.

Benefits of technology

This effectively reduces the number of tokens the model processes, decreases resource consumption, ensures smooth training and inference for large language models, and maintains the model's general-purpose capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121457548A_ABST
    Figure CN121457548A_ABST
Patent Text Reader

Abstract

The invention relates to a big language model training method, which comprises the following steps of: acquiring a decision tree, and respectively converting node information and branch information of the decision tree into a node dictionary and a branch dictionary; based on the node dictionary and the branch dictionary, converting the jump relation of the decision tree into a jump dictionary; converting the node dictionary, the branch dictionary and the jump dictionary into a preset format, and taking the converted node dictionary, branch dictionary and jump dictionary as a first training set; and performing fine tuning training on the large language model by adopting the first training set, so that the large language model realizes the decision-making capability of the decision-making tree. According to the method, the situation that training or reasoning cannot be completed due to excessive resource occupation can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method for training large language models. Background Technology

[0002] With the development of artificial intelligence technology, large language models have become an important research direction in the field of artificial intelligence. A large language model is a model that can understand and generate natural language. It can learn the rules and patterns of language by learning from a large amount of language data, thereby achieving the understanding and generation of natural language.

[0003] In order to enable large language models to make more professional decisions in specific scenarios and have better decision-making capabilities, decision trees for specific scenarios are made into training corpora to train large language models, so that the capabilities of decision trees are transformed into the capabilities of large language models.

[0004] The existing approach involves obtaining the decision conditions and results of the decision tree and using them as training data for the language model. However, this approach results in excessively long training data, for example: (1) when the decision tree is deep, there may be a large number of pre-decision conditions and results used as path records; (2) the decision conditions and results themselves contain a large amount of text. Using such text as input to a large language model may lead to the following problems: (a) exceeding the maximum number of input tokens preset by the language model; (b) memory overflow; (c) excessive computing power consumption. All of these problems will make the entire process difficult to proceed. Summary of the Invention

[0005] The technical problem to be solved by this invention is to provide a large language model training method that can reduce the number of tokens processed by the model and avoid the situation where training or inference cannot be completed due to excessive resource consumption.

[0006] The technical solution adopted by this invention to solve its technical problem is: to provide a large language model training method, including the following steps:

[0007] Obtain the decision tree, and convert the node information and branch information of the decision tree into a node dictionary and a branch dictionary, respectively;

[0008] Based on the node dictionary and branch dictionary, the jump relationships of the decision tree are converted into a jump dictionary;

[0009] The node dictionary, branch dictionary, and jump dictionary are converted into a preset format, and the converted node dictionary, branch dictionary, and jump dictionary are used as the first training set;

[0010] The large language model is fine-tuned using the first training set, so that the large language model can achieve the decision-making ability of the decision tree.

[0011] The key of the node dictionary is the node code, and the value is the node content. Each node in the decision tree has only one corresponding node code.

[0012] The key of the branch dictionary is the branch content, and the value is the branch code. The same branch content uses the same branch code.

[0013] The jump dictionary has keys that are combinations of parent nodes and branches, and values ​​that are child nodes. The parent nodes and child nodes are represented by the keys in the node dictionary, and the branches are represented by the values ​​in the branch dictionary.

[0014] The preset format of the node dictionary includes input information and output information, wherein the input information is the key of the node dictionary and the output information is the value of the node information.

[0015] The preset format of the branch dictionary includes input information and output information, wherein the input information is the key of the branch dictionary and the output information is the value of the branch dictionary.

[0016] The preset format of the jump dictionary includes input information and output information, wherein the input information is the key of the jump dictionary and the output information is the value of the jump dictionary.

[0017] Before fine-tuning the large language model using the first training set, the process further includes: preparing a general corpus as the second training set; and when fine-tuning the large language model using the first training set, adding the second training set to the first training set and fine-tuning the large language model together.

[0018] The large language model is either the GPT model, BERT model, LSTM model, or GRU model.

[0019] Beneficial effects

[0020] By employing the above-mentioned technical solution, this invention has the following advantages and positive effects compared with existing technologies: This invention transforms the content of decision tree nodes and branches into encoded representations. The encoding length can be much shorter than the original content, significantly reducing the number of tokens processed by the model. Simultaneously, it ensures that the encoding of each node is unique; that is, obtaining the encoding of a node is equivalent to obtaining the historical path, eliminating the need to add historical information to the model input. This further reduces the number of tokens processed by the model, significantly reducing resource consumption during training and ensuring the smooth training and inference of large language models. Furthermore, adding a general corpus to the large language model training set helps maintain the general capabilities of the large language model, reducing the loss of general capabilities caused by fine-tuning with decision tree corpora. This ensures that the final large language model can achieve both the capabilities of decision trees and perform routine tasks of large language models. Attached Figure Description

[0021] Figure 1 This is a flowchart of the large language model training method according to an embodiment of the present invention;

[0022] Figure 2 This is a schematic diagram of the decision tree used in the embodiments of the present invention;

[0023] Figure 3 This is a schematic diagram of the decision tree process of a large language model trained using the embodiments of the present invention. Detailed Implementation

[0024] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.

[0025] The embodiments of the present invention relate to a method for training a large language model, such as... Figure 1 As shown, it includes the following steps:

[0026] Step 1, Obtain the decision tree (see...) Figure 2 The node information and branch information of the decision tree are converted into a node dictionary and a branch dictionary, respectively.

[0027] In this step, the node and branch information of the decision tree are mapped to codes. These codes can use Arabic numerals or other formats. The final two dictionaries generated in this step are a node dictionary and a branch dictionary. In the node dictionary, the keys are the node codes, and the values ​​are the node content. Each node in the decision tree corresponds to a unique code. In the branch dictionary, the keys are the branch content, and the values ​​are the branch codes. Branches with the same content can share the same branch code. Figure 2 The node dictionary of the decision tree is shown in Table 1, and the branch dictionary is shown in Table 2.

[0028] Table 1. Node dictionary of the decision tree

[0029] Keys in the node dictionary The value of the node dictionary 1 City A 2 City B 3 City C 4 City D 5 City E 6 City F 7 City G 8 City H 9 City I 10 City J 11 City K 12 City L

[0030] Table 2 Branch Dictionary of Decision Trees

[0031] Keys of the branch dictionary The value of the branch dictionary Head south #1 Head east #2 Head north #3 head northeast #4

[0032] Step 2: Based on the node dictionary and branch dictionary, convert the jump relationships of the decision tree into a jump dictionary.

[0033] In this step, the decision tree's transition relationships are converted into a transition dictionary. The keys of the transition dictionary are combinations of parent nodes and branches, and the values ​​are child nodes. Nodes and branches, including parent and child nodes, are represented using the keys in the node dictionary, and branches are represented using the values ​​in the branch dictionary. Figure 2 Taking the decision tree shown as an example, the jump dictionary is shown in Table 3.

[0034] Table 3. Jump Dictionary for Decision Trees

[0035] Key to jump to dictionary Jump to dictionary value (1,#1) 2 (1,#2) 3 (1,#3) 4 (2,#1) 5 (2,#2) 6 (2,#4) 7 (4,#2) 8 (4,#3) 9 (6,#1) 10 (6,#2) 11 (6,#4) 12

[0036] Step 3: Convert the node dictionary, branch dictionary, and jump dictionary into a preset format, and use the converted node dictionary, branch dictionary, and jump dictionary as the first training set.

[0037] The preset formats in this step are divided into three types, used to represent the node dictionary, branch dictionary, and jump dictionary in the format required for the training corpus of the large language model. Format 1 is the preset format for the node dictionary, used to express the mapping between node codes and node content, including input and output information. The input information is the key of the node dictionary, and the output information is the value of the node information. Format 2 is the preset format for the branch dictionary, used to express the mapping between branch content and branch codes, including input and output information. The input information is the key of the branch dictionary, and the output information is the value of the branch dictionary. Format 3 is the preset format for the jump dictionary, used to express jump relationships, including input and output information. The input information is the key of the jump dictionary, and the output information is the value of the jump dictionary. In the input information, the code before the comma is the node code before the jump, the code after the comma is the branch code, and the output is the node code after the jump. Specific examples are as follows:

[0038] Format 1:

[0039] Input: (node ​​dictionary) 1

[0040] Output: City A

[0041] Format 2:

[0042] Input: (branch dictionary) Go east

[0043] Output: #2

[0044] Format 3:

[0045] Input: (jump to dictionary) 1, #2

[0046] Output: 3

[0047] In the three formats shown in the example, the content in parentheses indicates which dictionary information to retrieve. The input in all three formats is the input to the large language model, and the output is the output of the large language model (the target during training and inference), which serves as the first training set for the large language model.

[0048] Step 4: Fine-tune the large language model using the first training set. After fine-tuning, run the fine-tuned large language model according to the specified procedure to enable it to achieve the decision-making capability of the decision tree. Figure 3 As shown, in the specified process, the node recording mechanism records the current node, indicating the current position of the decision-making process. In this specified process, the initial input information is the branch content, and the final output information is the node content. This input information is transformed into output information through three processes of fine-tuning the trained large language model. Each input needs to be converted into the format in step 3, in the order of: format 2, format 3, format 1. Node recording information is needed when converting to format 3. When a specified process is completed, a jump to a decision tree node is completed.

[0049] It is easy to see that this invention transforms the content of decision tree nodes and branches into encoded representations. The encoding length can be much shorter than the original content, greatly reducing the number of tokens the model processes. At the same time, it makes the encoding of each node unique. That is, when the encoding of a node is obtained, it is equivalent to obtaining the historical path. There is no need to add historical information to the model input, further reducing the number of tokens the model processes. This significantly reduces the resources consumed during training and ensures the smooth training and inference of large language models.

[0050] It is worth mentioning that, in order to maintain the general capabilities of the large language model after fine-tuning, this implementation method includes a step of preparing a general corpus as a second training set between steps 3 and 4. When subsequently fine-tuning the large language model using the first training set, the second training set is added to the first training set for joint fine-tuning. Therefore, this implementation method, by adding a general corpus to the large language model training set, helps maintain the general capabilities of the large language model, reduces the loss of general capabilities caused by fine-tuning with decision tree corpus, and ensures that the finally trained large language model can achieve both the capabilities of decision trees and perform routine tasks of large language models.

[0051] Additionally, it should be noted that the large language models used in this implementation include, but are not limited to, GPT, BERT, LSTM, and GRU models.

Claims

1. A method for training a large language model, characterized in that, Includes the following steps: Obtain the decision tree, and convert the node information and branch information of the decision tree into a node dictionary and a branch dictionary, respectively; Based on the node dictionary and branch dictionary, the jump relationships of the decision tree are converted into a jump dictionary; The node dictionary, branch dictionary, and jump dictionary are converted into a preset format, and the converted node dictionary, branch dictionary, and jump dictionary are used as the first training set; The large language model is fine-tuned using the first training set, so that the large language model can achieve the decision-making ability of the decision tree.

2. The large language model training method according to claim 1, characterized in that, The key of the node dictionary is the node code, and the value is the node content. Each node in the decision tree has only one corresponding node code.

3. The large language model training method according to claim 1, characterized in that, The key of the branch dictionary is the branch content, and the value is the branch code. The same branch content uses the same branch code.

4. The large language model training method according to claim 1, characterized in that, The jump dictionary has a key that is a combination of a parent node and a branch, and a value that is a child node. The parent node and child node are represented by the key in the node dictionary, and the branch is represented by the value in the branch dictionary.

5. The large language model training method according to claim 1, characterized in that, The preset format of the node dictionary includes input information and output information, wherein the input information is the key of the node dictionary and the output information is the value of the node information.

6. The large language model training method according to claim 1, characterized in that, The preset format of the branch dictionary includes input information and output information, wherein the input information is the key of the branch dictionary and the output information is the value of the branch dictionary.

7. The large language model training method according to claim 1, characterized in that, The preset format of the jump dictionary includes input information and output information, wherein the input information is the key of the jump dictionary and the output information is the value of the jump dictionary.

8. The large language model training method according to claim 1, characterized in that, Before fine-tuning the large language model using the first training set, the method further includes: preparing a general corpus as the second training set; when fine-tuning the large language model using the first training set, adding the second training set to the first training set and fine-tuning the large language model together.

9. The large language model training method according to claim 1, characterized in that, The large language model is either the GPT model, BERT model, LSTM model, or GRU model.