A scalable large model training and inference method, device, equipment and medium

By optimizing large-model training and inference through stacked model structures and autonomous dynamic discriminators, the problem of high resource consumption and low efficiency of large models is solved, and a trade-off between accuracy and speed is achieved. It is suitable for various stacked large-model structures.

CN119940525BActive Publication Date: 2025-10-21SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411847995.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-10-21
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

Large models consume a lot of resources during training and inference, resulting in inefficiency and difficulty in application in resource-constrained environments. Existing acceleration methods usually sacrifice model performance or increase system complexity.

Method used

It adopts a stacked model structure and an autonomous dynamic discriminator, optimizes the training process by autonomously selecting the number of sub-models and penalty terms, achieves a trade-off between accuracy and speed during the model's inference process, and reduces resource waste.

Benefits of technology

It improves the efficiency of the large model inference process, saves resource consumption, and ensures model accuracy and interactive experience. It is suitable for various stacked large model structures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119940525B_ABST
    Figure CN119940525B_ABST
Patent Text Reader

Abstract

The application discloses a scalable large model training and reasoning method and device, equipment and a medium, wherein the method comprises: obtaining text data and constructing a training set; constructing a large model, the large model being a stacked model structure sharing knowledge in the horizontal direction, and the large model comprising a plurality of sub-models; constructing an autonomous dynamic discriminator, the output of each sub-model being input into the autonomous dynamic discriminator, and the output of the autonomous dynamic discriminator being used as the final model prediction; and training the large model by using the training set, and using the trained large model to implement a text generation task. The application aims to realize autonomous selection of sub-models by the model, autonomously selects the number of sub-models participating in reasoning through the autonomous dynamic discriminator, thereby improving the efficiency of the large model reasoning process, realizing the trade-off between precision and speed, and saving model reasoning resource consumption. The application can be widely applied in the field of artificial intelligence technology.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an scalable large-scale model training and reasoning method, device, equipment and medium. Background Art

[0002] Large models demonstrate powerful text generation capabilities in today's lives and have widespread practical application in fields such as news creation, social media content creation, and intelligent customer service. However, due to the large number of parameters and computational complexity of large models, the training and inference processes consume a lot of time and computing resources, making them difficult to use. Furthermore, large models have a large parameter scale, requiring massive amounts of training data and powerful computing resources. The training process often takes weeks or even months and consumes a huge amount of computing resources. This not only limits the efficiency of large models in practical applications but also poses significant challenges to computing power and energy consumption. Furthermore, large models typically require longer inference times, making their deployment and use complex and expensive, limiting their application in resource-constrained environments. Therefore, there is an urgent need to research key technologies to accelerate the inference of large models to reduce resource consumption and promote the sustainable development of artificial intelligence technology.

[0003] In the field of deep learning, large pre-trained models are widely used due to their powerful performance, but efficiency and resource consumption during inference remain a major challenge. Traditional inference techniques often rely on full-model inference, resulting in slow response times and high computational costs. Furthermore, while model compression and distributed inference can improve speed to some extent, these methods often sacrifice model performance and increase system complexity. Existing solutions are particularly insufficient in applications requiring real-time response, lack flexibility, and struggle to adapt to rapidly changing application environments. Therefore, exploring new accelerated inference technologies is particularly important. Summary of the Invention

[0004] In order to solve at least one of the technical problems existing in the prior art to a certain extent, the purpose of the present invention is to provide a scalable large-model training and inference method, device, equipment and medium based on an autonomous dynamic discriminator.

[0005] The first technical solution adopted by the present invention is:

[0006] A scalable large model training and inference method includes the following steps:

[0007] Obtain text data and build a training set;

[0008] Constructing a large model, wherein the large model is a stacked model structure that performs knowledge sharing in a horizontal direction, and the large model includes multiple sub-models;

[0009] Build an autonomous dynamics discriminator. The output of each sub-model will be input into the autonomous dynamics discriminator, and the output of the autonomous dynamics discriminator will serve as the final model prediction.

[0010] The training set is used to train the large model, and the trained large model is used to implement text generation tasks.

[0011] Furthermore, the multiple sub-models adopt different encoder architectures.

[0012] Furthermore, the autonomous dynamic discriminator works as follows:

[0013] The autonomous dynamic discriminator records the threshold content, autonomously divides the prediction results according to the number of sub-models, and updates the division threshold in real time based on samples during the inference process.

[0014] Furthermore, the training process of the large model is as follows:

