Data processing method, device and equipment based on large language model
Patent Information
- Application Number
- CN202380012514.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-22
- Publication Date
- 2025-09-05
AI Technical Summary
The prior art requires a lot of computing resources and time to retrieve data required by users from a large amount of network data, resulting in large amounts of server resources and users cannot obtain the required data in time.
Using a data processing method based on a large language model, by obtaining the original input problem and determining its target characteristics, the target side branch model corresponding to the target characteristics is selected from multiple side branch models, and combined with the basic model and the target side branch model for processing, so as to quickly determine the target answer.
This method can save the server's computing resources and time overhead, quickly determine the target answer, provide logical analysis and reasoning capabilities, and give accurate and reliable answers.
Smart Images

Figure CN120604227A_ABST
Abstract
Description
A data processing method, device and equipment based on large language model Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a data processing method, apparatus, and device based on a large language model (LLM). Background Art
[0002] With the rapid development of network technology, more and more network data is available. In order to retrieve the data required by users from a large amount of network data, users need to provide keywords (i.e., original input questions). The server retrieves the data required by users from a large amount of network data based on the keywords.
[0003] However, due to the huge amount of network data, the server needs to consume a lot of computing resources to retrieve the data required by the user, and it takes a lot of time, resulting in large consumption of server resources and making it impossible for users to obtain the required data in a timely manner.
[0004] For example, cameras deployed in real-world scenarios capture and transmit large quantities of images to a server. Analyzing these images to extract the data required by users consumes significant computing resources and takes considerable time.
[0005] Summary of the Invention
[0006] In view of this, the present application provides a data processing method, apparatus and device based on a large language model, which can save server computing resources and time expenditure, and can quickly determine the target answer.
[0007] The present application provides a data processing method based on a large language model, wherein the target large language model includes a base model and at least two branch models. The method includes:
[0008] Obtaining an original input question and determining a target feature corresponding to the original input question;
[0009] Selecting a target branch model corresponding to the target feature from all branch models;
[0010] Inputting the original input problem into the basic model to obtain intermediate processing features corresponding to the original input problem and output processing features corresponding to the original input problem;
[0011] A trigger instruction is sent to the target side branch model so that the target side branch model obtains the intermediate processing features and the output processing features from the basic model according to the trigger instruction, processes the intermediate processing features to obtain the side branch processing features corresponding to the original input question, and processes the side branch processing features and the output processing features to obtain the target answer corresponding to the original input question.
[0012] The present application provides a data processing device based on a large language model, wherein the target large language model includes a base model and at least two branch models, and the device includes:
[0013] An acquisition module is used to obtain an original input question and determine a target feature corresponding to the original input question; and select a target branch model corresponding to the target feature from all branch models;
[0014] a processing module, configured to input the original input problem into the basic model, and obtain intermediate processing features corresponding to the original input problem and output processing features corresponding to the original input problem;
[0015] A trigger instruction is sent to the target side branch model so that the target side branch model obtains the intermediate processing features and the output processing features from the basic model according to the trigger instruction, processes the intermediate processing features to obtain the side branch processing features corresponding to the original input question, and processes the side branch processing features and the output processing features to obtain the target answer corresponding to the original input question.
[0016] The present application provides an electronic device, comprising: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the above-mentioned data processing method based on a large language model.
[0017] It can be seen from the above technical solution that in an embodiment of the present application, the target large language model includes a basic model and at least two branch models, such as at least two branch models that can be branch models for different industries. After obtaining the original input question, the target branch model can be selected from all branch models, and the target answer corresponding to the original input question can be determined based on the basic model and the target branch model. In this way, for the original input questions of different industries, the target answer can be determined based on the branch model of the industry, thereby obtaining an accurate target answer. For example, for the original input question of industry A, the target answer is determined based on the branch model of industry A, for the original input question of industry B, the target answer is determined based on the branch model of industry B, and so on. In this way, accurate target answers can be obtained for the original input questions of different industries.
[0018] The target large language model can be used to obtain the target answer, requiring only minimal computing resources. This shortens the time required to obtain the target answer, conserving server computing resources and time. It can quickly determine the target answer corresponding to the original input question, providing logical analysis and reasoning capabilities, and leveraging the analytical power of the target large language model to deliver accurate and reliable target answers. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments of the present application or the description of the prior art. Obviously, the drawings described below are only some embodiments recorded in this application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings of the embodiments of the present application.
[0020] FIG1 is a schematic flow chart of a data processing method based on a large language model in one embodiment;
[0021] FIG2A is a schematic structural diagram of a large language model in one embodiment;
[0022] FIG2B is a schematic structural diagram of an industry-wide language model in an embodiment;
[0023] FIG3 is a schematic structural diagram of a target large language model in one embodiment;
[0024] FIG4 is a schematic diagram of a training process for a target large language model in one embodiment;
[0025] FIG5A , FIG5B and FIG5C are schematic structural diagrams of an industry large language model in one embodiment;
[0026] FIG6 is a schematic diagram of a data processing process based on a target large language model in one embodiment;
[0027] FIG7 is a schematic structural diagram of a target large language model in one embodiment;
[0028] FIG8 is a schematic structural diagram of a data processing device based on a large language model in an embodiment;
[0029] FIG9 is a hardware structure diagram of an electronic device in an embodiment. DETAILED DESCRIPTION
[0030] The terms used in the embodiments of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms "a," "the," and "the" used in this application and claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to any or all possible combinations of one or more associated listed items.
[0031] It should be understood that although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" used may also be interpreted as "at the time of" or "when" or "in response to determining".
[0032] In an embodiment of the present application, a data processing method based on a large language model is proposed. The method can be applied to any electronic device, such as a server. In one example, the target large language model may include a base model and at least two branch models. As shown in FIG1 , the method may include:
[0033] Step 101: Obtain an original input question and determine the target features corresponding to the original input question.
[0034] Step 102: Select a target side-branch model corresponding to the target feature from all side-branch models.
[0035] Step 103: Input the original input problem into the basic model to obtain the intermediate processing features corresponding to the original input problem and the output processing features corresponding to the original input problem.
[0036] Step 104: Send a trigger instruction to the target side branch model, so that the target side branch model obtains the intermediate processing feature and the output processing feature from the basic model according to the trigger instruction, processes the intermediate processing feature to obtain the side branch processing feature corresponding to the original input question, and processes the side branch processing feature and the output processing feature to obtain the target answer corresponding to the original input question.
[0037] In an example, for each branch model, the branch model may be a model for one industry, and different branch models are models for different industries.
[0038] Selecting a target branch model corresponding to the target feature from all branch models may include but is not limited to: if the target feature includes the target industry to which the original input problem belongs, then selecting a branch model corresponding to the target industry from all branch models as the target branch model.
[0039] In an example, for each branch model, the branch model may be a model for one industry, and different branch models are models for different industries.
[0040] Selecting a target branch model corresponding to the target feature from all branch models may include, but is not limited to: obtaining a session identifier corresponding to the original input question; wherein, when the user device establishes a connection with the target large language model, the session identifier may be allocated to the user device, and each time the user device provides the original input question to the target large language model, the session identifier is simultaneously provided;
[0041] If there is a side branch model corresponding to the session identifier, the side branch model corresponding to the session identifier can be determined as the target side branch model corresponding to the original input question;
[0042] If there is no branch model corresponding to the session identifier, and the target feature includes the target industry to which the original input question belongs, then the branch model corresponding to the target industry is selected from all branch models as the target branch model, and the correspondence between the session identifier and the target branch model is recorded.
[0043] In one example, the process of determining the target industry corresponding to the original input question may include but is not limited to: obtaining the target keyword corresponding to the original input question, and obtaining the target industry corresponding to the target keyword by querying an industry dictionary; wherein the industry dictionary includes a mapping relationship between keywords and industries.
[0044] Alternatively, the original input question is input into an industry identification model to obtain a target industry corresponding to the original input question; wherein the industry identification model can be used to identify an industry.
[0045] In an example, for each branch model, the branch model may be a model for one language, and different branch models are models for different languages.
[0046] Determining a target feature corresponding to the original input question may include, but is not limited to: if the target feature includes a target language corresponding to the original input question, performing word segmentation on the original input question to obtain a plurality of tokens; and determining the target language corresponding to the original input question based on the plurality of tokens;
[0047] Selecting a target branch model corresponding to the marked feature from all branch models may include but is not limited to: selecting a branch model corresponding to the target language from all branch models as the target branch model.
[0048] In an example, the training process for the target large language model may include but is not limited to:
[0049] The basic model is obtained by training based on the sample data corresponding to the basic model.
[0050] For each branch model to be trained, a bypass connection is established between the base model and the branch model to be trained to obtain an industry model. Based on the sample data corresponding to the branch model to be trained, the branch model to be trained is trained to obtain a trained branch model. During the training process, the network parameters of the branch model to be trained are adjusted to obtain the trained branch model, while the network parameters of the base model are not adjusted.
[0051] After obtaining the trained branch models corresponding to each branch model to be trained, the base model is bypass-connected with all the trained branch models to obtain the target large language model.
[0052] In one example, the above execution order is only for the convenience of describing the examples given. In actual applications, the execution order between the steps can also be changed, and this execution order is not limited. Moreover, in other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification, and the steps included in the method may be more or less than those described in this specification. In addition, the single step described in this specification may be decomposed into multiple steps for description in other embodiments. The multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0053] It can be seen from the above technical solution that in an embodiment of the present application, the target large language model includes a basic model and at least two branch models, such as at least two branch models that can be branch models for different industries. After obtaining the original input question, the target branch model can be selected from all branch models, and the target answer corresponding to the original input question can be determined based on the basic model and the target branch model. In this way, for the original input questions of different industries, the target answer can be determined based on the branch model of the industry, thereby obtaining an accurate target answer. For example, for the original input question of industry A, the target answer is determined based on the branch model of industry A, for the original input question of industry B, the target answer is determined based on the branch model of industry B, and so on. In this way, accurate target answers can be obtained for the original input questions of different industries.
[0054] The target large language model can be used to obtain the target answer, requiring only minimal computing resources. This shortens the time required to obtain the target answer, conserving server computing resources and time. It can quickly determine the target answer corresponding to the original input question, providing logical analysis and reasoning capabilities, and leveraging the analytical power of the target large language model to deliver accurate and reliable target answers.
[0055] The above technical solutions of the embodiments of the present application are described below in conjunction with specific application scenarios.
[0056] Due to the large volume of network data (such as text, video, voice, and image data), servers need to consume a large amount of computing resources to retrieve the data users need, which takes a long time. This leads to a large consumption of server resources and a long delay for users to obtain the required data. For example, in real-world scenarios, a large number of cameras are deployed, and these cameras capture a large number of images. Analyzing the data required by users from these images requires a large amount of computing resources and a long time.
[0057] To address these findings, we can use a large language model (LLM) to analyze data. For example, we can input question data into the LLM, which then outputs the target answer. This allows us to retrieve the target answer from a large amount of data using only a small amount of computing resources, significantly reducing the time required to obtain the target answer. This saves server computing resources and time, while leveraging the analytical capabilities of the LLM to deliver accurate and reliable target answers.
[0058] For example, ChatGPT is a large language model based on natural language processing and machine learning. It can simulate human language communication and enable intelligent conversations with users. It has been widely used in intelligent customer service, chatbots, voice assistants, and other fields, providing more convenient, fast, and intelligent services. Based on this, ChatGPT can be used to analyze data and obtain the target answers corresponding to the question data.
[0059] With the rapid development of artificial intelligence, based on the big language model, various industries will use industry data to fine-tune the big language model to obtain a new big language model. The new big language model can also be called an industry big language model or an expert big language model (the industry big language model will be used as an example later). For example, for the communications industry, the data of the communications industry can be used to fine-tune the big language model to obtain the industry big language model of the communications industry. For the medical industry, the data of the medical industry can be used to fine-tune the big language model to obtain the industry big language model of the medical industry. For the education industry, the data of the education industry can be used to fine-tune the big language model to obtain the industry big language model of the education industry.
[0060] However, since large language models have many network parameters, even if a small number of network parameters are added to the large language model (such as network parameters for the communications industry, medical industry, education industry, etc.), a large number of network parameters need to be adjusted when fine-tuning the large language model. This requires a lot of time and computing resources to complete the fine-tuning training of the large language model, which consumes a lot of resources.
[0061] For example, Figure 2A shows the structure of a large language model. The large language model may include network A, network B, and network C, each of which may include a large number of network parameters, such as trillions of network parameters. After the large language model is trained, each industry can fine-tune the large language model using industry data to obtain its own large language model.
[0062] For example, see Figure 2B, which is a structural diagram of the industry large language model. On the basis of the large language model, the industry large language model additionally adds network A1, network B1 and network C1. Network A1, network B1 and network C1 all include a small number of network parameters, such as dozens or hundreds of network parameters.
[0063] When fine-tuning a large language model using industry data, the network parameters of Network A, Network B, Network C, Network A1, Network B1, and Network C1 need to be adjusted during the gradient backpropagation process. Although Network A1, Network B1, and Network C1 have relatively few network parameters, Network A, Network B, and Network C have many network parameters, such as trillions of network parameters. Therefore, the fine-tuning training process requires a lot of time and computing resources to complete the fine-tuning training of the large language model.
[0064] In response to the above findings, this application provides a data processing method based on a large language model, which can adjust the large language model using a branch model, and multiple industries can use the same large language model.
[0065] For example, see Figure 3, which is a schematic diagram of the structure of the target large language model. On the basis of the large language model, the target large language model additionally adds side branch model 1, side branch model 2 and side branch model 3. Of course, here we take three side branch models as an example, and the number of side branch models can be more or less.
[0066] In FIG3 , the large language model may include network A, network B, and network C. The large language model may be referred to as a basic model, that is, the basic model includes network A, network B, and network C.
[0067] The branch model 1 may include network A1, network B1, and network C1. For example, the branch model 1 may be a branch model for the communications industry, and the base model and the branch model 1 may constitute a large language model for the communications industry. When fine-tuning the large language model using industry data from the communications industry, during the gradient backpropagation process, only the network parameters of network A1, network B1, and network C1 need to be adjusted, while the network parameters of network A, network B, and network C do not need to be adjusted. Obviously, since the network parameters of network A1, network B1, and network C1 are relatively small, the fine-tuning training process only requires a small amount of time and computing resources, thereby enabling the fine-tuning training of the large language model to be completed quickly, saving computing resources.
[0068] Branch model 2 may include network A2, network B2, and network C2. For example, branch model 2 may be a branch model for the medical industry. The base model and branch model 2 may constitute a large language model for the medical industry. When fine-tuning the large language model using industry data from the medical industry, during the gradient backpropagation process, only the network parameters of networks A2, B2, and C2 need to be adjusted, without adjusting the network parameters of networks A, B, and C. The fine-tuning training process only consumes a small amount of time and computing resources, thereby quickly completing fine-tuning training and saving computing resources.
[0069] Branch model 3 may include network A3, network B3, and network C3. For example, branch model 3 may be a branch model for the education industry. The base model and branch model 3 may constitute a large language model for the education industry. When fine-tuning the large language model using industry data from the education industry, during the gradient backpropagation process, only the network parameters of networks A3, B3, and C3 need to be adjusted, without adjusting the network parameters of networks A, B, and C. The fine-tuning training process only consumes a small amount of time and computing resources, allowing for rapid completion of fine-tuning training and conserving computing resources.
[0070] In one example, the training process of the target large language model and the data processing process based on the target large language model may be involved. During the training process of the target large language model, the target large language model can be trained and obtained. The target large language model can include a base model and at least two branch models. During the data processing process based on the target large language model, the original input question can be input into the target large language model, and the target large language model outputs the target answer corresponding to the original input question. The training process of the target large language model and the data processing process based on the target large language model are described below.
[0071] First, the training process for the target large language model. For example, see Figure 4, which is a schematic diagram of the training process for the target large language model. The process may include:
[0072] Step 401: A basic model is obtained by training based on sample data corresponding to the basic model.
[0073] For example, the structure of the basic model (i.e., the large language model) can be shown in Figure 2A. The basic model can include network A, network B, and network C. There is no restriction on the structure of this basic model. Network A can be a Transformer structure or other structures, network B can be a Transformer structure or other structures, and network C can be a Transformer structure or other structures.
[0074] For example, sample data corresponding to the basic model (such as a large amount of sample data) can be obtained, and the sample data can be used to train the basic model, and there is no restriction on the training process of the basic model.
[0075] Step 402: For each branch model to be trained, the basic model is bypass-connected with the branch model to be trained to obtain an industry model (i.e., an industry large language model), and the branch model to be trained is trained based on the sample data corresponding to the branch model to be trained to obtain a trained branch model corresponding to the branch model to be trained.
[0076] In one example, during the training process of the to-be-trained side-branch model, the network parameters of the to-be-trained side-branch model are adjusted to obtain the trained side-branch model, and the network parameters of the base model are not adjusted.
[0077] For example, for the side branch model to be trained in the communications industry, the side branch model to be trained includes network A1, network B1 and network C1. The basic model is bypass-connected with the side branch model to be trained to obtain the industry large language model of the communications industry, as shown in Figure 5A, which is a structural diagram of the industry large language model.
[0078] On this basis, the industry language model can be trained based on the sample data corresponding to the branch model to be trained (i.e., industry data of the communications industry), to obtain a trained branch model corresponding to the branch model to be trained (referred to as branch model 1). During the training process, only the network parameters of the branch model to be trained (i.e., the network parameters of network A1, network B1, and network C1) are adjusted to obtain branch model 1, without adjusting the network parameters of the base model. There is no restriction on this training process.
[0079] For example, for the side branch model to be trained in the medical industry, the side branch model to be trained includes network A2, network B2 and network C2. The basic model is bypass-connected with the side branch model to be trained to obtain the industry large language model of the medical industry, as shown in Figure 5B, which is a structural diagram of the industry large language model.
[0080] On this basis, the large language model for the medical industry can be trained based on industry data to obtain trained branch model 2. During the training process, only the network parameters of network A2, network B2, and network C2 are adjusted to obtain branch model 2, without adjusting the network parameters of the base model.
[0081] For example, for the side branch model to be trained in the education industry, the side branch model to be trained includes network A3, network B3 and network C3. The basic model is bypass-connected with the side branch model to be trained to obtain the industry large language model of the education industry, as shown in Figure 5C, which is a structural diagram of the industry large language model.
[0082] On this basis, the large language model for the education industry can be trained based on industry data to obtain trained branch model 3. During the training process, only the network parameters of network A3, network B3, and network C3 are adjusted to obtain branch model 3, without adjusting the network parameters of the base model.
[0083] Step 403: After obtaining the trained side-branch model corresponding to each side-branch model to be trained, bypass-connect the basic model with all the trained side-branch models to obtain the target large language model.
[0084] For example, the base model can be bypass-connected with side-branch model 1, side-branch model 2, and side-branch model 3 to obtain a target large language model. That is, the target large language model includes the base model, side-branch model 1, side-branch model 2, and side-branch model 3. See Figure 3 for a schematic diagram of the structure of the target large language model.
[0085] In one example, a large target language model is constructed by building a branch model on top of a base model. Part of the base model's output serves as the branch's input, and all network parameters to be trained reside in the branch model. Since the base model only provides input, the complexity of backpropagation depends on the size of the branch model, eliminating the need to perform backpropagation directly on the base model, significantly improving training efficiency.
[0086] For example, because each branch model has a relatively small number of network parameters, it doesn't significantly increase the number of network parameters compared to the base model. Therefore, when training a branch model (i.e., adjusting its network parameters), training efficiency is high, memory usage is low, and computing resources are used sparingly. This rapid training allows for rapid and cost-effective expansion of model capabilities and enhanced performance.
[0087] For example, after obtaining a base model, a branch model is trained for a specific industry. This branch model is then linked to the base model to create a large industry language model. This large industry language model can be represented as the base model plus a branch model, corresponding to tasks related to that industry. The large industry language model can be divided into two parts: the branch model and the base model. The large industry language model can be expressed as: Model = Base + Ladder.
[0088] In one example, a base model can be bypassed with branch models for multiple industries to obtain a target large language model. That is, the target large language model includes multiple industry large language models. The target large language model includes the base model and multiple branch models, each of which corresponds to a large industry language model.
[0089] For example, the industry language model 1 is recorded as Base+Ladder 1 , the industry language model 2 is recorded as Base+Ladder 2 , and so on. Clearly, the bases of the large language models for each industry are consistent. By bypassing and connecting these large language models, we can obtain a target large language model that supports multiple industries.
[0090] In an example, for each network in the branch model (such as network A1, network B1, network C1, network A2, network B2 and network C2, network A3, network B3 and network C3, etc.), the network can be a Transformer structure (such as a lightweight Transformer structure, lightweight means that the network parameters of the Transformer structure are relatively small), or other structures, without limitation.
[0091] Second, the data processing process based on the target large language model. For example, see Figure 6, which is a schematic diagram of the data processing process based on the target large language model. The process may include:
[0092] Step 601: Obtain the original input question. For example, the original input question input by the user may be received, or the original input question may be obtained in other ways, which are not limited.
[0093] In an example, the original input problem can be an input problem in the image data format, or an input problem in the text data format, or an input problem in the voice data format, or an input problem in the video data format. There is no restriction on the data format of the original input problem.
[0094] Step 602: Select a target side branch model corresponding to the original input question from all side branch models. For example, a target feature corresponding to the original input question may be determined, and then a target side branch model corresponding to the target feature may be selected from all side branch models as the target side branch model corresponding to the original input question.
[0095] In one example, the target large language model can include a Gating module (also known as a Gating network), i.e., a Gating module is present at the entrance of the target large language model. The Gating module is used to obtain the original input question and select the target branch model corresponding to the original input question from all branch models. For example, as shown in Figure 7, a Gating module is present at the entrance of the target large language model.
[0096] In an example, to select the target branch model from all branch models, the following method can be used:
[0097] Method 1: The target large language model includes at least two branch models. Each branch model can be a model for a specific industry, and different branch models are models for different industries. For example, as shown in Figure 3, branch model 1 is a branch model for the communications industry, branch model 2 is a branch model for the medical industry, and branch model 3 is a branch model for the education industry.
[0098] On this basis, the target industry to which the original input problem belongs can be determined (that is, the target features corresponding to the original input problem include the target industry to which the original input problem belongs), and the branch model corresponding to the target industry is selected from all branch models as the target branch model. For example, if the target industry corresponding to the original input problem is the communications industry, then branch model 1 is used as the target branch model. If the target industry corresponding to the original input problem is the medical industry, then branch model 2 is used as the target branch model. If the target industry corresponding to the original input problem is the education industry, then branch model 3 is used as the target branch model.
[0099] In one example, to obtain the branch model corresponding to the target industry, a mapping relationship between industries and branch models can be pre-configured. Based on this, after obtaining the target industry corresponding to the original input question, the branch model corresponding to the target industry can be obtained by querying the mapping relationship.
[0100] In one example, in order to determine the target industry corresponding to the original input question, an industry dictionary can be pre-configured. The industry dictionary includes a mapping relationship between keywords and industries, and there is no restriction on this industry dictionary.
[0101] The target keywords corresponding to the original input question can be obtained.
[0102] For example, if the original input question is in text format, the original input question is segmented to obtain multiple words. A specific word or a portion of the words can be used as the target keyword, and there is no restriction on the method of selecting the target keyword.
[0103] For example, if the original input problem is in image format, the target keywords can be extracted from the image. For example, the image can be input into a keyword extraction model to obtain the target keywords, or an image algorithm can be used to analyze the image to obtain the target keywords. There is no restriction on this.
[0104] For another example, if the original input question is in audio format, the target keywords can be extracted from the audio, and there is no restriction on the extraction method. If the original input question is in video format, the target keywords can be extracted from the video, and there is no restriction on the extraction method.
[0105] After obtaining the target keyword, the industry dictionary can be searched through the target keyword to obtain the target industry corresponding to the target keyword, and then the branch model corresponding to the target industry is used as the target branch model.
[0106] In an example, in order to determine the target industry corresponding to the original input problem, an industry identification model can be pre-trained. The industry identification model is a network model used to identify the industry. There are no restrictions on the network structure and training process of this industry identification model, as long as it can identify the industry.
[0107] After obtaining the original input question, the original input question can be input into the industry identification model. The industry identification model processes the original input question, obtains the target industry corresponding to the original input question, and outputs the target industry corresponding to the original input question. In this way, the target industry corresponding to the original input question can be obtained, and then the branch model corresponding to the target industry can be used as the target branch model.
[0108] Method 2: The target large language model includes at least two branch models. For each branch model, the branch model can be a model for one industry, and different branch models are models for different industries.
[0109] On this basis, the session identifier (Session) corresponding to the original input question can be obtained. For example, when the user device (i.e., the user) establishes a connection with the target large language model, the target large language model can assign a session identifier to the user device. Each time the user device provides the original input question to the target large language model, the session identifier is provided synchronously, that is, the original input question will carry the session identifier, and the session identifier of each original input question is the same. In this way, when the original input question is obtained, the session identifier corresponding to the original input question can also be obtained, and then analysis can be performed based on the session identifier.
[0110] If there is no branch model corresponding to the session identifier (for example, for the first original input question input by the user device to the target large language model, there is no branch model corresponding to the session identifier), then determine the target industry to which the original input question belongs (that is, the target feature corresponding to the original input question includes the target industry to which the original input question belongs), and from all branch models, select the branch model corresponding to the target industry as the target branch model, and record the correspondence between the session identifier and the target branch model.
[0111] For example, if there is no branch model corresponding to the session identifier, the target branch model can be determined using method 1, and this process will not be repeated. After obtaining the target branch model, the corresponding relationship between the session identifier and the target branch model can be recorded so that the corresponding relationship can be queried in the subsequent process.
[0112] If there is a side branch model corresponding to the session identifier (for example, for a non-first original input question input by the user device to the target large language model, there is a side branch model corresponding to the session identifier, that is, the correspondence between the session identifier and the side branch model recorded when the first original input question is asked), then the side branch model corresponding to the session identifier can be directly determined as the target side branch model corresponding to the original input question.
[0113] Method 3: The target large language model includes at least two branch models. For each branch model, the branch model can be a model for one language, and different branch models are models for different languages.
[0114] For example, when training to obtain the target large language model, branch model 1 is a branch model for language A (i.e., branch model 1 is trained using sample data of language A), branch model 2 is a branch model for language B (i.e., branch model 2 is trained using sample data of language B), and branch model 3 is a branch model for language C (i.e., branch model 3 is trained using sample data of language C).
[0115] On this basis, we can segment the original input question into multiple tokens. For example, if the original input question is in text format, we can break it into small pieces, called tokens. This process is called segmentation, and we can obtain multiple tokens.
[0116] Determine the target language corresponding to the original input question based on multiple tokens (i.e., the target features corresponding to the original input question include the target language corresponding to the original input question). For example, analyze each token to obtain the language of the token, and use the language of the token as the target language corresponding to the original input question.
[0117] From all branch models, select the branch model corresponding to the target language as the target branch model. For example, if the target language is language A, then branch model 1 is selected as the target branch model, and so on.
[0118] In one example, to obtain the branch model corresponding to the target language, a mapping relationship between the language and the branch model can be pre-configured. Based on this, after obtaining the target language corresponding to the original input question, the branch model corresponding to the target language can be obtained by querying the mapping relationship.
[0119] Mode 4: The target large language model includes at least two branch models. For each branch model, the branch model may be a model for one language, and different branch models are models for different languages.
[0120] On this basis, the session identifier corresponding to the original input question can be obtained. If there is no branch model corresponding to the session identifier, the original input question can be segmented to obtain multiple tokens. Based on the multiple tokens, the target language corresponding to the original input question can be determined. The branch model corresponding to the target language can be selected from all branch models as the target branch model, and the correspondence between the session identifier and the target branch model can be recorded. If there is a branch model corresponding to the session identifier, the branch model corresponding to the session identifier can be directly determined as the target branch model corresponding to the original input question.
[0121] The above method is only an example of selecting a target side-branch model from all side-branch models and is not limited thereto.
[0122] Step 603: Input the original input problem into the basic model to obtain the intermediate processing features corresponding to the original input problem and the output processing features corresponding to the original input problem.
[0123] Step 604: Send a trigger instruction to the target side branch model so that the target side branch model obtains intermediate processing features and output processing features from the basic model according to the trigger instruction, processes the intermediate processing features to obtain side branch processing features corresponding to the original input question, and processes the side branch processing features and output processing features to obtain the target answer corresponding to the original input question.
[0124] For example, as shown in Figure 7, the Gating module can input the original input problem into the basic model and send a trigger instruction to the target branch model (such as branch model 2). The trigger instruction is used to trigger the target branch model to perform the reasoning process, while other branch models will not perform the reasoning process.
[0125] For example, the trigger instruction can be an original input question, that is, the original input question is input to the target branch model to trigger the target branch model to perform the reasoning process. Alternatively, the trigger instruction can be a message, that is, the message is input to the target branch model to trigger the target branch model to perform the reasoning process.
[0126] Exemplarily, with respect to step 603 , the original input question may be processed by the basic model to obtain intermediate processing features corresponding to the original input question and output processing features corresponding to the original input question.
[0127] For example, as shown in Figure 7, after receiving the original input question, network A of the basic model processes the original input question to obtain intermediate processing feature X1, and inputs intermediate processing feature X1 to network B. After receiving intermediate processing feature X1, network B processes the intermediate processing feature X1 to obtain intermediate processing feature X2, and inputs intermediate processing feature X2 to network C. After receiving intermediate processing feature X2, network C processes the intermediate processing feature X2 to obtain output processing feature X3.
[0128] For step 604, after the target branch model receives the trigger instruction, it obtains the intermediate processing features and the output processing features from the basic model, processes the intermediate processing features to obtain the branch processing features corresponding to the original input question, and processes the side processing features and the output processing features to obtain the target answer corresponding to the original input question.
[0129] For example, after receiving the trigger instruction, the target branch model (e.g., branch model 2) triggers branch model 2 to execute the inference process. During the inference process, network A2 of branch model 2 obtains the output features of network A (i.e., intermediate processing features X1). For example, network A stores intermediate processing features X1 in a buffer, and network A2 can read intermediate processing features X1 from the buffer.
[0130] Network A2 processes the intermediate processing feature X1 to obtain the side branch processing feature Y1, and inputs the side branch processing feature Y1 to network B2. Network B2 obtains the output feature of network B (i.e., the intermediate processing feature X2), fuses the intermediate processing feature X2 and the side branch processing feature Y1, processes the fused feature to obtain the side branch processing feature Y2, and inputs the side branch processing feature Y2 to network C2.
[0131] Network C2 obtains the output features of network C (i.e., output processing features X3), fuses the output processing features X3 and the side branch processing features Y2, and processes based on the fused features to obtain the target answer.
[0132] Obviously, the target answer is the target answer corresponding to the original input question, and the target answer can be output.
[0133] It can be seen from the above technical solutions that in the embodiments of the present application, for the original input questions of different industries, the target answers can be determined based on the branch model of the industry, thereby obtaining accurate target answers. The target answer can be obtained with the help of the target large language model, and the target answer can be queried with only a small amount of computing resources. The time to obtain the target answer is shorter, thereby saving the computing resources of the server and saving time expenses. It is possible to quickly determine the target answer corresponding to the original input question, provide logical analysis and reasoning capabilities, and use the analysis capabilities of the target large language model to give accurate and reliable target answers.
[0134] Based on the same inventive concept, a data processing device and electronic device based on a large language model corresponding to the above-mentioned data processing method based on a large language model are also provided. Since the principles of solving problems by the data processing device and the electronic device are similar to those of the data processing method based on a large language model, the implementation of the data processing device and the electronic device can refer to the data processing method based on a large language model, and the repeated parts will not be repeated.
[0135] Based on the same application concept as the above method, an embodiment of the present application proposes a data processing device based on a large language model. The target large language model may include a base model and at least two branch models. FIG8 is a schematic structural diagram of the device, which may include:
[0136] The acquisition module 81 is used to obtain the original input question and determine the target feature corresponding to the original input question; select the target branch model corresponding to the target feature from all branch models;
[0137] A processing module 82 is configured to input the original input question into the basic model to obtain intermediate processing features corresponding to the original input question and output processing features corresponding to the original input question;
[0138] A trigger instruction is sent to the target side branch model so that the target side branch model obtains the intermediate processing features and the output processing features from the basic model according to the trigger instruction, processes the intermediate processing features to obtain the side branch processing features corresponding to the original input question, and processes the side branch processing features and the output processing features to obtain the target answer corresponding to the original input question.
[0139] The acquisition module 81 is specifically used to select the target branch model corresponding to the target feature from all branch models: if the target feature includes the target industry to which the original input problem belongs, select the branch model corresponding to the target industry from all branch models as the target branch model.
[0140] In one example, the acquisition module 81 selects the target side-branch model corresponding to the target feature from all side-branch models, specifically for:
[0141] Obtaining a session identifier corresponding to the original input question; wherein, when the user device establishes a connection with the target large language model, the session identifier is allocated to the user device, and each time the user device provides the original input question to the target large language model, the session identifier is synchronously provided;
[0142] If a side branch model corresponding to the session identifier exists, determining the side branch model corresponding to the session identifier as the target side branch model corresponding to the original input question;
[0143] If there is no branch model corresponding to the session identifier, and the target feature includes the target industry to which the original input question belongs, then from all branch models, the branch model corresponding to the target industry is selected as the target branch model, and the correspondence between the session identifier and the target branch model is recorded.
[0144] In one example, when the acquisition module 81 determines the target industry corresponding to the original input question, it is specifically used to: obtain the target keyword corresponding to the original input question, and obtain the target industry corresponding to the target keyword by querying the industry dictionary; wherein, the industry dictionary includes a mapping relationship between keywords and industries; or, input the original input question into an industry identification model to obtain the target industry corresponding to the original input question; wherein, the industry identification model is used to identify the industry.
[0145] In one example, when determining the target feature corresponding to the original input question, the acquisition module 81 is specifically configured to: if the target feature includes the target language corresponding to the original input question, perform word segmentation processing on the original input question to obtain multiple tokens; and determine the target language corresponding to the original input question based on the multiple tokens;
[0146] When the acquisition module 81 selects the target side branch model corresponding to the target feature from all side branch models, it is specifically used to: select the side branch model corresponding to the target language from all side branch models as the target side branch model.
[0147] In one example, the apparatus further includes: a training module, configured to obtain the target large language model through training; when the training module obtains the target large language model through training, the training module is specifically configured to:
[0148] A basic model is obtained by training the sample data corresponding to the basic model; for each branch model to be trained, the basic model is bypass-connected with the branch model to be trained to obtain an industry model;
[0149] Based on the sample data corresponding to the side-branch model to be trained, the side-branch model to be trained is trained to obtain a trained side-branch model; wherein, during the training process, the network parameters of the side-branch model to be trained are adjusted to obtain the trained side-branch model, and the network parameters of the base model are not adjusted;
[0150] After obtaining the trained side-branch model corresponding to each side-branch model to be trained, the base model is bypass-connected with all the trained side-branch models to obtain the target large language model.
[0151] Based on the same concept as the above method, an electronic device is proposed in an example of the present application, as shown in Figure 9, the electronic device includes a processor 911 and a machine-readable storage medium 912, and the machine-readable storage medium 912 stores machine-executable instructions that can be executed by the processor 911; the processor 911 is used to execute the machine-executable instructions to implement the data processing method based on the large language model disclosed in the above example.
[0152] In one example, the processor 911 may include one or more processing cores, such as a quad-core processor or an octal-core processor. The processor 911 may be implemented in at least one of the following hardware forms: a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), or a PLA (Programmable Logic Array).
[0153] The processor 911 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit). The coprocessor is a low-power processor for processing data in the standby state.
[0154] In some embodiments, the processor 911 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen.
[0155] In one example, the electronic device may optionally include a peripheral device interface 913 and at least one peripheral device. The processor 911 and the peripheral device interface 913 may be connected via a bus or signal lines. Each peripheral device may be connected to the peripheral device interface 913 via a bus, signal lines, or circuit boards. The peripheral device may include at least one of a radio frequency circuit 914 and a power supply 915.
[0156] The RF circuit 914 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 914 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 914 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the RF circuit 914 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a subscriber identity module card, and the like.
[0157] The radio frequency circuit 914 can communicate with the user equipment via at least one wireless communication protocol, including but not limited to the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (Wireless Fidelity) network.
[0158] The power supply 915 is used to supply power to various components in the electronic device. The power supply 915 can be alternating current, direct current, a disposable battery, or a rechargeable battery.
[0159] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the data processing method based on the large language model disclosed in the above example of the present application can be implemented.
[0160] The machine-readable storage medium may be any electronic, magnetic, optical, or other physical storage device that may contain or store information, such as executable instructions, data, and the like. For example, the machine-readable storage medium may be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, a storage drive (such as a hard disk drive), a solid-state drive, any type of storage disk (such as a CD, DVD, etc.), or similar storage media, or a combination thereof.
[0161] The systems, devices, modules, or units described in the above embodiments may be implemented by a computer entity or by a product having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.
[0162] For the convenience of description, the above devices are described as being divided into various units according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0163] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0164] The present application is described with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that each flow process and / or box in the flow chart and / or block diagram and the combination of the flow process and / or box in the flow chart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processing machine or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one flow chart flow or multiple flows and / or one box or multiple boxes of the block diagram.
[0165] Moreover, these computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0166] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0167] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should all be included within the scope of the claims of the present application.
Claims
1. A data processing method based on a large language model, characterized in that, The target large language model includes a base model and at least two branch models, and the method includes: Obtain the original input question and determine the target feature corresponding to the original input question; Select a target branch model corresponding to the target feature from all branch models; Input the original input question into the base model to obtain the intermediate processing feature corresponding to the original input question and the output processing feature corresponding to the original input question; Send a trigger instruction to the target branch model so that the target branch model obtains the intermediate processing feature and the output processing feature from the base model according to the trigger instruction, processes the intermediate processing feature to obtain the branch processing feature corresponding to the original input question, and processes the branch processing feature and the output processing feature to obtain the target answer corresponding to the original input question.
2. The method according to claim 1, wherein The step of selecting a target branch model corresponding to the target feature from all branch models includes: If the target feature includes the target industry to which the original input question belongs, select a branch model corresponding to the target industry from all branch models as the target branch model.
3. The method according to claim 1, wherein The step of selecting a target branch model corresponding to the target feature from all branch models includes: Obtain a session identifier corresponding to the original input question; wherein, when the user device establishes a connection with the target large language model, a session identifier is assigned to the user device, and when the user device provides the original input question to the target large language model each time, the session identifier is provided synchronously; If there is a branch model corresponding to the session identifier, determine the branch model corresponding to the session identifier as the target branch model corresponding to the original input question; If there is no branch model corresponding to the session identifier and the target feature includes the target industry to which the original input question belongs, select a branch model corresponding to the target industry from all branch models as the target branch model, and record the corresponding relationship between the session identifier and the target branch model.
4. The method according to claim 2 or 3, wherein The process of determining the target industry corresponding to the original input question includes: Obtain the target keyword corresponding to the original input question, and obtain the target industry corresponding to the target keyword by querying the industry dictionary; wherein, the industry dictionary includes the mapping relationship between keywords and industries; Or, input the original input question into an industry recognition model to obtain the target industry corresponding to the original input question; wherein, the industry recognition model is used to recognize industries.
5. The method according to claim 1, wherein The step of determining the target feature corresponding to the original input question includes: if the target feature includes the target language corresponding to the original input question, perform word segmentation on the original input question to obtain multiple tokens; determine the target language corresponding to the original input question based on the multiple tokens; Selecting a target side-branch model corresponding to the target feature from all side-branch models includes: Selecting a side-branch model corresponding to the target language from all side-branch models as the target side-branch model.
6. The method according to claim 1, wherein The training process for the target large language model includes: Training a basic model based on the sample data corresponding to the basic model; For each side-branch model to be trained, bypass connecting the basic model and the side-branch model to be trained to obtain an industry model; Training the side-branch model to be trained based on the sample data corresponding to the side-branch model to be trained to obtain a trained side-branch model; wherein, during the training process, adjusting the network parameters of the side-branch model to be trained to obtain a trained side-branch model, and not adjusting the network parameters of the basic model; After obtaining the trained side-branch models corresponding to each side-branch model to be trained, bypass connecting the basic model and all the trained side-branch models to obtain the target large language model.
7. A data processing device based on a large language model, characterized in that, The target large language model includes a basic model and at least two side-branch models, and the device includes: An acquisition module, configured to acquire an original input question and determine a target feature corresponding to the original input question; select a target side-branch model corresponding to the target feature from all side-branch models; A processing module, configured to input the original input question into the basic model to obtain an intermediate processing feature corresponding to the original input question and an output processing feature corresponding to the original input question; Sending a trigger instruction to the target side-branch model, so that the target side-branch model acquires the intermediate processing feature and the output processing feature from the basic model according to the trigger instruction, processes the intermediate processing feature to obtain a side-branch processing feature corresponding to the original input question, and processes the side-branch processing feature and the output processing feature to obtain a target answer corresponding to the original input question.
8. The device according to claim 7, wherein When the acquisition module selects a target side-branch model corresponding to the target feature from all side-branch models, it specifically is used for: If the target feature includes the target industry to which the original input question belongs, selecting a side-branch model corresponding to the target industry from all side-branch models as the target side-branch model.
9. The device according to claim 7, characterized in that, When the acquisition module selects a target side-branch model corresponding to the target feature from all side-branch models, it specifically is used for: Acquiring a session identifier corresponding to the original input question; wherein, when the user device establishes a connection with the target large language model, a session identifier is assigned to the user device, and when the user device provides the original input question to the target large language model each time, the session identifier is provided synchronously; If there is a side-branch model corresponding to the session identifier, determining the side-branch model corresponding to the session identifier as the target side-branch model corresponding to the original input question; If there is no collateral model corresponding to the session identifier, and the target feature includes the target industry to which the original input question belongs, then from all collateral models, select the collateral model corresponding to the target industry as the target collateral model, and record the correspondence between the session identifier and the target collateral model.
10. The apparatus according to claim 8 or 9, wherein: When the obtaining module determines the target industry corresponding to the original input question, it specifically is used for: Obtain the target keyword corresponding to the original input question, and obtain the target industry corresponding to the target keyword by querying the industry dictionary; wherein, the industry dictionary includes the mapping relationship between keywords and industries; Or, input the original input question into an industry recognition model to obtain the target industry corresponding to the original input question; wherein, the industry recognition model is used to recognize industries.
11. The apparatus according to claim 7, wherein: When the obtaining module determines the target feature corresponding to the original input question, it specifically is used for: If the target feature includes the target language corresponding to the original input question, perform word segmentation on the original input question to obtain multiple tokens; determine the target language corresponding to the original input question based on the multiple tokens; When the obtaining module selects the target collateral model corresponding to the target feature from all collateral models, it specifically is used for: Select the collateral model corresponding to the target language as the target collateral model from all collateral models.
12. The device according to claim 7, wherein The apparatus further includes: A training module, configured to train to obtain the target large language model; Wherein, when the training module trains to obtain the target large language model, it specifically is used for: Train to obtain a basic model based on the sample data corresponding to the basic model; For each collateral model to be trained, perform bypass connection on the basic model and the collateral model to be trained to obtain an industry model; Based on the sample data corresponding to the collateral model to be trained, train the collateral model to be trained to obtain a trained collateral model; wherein, during the training process, adjust the network parameters of the collateral model to be trained to obtain a trained collateral model, and do not adjust the network parameters of the basic model; After obtaining the trained collateral model corresponding to each collateral model to be trained, perform bypass connection on the basic model and all trained collateral models to obtain the target large language model.
13. An electronic device, characterized in that, Including: A processor and a machine-readable storage medium, the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; The processor is configured to execute the machine-executable instructions to implement the method according to any one of claims 1-6.
Citation Information
Patent Citations
Chinese and English hybrid speech recognition model training method and device
CN111816169A
Acquisition method and device of response data, equipment and medium
CN116610790A
Model fine tuning and scheduling method, system and equipment
CN117151241A
Response model training method, smart chat method, apparatuses, device and medium
WO2019184117A1