[0015] First, use part of the training data to pre-train the first sub-model separately. The expression is:

[0016] x1=Submodel0(tokenizer(x0))

[0017] Where x0 is the initial input of the model, representing the initial input sequence of the text generation task; tokenizer is a word segmenter, which is used to convert the original input data into a format that can be processed by the model; x1 is the output after passing through the first sub-model, and Submodel0 is the first sub-model;

[0018] The output x1 is further input to the autonomous dynamic discriminator, and the expression is:

[0019] y=Discriminator(x1)

[0020] Where, Discriminator is the autonomous dynamic discriminator, and y is the final prediction result;

[0021] After pre-training converges, the weights of the first sub-model are shared with the remaining sub-models, effectively avoiding the waste of resources caused by redundantly learning shared knowledge from scratch for different sub-models.

[0022] Then the entire model is trained: First, for the initial input x0, each sub-model will get an output x i , where x i+1 =Submodel i (x i ), thus we get x0,…,x i ; After getting each x iAfter that, they will be further input into the autonomous dynamic discriminator to obtain the prediction result y i , and back-propagate to update the parameters of the sub-model. The mathematical expression is:

[0023]

[0024] Where, Represents the stop_gradient operation, that is, the subsequent sub-model will freeze the previous sub-model when updating the parameters, to prevent the previously learned sub-model parameters from being interfered with by the subsequent sub-model learning, and thus prevent the forgetting problem.

[0025] Furthermore, the process of large model training also includes the following steps:

[0026] When the entire model is trained, penalty terms of the same form are added to sub-models at different levels. When the confidence of the output result of the latter sub-model is less than that of the previous sub-model, the latter sub-model is penalized in the loss function. In the optimization process, the output capabilities of sub-models at different levels are distinguished, thereby realizing the network's autonomous model scale selection.

[0027] Furthermore, for the sub-models at different levels, penalty terms of the same form are added, including:

[0028] Two loss function penalty terms are added:

[0029] The first is the hierarchical loss, which introduces different weight coefficients for the prediction loss of each layer, so that the top-level encoder has a higher weight in the loss function; the prediction loss of each sub-model is L i , the loss is defined as:

[0030]

[0031] Where w i is the weight;

[0032] The second is the level consistency penalty:

[0033]

[0034] Where p i is the predicted distribution of the i-th sub-model;

[0035] Through these two penalty terms, we can achieve a higher confidence level in the model output as the sub-models are stacked, and at the same time make the predictions of the lower-level sub-models closer to the predictions of the higher-level sub-models, while ensuring the overall improvement. The final loss is defined as:

[0036] Loss=Layer Loss+Consistency Penalty

[0037] Furthermore, the large model works as follows during the inference phase:

[0038] During the inference phase, the autonomous dynamic discriminator maintains a threshold statistic τ0,…,τ for each sub-model n ,in:

[0039] τ i =μ i +k·σ i

[0040] Where μ i is the mean of the confidence of the i-th sub-model, σ i is the standard deviation, and k is an adjustable hyperparameter used to control the strictness of exit;

[0041] When the input data passes through the model, the output confidence c of each layer of sub-model is calculated i , for each layer i, compare its output confidence c i and the preset threshold τ i , if c i >τ i , then the layer is considered to have a sufficiently confident prediction, exits early, and outputs the prediction result; otherwise, the input is passed to the next sub-model until the confidence of a certain layer of sub-model reaches the threshold or reaches the last layer of sub-model;

[0042] Finally, the autonomous dynamic discriminator obtains the output results of multiple sub-models and further integrates them to obtain the next token prediction:

[0043]

[0044] Where y i is the output of each sub-model, L is the number of sub-models;

[0045] This will enable the integration of predictions from each sub-model. Sub-models with higher confidence will contribute more to the final prediction, and the entire text generation task will be completed in a cycle, achieving interaction between humans and machines.

[0046] The second technical solution adopted by the present invention is:

[0047] A scalable large-model training and inference device, comprising:

[0048] Data acquisition module, used to obtain text data and build training sets;

[0049] A model building module is used to build a large model. The large model is a stacked model structure that performs knowledge sharing in the horizontal direction. The large model includes multiple sub-models.

[0050] The discriminator construction module is used to build an autonomous dynamic discriminator. The output of each sub-model will be input into the autonomous dynamic discriminator, and the output of the autonomous dynamic discriminator will serve as the final model prediction;

[0051] The model training module is used to train the large model using the training set, and use the trained large model to implement text generation tasks.

[0052] The third technical solution adopted by the present invention is:

[0053] An electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, at least one program, the code set, or the instruction set is loaded and executed by the processor to implement a scalable large-model training inference method as described above.

[0054] The fourth technical solution adopted by the present invention is:

[0055] A computer-readable storage medium storing at least one instruction, at least one program, a code set, or an instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement a scalable large-model training inference method as described above.

[0056] The fifth technical solution adopted by the present invention is:

[0057] A computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium and execute the computer instructions, causing the computer device to perform the aforementioned scalable large-model training and inference method.

[0058] The beneficial effects of the present invention are: the present invention aims to realize the autonomous selection of sub-models by the model, and autonomously selects the number of sub-models participating in reasoning through the autonomous dynamic discriminator, thereby improving the efficiency of the large model reasoning process, achieving a trade-off between accuracy and speed, and saving model reasoning resource consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following introduction is made to the drawings of the embodiments of the present invention or the related technical solutions in the prior art. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solutions of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative work.

[0060] Figure 1 This is a flowchart of the steps of a scalable large model training and reasoning method in an embodiment of the present invention;

[0061] Figure 2 It is a structural design diagram of an expandable large model in an embodiment of the present invention. DETAILED DESCRIPTION

[0062] The embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention and are not to be construed as limiting the present invention. The step numbers in the following embodiments are provided for ease of explanation only and do not limit the order of the steps. The order of execution of the steps in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.

[0063] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, they cannot be understood as limitations on the present invention.

[0064] In the description of the present invention, "several" means one or more, "many" means more than two, "greater than," "less than," and "exceed" are understood to exclude the number itself, while "above," "below," and "within" are understood to include the number itself. The use of "first" and "second" in the description is solely for the purpose of distinguishing technical features and should not be construed as indicating or implying relative importance, implicitly specifying the number of the indicated technical features, or implicitly specifying the order of the indicated technical features.

[0065] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, and connecting should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.

[0066] Example 1

[0067] like Figure 1 As shown, this embodiment provides a scalable large-model training and inference method based on an autonomous dynamic discriminator, which solves the problem of huge resource consumption and low efficiency of existing large-model training and inference. It allows large models to balance accuracy and speed during the training and inference process, thereby improving model service efficiency. The method specifically includes the following steps:

[0068] S1. Obtain text data and build a training set.

[0069] S2. Construct a large model. The large model is a stacked model structure that performs knowledge sharing in the horizontal direction. The large model includes multiple sub-models.

[0070] This step mainly involves designing an extensible model structure to achieve an efficient and extensible model structure, thereby ensuring that the model can balance accuracy and speed during reasoning.

[0071] Specifically, see Figure 2 In order to make the model structure scalable, this embodiment designs a stacked model structure that shares knowledge in the horizontal direction. Each sub-model is responsible for converting the input sequence into sequence features. Different encoder architectures can be used here, common ones include Transformer-based architectures (such as BERT, RoBERTa, BART, etc.). Each sub-model has its own output, which is further output to the autonomous dynamic discriminator to obtain the final prediction result. For example, in order to maintain the convenience of semantic information transmission between sub-models, all sub-models adopt exactly the same model architecture and are expanded in the horizontal direction. The sub-models transfer information by directly connecting the output of each module of the previous sub-model to the parallel modules of the next sub-network through the output of each module of the previous sub-model to achieve efficient semantic sharing.

[0072] S3. Build an autonomous dynamic discriminator. The output of each sub-model will be input into the autonomous dynamic discriminator, and the output of the autonomous dynamic discriminator will serve as the final model prediction.

[0073] An autonomous dynamic discriminator is constructed to regulate the confidence levels between sub-models during training to achieve an even distribution of tasks.

[0074] Specifically, to enable the large model to autonomously select the number of sub-models to use during inference based on the complexity of the task, this embodiment constructs an autonomous dynamic discriminator. During the training phase, training samples pass through the model, and each sub-model generates an output, with the number of outputs equal to the number of sub-models. These outputs are all fed into the autonomous dynamic discriminator. The output is the final model prediction, which is then back-propagated based on the dataset labels. Given the stacked structure, subsequent sub-models will affect the parameter updates of the previous sub-models during back-propagation. Therefore, when updating the model parameters based on the output of each sub-model, the parameters of the previous sub-model are frozen. As a result, during the training phase, each sample can update all model parameters, and each sub-model can make predictions. During the inference phase, an ideal discriminator should be able to equally divide the input space into each sub-model to achieve the optimal allocation requirements. Therefore, the autonomous dynamic discriminator records the threshold content, autonomously divides the prediction results according to the number of sub-models, and updates the division threshold in real time based on the samples during the inference process.

[0075] S4. Use the training set to train the large model, and use the trained large model to implement the text generation task.

[0076] During the model training and inference process, due to the large number of sub-models, this embodiment proposes an efficient model training and inference algorithm.

[0077] In some embodiments, during the training phase, the first sub-model is pre-trained using part of the training data. The mathematical expression is:

[0078] x1=Submodel0(tokenizer(x0))

[0079] Among them, x0 is the initial input of the model, representing the initial input sequence of the text generation task, tokenizer is the word segmenter, which is used to convert the original input data into a format that the model can process, x1 is the output after passing through the first sub-model, and Submodel0 is the first sub-model. This output is further input to the autonomous dynamic discriminator:

[0080] y=Discriminator(x1)

[0081] Here, Discriminator is the autonomous dynamic discriminator, and y is the final prediction result. After pre-training converges, the weights of the first sub-model are shared with all remaining sub-models, effectively avoiding the waste of resources caused by redundantly learning shared knowledge from scratch by different sub-models.

[0082] Then the entire model is trained. First, for the initial input x0, each sub-network will get an output xi , where x i+1 =Submodel i (x i ), thus we get x0,…,x i , after getting each x i After that, they will be further input into the autonomous dynamic discriminator to obtain the prediction result y i , and back-propagates to update the parameters of the sub-model.

[0083] The mathematical expression is:

[0084]

[0085] in, Represents the stop_gradient operation, that is, the subsequent sub-model will freeze the previous sub-model when updating the parameters, to prevent the previously learned sub-model parameters from being interfered with by the subsequent sub-model learning, and thus prevent forgetting problems.

[0086] In some embodiments, the differences in expressive power between different subnetworks are crucial in autonomous tuning methods. Ideally, predictions from multiple subnetworks should be more confident than those from a single or small number of subnetworks. Therefore, during network training, consistent penalty terms are added to subnetworks at different levels. When the confidence level of a subsequent subnetwork's output is lower than that of the previous subnetwork, the subsequent subnetwork is penalized in the loss function. This allows for differentiation of the output capabilities of subnetworks at different levels during optimization, thereby enabling autonomous model sizing for the network.

[0087] Specifically, two loss function penalty terms are added here. The first is the layered loss, which introduces different weight coefficients for the prediction loss of each layer, so that the top-level encoder has a higher weight in the loss function. The prediction loss of each sub-model is L i , the loss is defined as:

[0088]

[0089] where w i is the weight, set to a value w that increases with the number of layers i =exp(i).

[0090] The second is the level consistency penalty:

[0091]

[0092] Among them, p iis the prediction distribution of the i-th sub-model. Through these two penalty terms, the confidence of the model output is higher as the sub-models are stacked, and the predictions of the lower-level sub-models are closer to the predictions of the higher-level sub-models, while ensuring overall improvement.

[0093] The final loss is defined as:

[0094] Loss=Layer Loss+Consistency Penalty

[0095] In some embodiments, during the inference phase, the autonomous dynamics discriminator maintains a threshold statistic τ0,…,τ for each sub-model. n , where τ i =μ i +k·σ i , μ i is the mean of the confidence of the i-th sub-model, σ i is the standard deviation, and k is an adjustable hyperparameter used to control the strictness of the exit. When used specifically, when the input data passes through the model, the output confidence c of each layer is calculated i , for each layer i, compare its output confidence c i and the preset threshold τ i , if c i >τ i , then the layer is considered to have a sufficiently confident prediction and can exit early to output the prediction result. Otherwise, the input is passed to the next sub-model until the confidence of a certain layer reaches the threshold or reaches the last layer.

[0096] Finally, the autonomous dynamic discriminator obtains the output results of multiple sub-models and further integrates them to obtain the next token prediction:

[0097]

[0098] in This will enable the integration of predictions from each sub-model. Sub-models with higher confidence will contribute more to the final prediction, and the entire text generation task will be completed in a cycle, achieving interaction between humans and machines.

[0099] In general, existing model acceleration inference solutions such as model compression and distributed inference can improve model inference performance to a certain extent. However, these methods often sacrifice model performance or have certain hardware requirements, further increasing the complexity of the system. In response to these problems, the present invention adopts reasonable initialization and gradient stop return techniques to effectively improve the efficiency of the model in training. At the same time, the present invention aims to enable the model to autonomously select sub-models. Through a series of model structure designs and training methods, the model can perceive the accuracy of the inference results and autonomously select output results or further predictions, greatly reducing unnecessary waste of resources, thereby achieving efficient human-computer interaction while ensuring accuracy and improving the user's interactive experience.

[0100] In summary, the method of the present invention has at least the following advantages and beneficial effects compared to the prior art:

[0101] (1) In large-scale model training and reasoning, the present invention allows the large model to autonomously select the number of sub-models involved in reasoning based on the difficulty of the input sequence, thereby improving the efficiency of the large-scale model reasoning process, achieving a balance between accuracy and speed, and saving model reasoning resource consumption.

[0102] (2) The present invention reduces the complexity and time-consuming training of the model from scratch through a reasonable model initialization method, and also reduces the required computing resources and costs.

[0103] (3) The present invention provides a training and reasoning paradigm with broad applicability, applicable to all existing large stacked model structures and not limited to the text generation model mentioned in the present invention. Therefore, the present invention possesses high technical advantages and broad practical application value.

[0104] Example 2

[0105] This embodiment provides a scalable large-model training and inference device, including:

[0106] Data acquisition module, used to obtain text data and build training sets;

[0107] A model building module is used to build a large model. The large model is a stacked model structure that performs knowledge sharing in the horizontal direction. The large model includes multiple sub-models.

[0108] The discriminator construction module is used to build an autonomous dynamic discriminator. The output of each sub-model will be input into the autonomous dynamic discriminator, and the output of the autonomous dynamic discriminator will serve as the final model prediction;

[0109] The model training module is used to train the large model using the training set, and use the trained large model to implement text generation tasks.

[0110] Since the device is an expandable large-model training and inference device of an embodiment of the present invention, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation process of the above-mentioned method embodiment, and the repeated parts will not be repeated.

[0111] Example 3

[0112] An embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the following Figure 1 A scalable large model training and inference method is shown.

[0113] It is understood that the memory may include random access memory (RAM) or read-only memory (ROM). Optionally, the memory includes a non-transitory computer-readable storage medium. The memory may be used to store instructions, programs, codes, code sets, or instruction sets. The memory may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function, instructions for implementing the various method embodiments described above, etc.; the data storage area may store data created based on the use of the server, etc.

[0114] The processor may include one or more processing cores. The processor utilizes various interfaces and circuits to connect various components within the server. It executes various server functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in memory, as well as accessing data stored in memory. Optionally, the processor may be implemented using at least one of the following hardware forms: digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor may integrate one or a combination of a central processing unit (CPU) and a modem. The CPU primarily processes the operating system and application programs, while the modem handles wireless communications. It is understood that the modem may not be integrated into the processor and may be implemented separately via a single chip.

[0115] Since the electronic device is an electronic device corresponding to a scalable large-model training and inference method in an embodiment of the present invention, and the principle of solving the problem by the electronic device is similar to that of the method, the implementation of the electronic device can refer to the implementation process of the above-mentioned method embodiment, and the repeated parts will not be repeated.

[0116] Example 4

[0117] An embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by a processor to implement the following Figure 1 A scalable large model training and inference method is shown.

[0118] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program. The program can be stored in a computer-readable storage medium, and the storage medium includes a read-only memory (ROM), a random access memory (RAM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.

[0119] Since the storage medium is a storage medium corresponding to a scalable large-model training and inference method in an embodiment of the present invention, and the principle of solving the problem by the storage medium is similar to that of the method, the implementation of the storage medium can refer to the implementation process of the above-mentioned method embodiment, and the repeated parts will not be repeated.

[0120] Example 5

[0121] In some possible implementations, various aspects of the method of the embodiments of the present invention may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to cause the computer device to perform the steps of a scalable large model training and reasoning method according to various exemplary embodiments of the present application described above in this specification. Among them, the executable computer program code or "code" for executing various embodiments can be written in a high-level programming language such as C, C++, C#, Smalltalk, Java, JavaScript, Visual Basic, Structured Query Language (e.g., Transact-SQL), Perl, or in various other programming languages.

[0122] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0123] In the description of this specification, the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" mean that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.

[0124] The above embodiments are intended only to illustrate the technical concepts and features of the present invention. Their purpose is to enable those skilled in the art to understand the contents of the present invention and implement them accordingly. They are not intended to limit the scope of protection of the present invention. Any equivalent changes or modifications made based on the essence of the present invention are intended to be covered by the scope of protection of the present invention.

Claims

1. A scalable large model training and inference method, characterized by: The following steps are involved: Obtain text data and build a training set; Constructing a large model, wherein the large model is a stacked model structure that performs knowledge sharing in a horizontal direction, and the large model includes multiple sub-models; Build an autonomous dynamics discriminator. The output of each sub-model will be input into the autonomous dynamics discriminator, and the output of the autonomous dynamics discriminator will serve as the final model prediction. Use the training set to train the large model, and use the trained large model to achieve text generation tasks; The process of large model training also includes the steps of autonomous adjustment: During model training, a consistent penalty term is added to sub-models at different levels. When the confidence level of the output result of the subsequent sub-model is lower than that of the previous sub-model, the subsequent sub-model is penalized in the loss function. This allows the output capabilities of sub-models at different levels to be distinguished during the optimization process, thereby enabling the network to autonomously select the model size. For sub-models at different levels, penalty terms of the same form are added, including: Two loss function penalty terms are added: The first is the hierarchical loss, which introduces different weight coefficients for the prediction loss of each layer, so that the top-level sub-model has a higher weight in the loss function; i The prediction loss of each sub-model is , the loss is defined as: Where, is the weight; The second is the level consistency penalty: Where, For the The prediction distribution of each sub-model, For the The prediction distribution of each sub-model; The final loss is defined as: The large model works as follows during the inference phase: During the inference phase, the autonomous dynamic discriminator maintains a threshold statistic for each sub-model, where: Where, For the The mean of the confidence scores of the sub-models, is the standard deviation, It is a tunable hyperparameter; It is The threshold of each sub-model; When input data passes through the model, the Output confidence of each sub-model , compare the output confidence With the preset threshold ,if , then the layer is considered to have a sufficiently confident prediction, exits early, and outputs the prediction result; otherwise, the input is passed to the next sub-model until the confidence of a certain layer of sub-model reaches the threshold or reaches the last layer of sub-model; Finally, the autonomous dynamic discriminator obtains the output results of multiple sub-models and further integrates them to obtain the next token prediction: Where, For the output of each sub-model, is the number of sub-models; This will then enable the integration of predictions from each sub-model. Sub-models with higher confidence will contribute more to the final prediction, and the entire text generation task will be completed in a cycle.

2. A scalable large model training and inference method according to claim 1, characterized in that: The multiple sub-models adopt different encoder architectures.

3. The scalable large model training and inference method according to claim 1, characterized in that: The training process of the large model is as follows: First, use part of the training data to pre-train the first sub-model separately. The expression is: Where, is the initial input of the model, representing the initial input sequence of the text generation task; A tokenizer that converts raw input data into a format that can be processed by the model. is the output after the first sub-model, is the first sub-model; Output It is further input into the autonomous dynamic discriminator to obtain the final prediction result; After pre-training converges, the weights of the first sub-model are shared with the remaining sub-models; Then train the entire model: first for the initial input , each sub-model will get an output; after obtaining the output of each sub-model, it will be further input into the autonomous dynamic discriminator to obtain the prediction result, and back-propagation will be used to update the parameters of the sub-model; When updating parameters of subsequent sub-models, the previous sub-model will be frozen to prevent the previously learned sub-model parameters from being disturbed by the learning of subsequent sub-models, thereby preventing forgetting problems.

4. A scalable large-scale model training and inference device, applied to the method according to any one of claims 1 to 3, characterized in that: include: Data acquisition module, used to obtain text data and build training sets; A model building module is used to build a large model. The large model is a stacked model structure that performs knowledge sharing in the horizontal direction. The large model includes multiple sub-models. The discriminator construction module is used to build an autonomous dynamic discriminator. The output of each sub-model will be input into the autonomous dynamic discriminator, and the output of the autonomous dynamic discriminator will serve as the final model prediction; The model training module is used to train the large model using the training set, and use the trained large model to implement text generation tasks.

5. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one program, and the at least one program is loaded and executed by the processor to implement the method according to any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that The storage medium stores at least one program, and the at least one program is loaded and executed by the processor to implement the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Neural network reasoning method and device based on layered loading and medium

    CN118278524A

  • Method, system and apparatus for federated learning

    WO2022169136A1