Task processing method and device, equipment, storage medium and program product
By obtaining blocks and hidden vectors that are strongly related to tasks in the large language model, and using vector dimensions with significant differences between the blocks and the last layer of hidden vectors to update the model, the solution ability activation of large language models in domain tasks is solved. The problem improves the accuracy of reasoning and improves the model capability.
Patent Information
- Application Number
- CN202411269392.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-13
AI Technical Summary
It is difficult to activate the solution ability of large language models in domain tasks, resulting in low accuracy of subsequent inference results using large language models.
By obtaining task-related instructions, input them to the large language model to obtain strongly related blocks and hidden vectors, use the vector dimensions with significant differences between the block and the last layer of hidden vectors as implicit information, and update the large language model to improve inference Accuracy.
The reasoning accuracy of large language models in domain tasks is improved, the overall capability of the model is improved through the injection of implicit information, and the dependence on prompt word design and supervision fine-tuning is reduced.
Smart Images

Figure CN119129748A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a task processing method, device, equipment, storage medium and program product. Background Art
[0002] At present, the optimization of large language models in domain tasks is mainly based on two dimensions, one is the prompt dimension, and the other is the supervised fine-tuning (SFT) perspective. Among them, from the prompt dimension, it mainly relies on the problem-solving ability of the large language model itself. If the problem-solving ability of the large language model in domain tasks is to be activated, the design of the prompt is difficult; from the SFT perspective, it is mainly through the refinement of the parameter space corresponding to the domain task solved by the large language model, but it will consume a lot of manpower and material resources and waste resources. In summary, due to the difficulty in activating the problem-solving ability of the large language model in domain tasks, the accuracy of the results obtained by subsequent reasoning using the large language model is not high. Summary of the invention
[0003] The purpose of the present invention is to provide a task processing method, apparatus, device, storage medium and program product to solve the problem that the accuracy of the results obtained by subsequent reasoning using the large language model is not high due to the difficulty in activating the solution capability of the large language model in domain tasks.
[0004] In order to achieve the above object, in a first aspect, the present invention provides a task processing method, the method comprising:
[0005] Obtaining a first instruction for a first task;
[0006] Inputting the first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model;
[0007] Obtaining a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which a difference in distribution between a latent vector of the first block and a latent vector of a last layer in the large language model exceeds a preset threshold;
[0008] Based on the latent vector of the first vector dimension, a target output result is obtained, where the target output result includes an output word unit of the first block and an output word unit of the last layer.
[0009] In some embodiments, obtaining a target output result based on the latent vector of the first vector dimension includes:
[0010] Adding the latent vector of the first vector dimension to the vector dimension corresponding to the latent vector of the last layer to obtain an updated large language model;
[0011] Based on the updated large language model, the target output result is obtained.
[0012] In some embodiments, the method further comprises:
[0013] Get the instruction sets of multiple tasks. Different tasks correspond to different instruction sets.
[0014] For each task, input each instruction in the instruction set corresponding to the task into the large language model to obtain an output result;
[0015] Based on the output result, determining a block strongly related to the task;
[0016] After adding the latent vector of the second vector dimension to the vector dimension corresponding to the latent vector of the last layer, outputting the output word unit of the block and the output word unit of the last layer; wherein the second vector dimension is the vector dimension in which the difference in distribution between the latent vector of the block and the latent vector of the last layer in the large language model exceeds a preset threshold.
[0017] In some embodiments, the obtaining of a set of instructions for multiple tasks includes:
[0018] For each task, get the pre-built seed instructions;
[0019] The seed instructions are learned to generate an instruction set corresponding to the task.
[0020] In some embodiments, the output result includes a first output result for an incorrect answer and a second output result for a correct answer and the answer is consistent with the first output result;
[0021] The determining, based on the output result, a block strongly related to the task, comprises:
[0022] For each first instruction in the first instruction set corresponding to the first output result, input the first instruction into the large language model to obtain a first word unit token output by each layer in the large language model, and visualize the first token output by each layer in the large language model;
[0023] For each second instruction in the second instruction set corresponding to the second output result, input the second instruction into the large language model to obtain a second word unit token output by each layer in the large language model, and visualize the second token output by each layer in the large language model;
[0024] Based on the visually displayed first token and the visually displayed second token, a block strongly related to the task is determined.
[0025] In some embodiments, the output result includes word-unit tokens output by each layer in the large language model;
[0026] The determining, based on the output result, a block strongly related to the task, comprises:
[0027] Visualize the word-unit tokens output by each layer in the large language model;
[0028] Based on the visualized tokens, determine the blocks in the large language model that are strongly related to the task.
[0029] In a second aspect, the present invention further provides a task processing device, comprising:
[0030] A first acquisition module, used to acquire a first instruction of a first task;
[0031] A first processing module, configured to input a first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model;
[0032] A second acquisition module is used to acquire a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which the difference in distribution between the latent vector of the first block and the latent vector of the last layer in the large language model exceeds a preset threshold;
[0033] The second processing module is used to obtain a target output result based on the latent vector of the first vector dimension, where the target output result includes an output word unit of the first block and an output word unit of the last layer.
[0034] In a third aspect, the present invention further provides a task processing device, comprising a processor and a transceiver, wherein the transceiver receives and sends data under the control of the processor, and the processor is used to perform the following operations:
[0035] Obtaining a first instruction for a first task;
[0036] Inputting the first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model;
[0037] Obtaining a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which a difference in distribution between a latent vector of the first block and a latent vector of a last layer in the large language model exceeds a preset threshold;
[0038] Based on the latent vector of the first vector dimension, a target output result is obtained, where the target output result includes an output word unit of the first block and an output word unit of the last layer.
[0039] In a fourth aspect, the present invention further provides a task processing device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; when the processor executes the program, the task processing method as described in the first aspect above is implemented.
[0040] In a fifth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the task processing method described in the first aspect above.
[0041] In a sixth aspect, the present invention further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps in the task processing method described in the first aspect above.
[0042] The above technical solution of the present invention has at least the following beneficial effects:
[0043] In an embodiment of the present invention, a first instruction of a first task is obtained; the first instruction of the first task is input into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model; a latent vector of a first vector dimension is obtained, wherein the first vector dimension is a vector dimension in which the difference in distribution between the latent vector of the first block and the latent vector of the last layer in the large language model exceeds a preset threshold; based on the latent vector of the first vector dimension, a target output result is obtained, and the target output result includes an output word unit of the first block and an output word unit of the last layer, so that when the large language model is used for task reasoning, the latent vector of the vector dimension in which the latent vector of the block strongly related to the task and the latent vector of the last layer in the large language model have a significant difference in distribution is used as the latent information of the task; the latent information of the task reflects the internal logic of the large language model in solving the task, and the output result corresponding to the task obtained based on this has a high accuracy rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram showing a flow chart of a task processing method provided by an embodiment of the present invention;
[0045] Figure 2A schematic diagram showing a module of a task processing device provided by an embodiment of the present invention;
[0046] Figure 3 A schematic diagram showing the hardware structure of a task processing device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0047] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0048] like Figure 1 FIG. 1 is a flow chart of a task processing method provided by an embodiment of the present invention, and the method may include:
[0049] Step 101: Obtain a first instruction of a first task.
[0050] Here, the first task may be a specific task, where the specific meaning is to group together knowledge with the same human cognition, such as named entity recognition (NER), relation extraction (RE), event extraction (EE), etc.
[0051] For example, the first task is a NER task, and the first instruction includes: text: The weather in Guangzhou is really hot. The instruction for the text is: Please extract the entities in the text. The output format for the instruction is JSON format, that is, {'entity': [entity name]}.
[0052] Step 102: input the first instruction of the first task into the large language model to obtain a first block of the large language model, where the first block is a block strongly related to the first task and includes at least one layer in the large language model.
[0053] It should be noted that different tasks correspond to different blocks in the large language model and have been obtained in advance. For obtaining the blocks in the large language model that are strongly related to the tasks, please refer to the subsequent embodiments.
[0054] Step 103: Obtain a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which the difference in distribution between the latent vector of the first block and the latent vector of the last layer in the large language model exceeds a preset threshold.
[0055] That is, the latent vector of the first block and the latent vector of the last layer in the large language model are statistically analyzed to find a vector dimension (i.e., the first vector dimension) in which the difference in distribution of the two latent vectors exceeds a preset threshold (i.e., the difference in distribution is significant); then, the latent vector of the first vector dimension is extracted from the latent vector of the first block.
[0056] Step 104: obtaining a target output result based on the latent vector of the first vector dimension, wherein the target output result includes an output word unit of the first block and an output word unit of the last layer.
[0057] Here, the latent vector of the vector dimension with a significant difference in distribution between the latent vector of the block strongly related to the task in the large language model and the latent vector of the last layer is used as the implicit information of the task; the implicit information of the task reflects the internal logic of the large language model in solving the task, and the output result corresponding to the task obtained based on this has a high accuracy rate.
[0058] In an optional embodiment, the above step 104 includes:
[0059] Step 1041: Add the latent vector of the first vector dimension to the vector dimension corresponding to the latent vector of the last layer to obtain an updated large language model.
[0060] Here, by adding the latent vector of the first vector dimension to the vector dimension corresponding to the latent vector of the last layer, the latent information of the first task (i.e., the latent vector of the first vector dimension) can be injected into the large language model. Since the latent information of the task reflects the internal logic of the large language model in solving the task, the injection of the latent information of the task can improve the reasoning ability of the large language model, and the gain is continuously accumulated with the increase of subsequent tasks, which is conducive to the self-driven improvement of the ability of the large language model, and does not rely on the optimization of passive prompts and SFT.
[0061] Step 1042: Obtain the target output result based on the updated large language model.
[0062] The target output result includes the output word-meta token of the first block and the output token of the last layer, that is, the output word-meta token of the first block is integrated into the entire output token, so that other layers of the large language model can notice the output content of this layer when outputting the next token in an explicit way.
[0063] The output format of the target output result can be: {useful information: output token of the first block, output information: output token of the last layer}.
[0064] In an optional embodiment, the method of the present invention further comprises:
[0065] Step 1) Obtain instruction sets for multiple tasks, where different tasks correspond to different instruction sets.
[0066] In an optional embodiment, step 1) includes:
[0067] ① For each task, get the pre-built seed instructions;
[0068] The tasks involved here are specific tasks, wherein the seed instructions include preset texts related to the tasks, preset instructions for the preset texts, and output formats for the preset instructions.
[0069] It should be noted that the seed instruction can be an instruction constructed manually to ensure the rigor of the task. Generally, there are multiple seed instructions.
[0070] In one example, the task is a NER task, and the preset text is: The weather in Shanghai is really hot. The preset instruction for the preset text is: Please extract the entities in the text. The output format of the preset instruction is JSON format, that is, {'entity': [entity name]}.
[0071] ② Learn the seed instructions and generate an instruction set corresponding to the task.
[0072] A more powerful large model (such as GPT4o) can be used to learn seed instructions and generate a large number of instructions as the instruction set corresponding to the task.
[0073] It should be noted that in order to ensure the rigor of the task, the instructions generated in step ② can be manually reviewed, that is, after a large number of instructions are generated, they are manually reviewed to obtain the instruction set corresponding to the task.
[0074] Step 2) For each task, each instruction in the instruction set corresponding to the task is input into the large language model to obtain an output result.
[0075] The output result includes a first output result for an incorrect answer and a second output result for a correct answer that is consistent with the first output result; or, the output result includes word-unit tokens output by each layer in the large language model.
[0076] It should be noted that the output result includes a first output result for an incorrect answer and a second output result for a correct answer and the answer is consistent with the first output result, specifically, the output results corresponding to all instructions in the instruction set corresponding to the task.
[0077] In example 1, the task to be performed is a NER task, and the input command prompt is: Please extract entities from the text. \nText: The weather in Yantai is really hot. \nThe output of the large language model is: This text has no clear entities. In this example 1, the output result of the large language model is the first output result of the wrong answer.
[0078] In Example 2, the task to be executed is a NER task, and the input command prompt is: Please extract entities from the text. \nText: The weather is really hot. \nThe output of the large language model is: Entity extraction result: None. In Example 2, the output result of the large language model is the second output result of the correct answer.
[0079] Step 3) Based on the output result, determine the blocks that are strongly related to the task.
[0080] In an optional embodiment, the output result includes a first output result of an incorrect answer and a second output result of a correct answer and the answer is consistent with the first output result. Accordingly, this step 3) may specifically include:
[0081] Step 31a, for each first instruction in the first instruction set corresponding to the first output result, input the first instruction into the large language model, obtain the first word unit token output by each layer in the large language model, and visualize the first token output by each layer in the large language model.
[0082] Among them, the first instruction set is the instruction set corresponding to the first output result of the wrong answer. Here, the first token output of each layer in the large language model is visualized, showing the visualization result of the wrong answer. Taking the above example 1 as an example, the visualization of the first token output of each layer in the large language model is shown in Table 1 below.
[0083] Table 1
[0084]
[0085]
[0086]
[0087] Step 32a, for each second instruction in the second instruction set corresponding to the second output result, input the second instruction into the large language model, obtain the second word unit token output by each layer in the large language model, and visualize the second token output by each layer in the large language model.
[0088] Among them, the second instruction set is the instruction set corresponding to the second output result of the correct answer. Here, the second token output by each layer in the large language model is visualized, showing the visualization result of the correct answer. Taking the above example 2 as an example, the visualization of the second token output by each layer in the large language model is shown in Table 2 below.
[0089] Table 2
[0090]
[0091]
[0092] Step 33a: determining a block that is strongly related to the task based on the visually displayed first token and the visually displayed second token.
[0093] Here, by analyzing the visualization results of correct answers and incorrect answers, in the two NER tasks mentioned above, both examples 1 and 2 output semantics without entities. Example 1 should extract the "Yantai" entity, but it does not, and the output result of the large language model is wrong; in Example 2, there is no entity in the text itself, so the large language model does not find the entity, and the output result of the large language model is correct.
[0094] From the visualization results in Tables 1 and 2 above, when there is no entity in the text itself, the large language model outputs the word "sorry" at the 28th and 31st layers before the first token of the large language model. In an example of an incorrect output, the large language model does not output the semantic token of "sorry" at all layers before the first token. Therefore, the large language model implicitly knows that there is an entity of Yantai, but ultimately does not output it. Therefore, it is analyzed that the 28th to 31st layers are defined as the entity recognition area of NER, that is, the block that is strongly related to the task.
[0095] Among them, the block that is strongly related to the task means that there is a correlation between the task and the block, and "strong correlation" means high correlation, strong correlation. In other words, there is a strong correlation between the task and the block.
[0096] In this embodiment, the block strongly related to the task specifically refers to the block in the large language model used to directly solve the task. That is, in practical applications, the above-mentioned first block can be a block used to directly solve the first task. Through the above-mentioned processing, the ability block (block strongly related to the task) that directly solves the specific task is found, and the ability of this block is externalized and strengthened through the following step 4, so that other areas of the large language model can form a consistency of problem-solving ideas with this area. Through the coordination of blocks in the large language model, the reasoning ability of the large language model is enhanced and inherited and transmitted to other tasks, thereby forming a flywheel effect of the ability of the large language model.
[0097] In another optional embodiment, the output result includes word-unit tokens output by each layer in the large language model. Accordingly, step 3) determines a block strongly related to the task based on the output result, including:
[0098] Step 31b, visually displaying the word-unit tokens output by each layer in the large language model.
[0099] That is, for each task, each instruction in the instruction set corresponding to the task is input into the large language model, and the word unit token output by each layer in the large language model is obtained and displayed visually.
[0100] For example, the instruction (prompt) input to the large language model is: Please extract nouns from the text. \nText: The places to visit in Beijing include the Great Wall and Lama Temple. The output of the large language model is: The Great Wall, Lama Temple. After that, the word unit tokens output by each layer in the large language model are visualized, as shown in Table 3 below:
[0101] Table 3
[0102]
[0103]
[0104] Step 32b: Based on the visually displayed tokens, determine the blocks in the large language model that are strongly related to the task.
[0105] Here, after a token is visually displayed through the output of a large language model for an instruction, an expert can analyze the visually displayed token to identify and determine the block in the large language model that is strongly related to the task. The block can be defined as a strong capability block for the task. It should be noted that each instruction in the instruction set for the task is processed according to the above steps to obtain multiple blocks in the large language model that are strongly related to the task; then, based on the multiple blocks, the block in the large language model that is ultimately related to the task is determined. Specifically, a common block can be determined based on multiple blocks, and the common block can be determined as the block in the large language model that is ultimately strongly related to the task.
[0106] In this embodiment, the block that is strongly related to the task specifically refers to at least two layers of the block that collaborate to solve the task. That is, in actual applications, the above-mentioned first block includes at least two layers in the large language model, and the at least two layers collaborate to solve the first task. Through the above-mentioned processing, for specific tasks, the potential ability blocks of the large language model (blocks that are strongly related to the task) are mined, and the ability of the block is explicitly output through the following step 4, so that all layers of the large language model can perceive the output of the block at the next token output moment, thereby triggering the consensus ability of the large language model, and solving the reasoning optimization of specific problems through the block collaboration model.
[0107] Step 4) After adding the latent vector of the second vector dimension to the vector dimension corresponding to the latent vector of the last layer, output the output word unit of the block and the output word unit of the last layer; wherein the second vector dimension is the vector dimension in which the difference in distribution between the latent vector of the block and the latent vector of the last layer in the large language model exceeds a preset threshold.
[0108] In this way, by adding the latent vector of the second vector dimension to the vector dimension corresponding to the latent vector of the last layer, the latent information of the task (i.e., the latent vector of the second vector dimension) can be injected into the large language model. Since the latent information of the task reflects the internal logic of the large language model in solving the task, the injection of the latent information of the task can improve the reasoning ability of the large language model.
[0109] Optionally, in step 1042, obtaining the target output result based on the updated large language model includes:
[0110] If the output word of the last layer does not match the output word of the first block, the output word of the last layer is corrected according to the output word of the first block to obtain the corrected output word of the last layer; and the output word of the first block and the corrected output word of the last layer are determined as the target output result. This can further improve the accuracy of the output result of the large language model.
[0111] like Figure 2 As shown, an embodiment of the present invention further provides a task processing device, the device comprising:
[0112] A first acquisition module 201, used to acquire a first instruction of a first task;
[0113] A first processing module 202 is used to input the first instruction of the first task into a large language model to obtain a first block of the large language model, where the first block is a block strongly related to the first task and includes at least one layer in the large language model;
[0114] A second acquisition module 203 is used to acquire a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which the difference in distribution between the latent vector of the first block and the latent vector of the last layer in the large language model exceeds a preset threshold;
[0115] The second processing module 204 is used to obtain a target output result based on the latent vector of the first vector dimension, where the target output result includes the output word unit of the first block and the output word unit of the last layer.
[0116] Optionally, the second processing module 204 includes:
[0117] A first processing unit, configured to add the latent vector of the first vector dimension to the vector dimension corresponding to the latent vector of the last layer to obtain an updated large language model;
[0118] The second processing unit is used to obtain the target output result based on the updated large language model.
[0119] Optionally, the device in the embodiment of the present invention further includes:
[0120] The third acquisition module is used to acquire instruction sets of multiple tasks, where different tasks correspond to different instruction sets;
[0121] A third processing module is used for inputting each instruction in the instruction set corresponding to each task into the large language model to obtain an output result;
[0122] A fourth processing module, configured to determine a block strongly related to the task based on the output result;
[0123] A fifth processing module is used to output the output word unit of the block and the output word unit of the last layer after adding the latent vector of the second vector dimension to the vector dimension corresponding to the latent vector of the last layer; wherein the second vector dimension is the vector dimension in which the difference in distribution between the latent vector of the block and the latent vector of the last layer in the large language model exceeds a preset threshold.
[0124] Optionally, the third acquisition module includes:
[0125] A first acquisition unit, configured to acquire a pre-built seed instruction for each task;
[0126] The third processing unit is used to learn the seed instruction and generate an instruction set corresponding to the task.
[0127] Optionally, the output result includes a first output result of an incorrect answer and a second output result of a correct answer and an answer consistent with the first output result; the fourth processing module includes:
[0128] a fourth processing unit, configured to input, for each first instruction in the first instruction set corresponding to the first output result, the first instruction into the large language model, obtain a first word unit token output by each layer in the large language model, and visualize and display the first token output by each layer in the large language model;
[0129] a fifth processing unit, configured to input, for each second instruction in the second instruction set corresponding to the second output result, the second instruction into the large language model, obtain a second word-unit token output by each layer in the large language model, and visualize and display the second token output by each layer in the large language model;
[0130] A sixth processing unit is used to determine a block strongly related to the task based on the first token displayed visually and the second token displayed visually.
[0131] Optionally, the output result includes word-unit tokens output by each layer in the large language model; and the fourth processing module includes:
[0132] A display unit, used for visually displaying the word-unit token output by each layer in the large language model;
[0133] The seventh processing unit is used to determine a block in the large language model that is strongly related to the task based on the visually displayed token.
[0134] The task processing device of the embodiment of the present invention obtains a first instruction of a first task; inputs the first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model; obtains a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which the difference in distribution between the latent vector of the first block and the latent vector of the last layer in the large language model exceeds a preset threshold; obtains a target output result based on the latent vector of the first vector dimension, wherein the target output result includes an output word unit of the first block and an output word unit of the last layer, so that when the large language model is used for task reasoning, the latent vector of the vector dimension in which the latent vector of the block strongly related to the task and the latent vector of the last layer in the large language model have a significant difference in distribution is used as the latent information of the task; the latent information of the task reflects the internal logic of the large language model in solving the task, and the output result corresponding to the task obtained based on this has a high accuracy rate.
[0135] In order to better achieve the above goals, Figure 3 As shown, an embodiment of the present invention further provides a task processing device, including a processor 300 and a transceiver 310, wherein the transceiver 310 receives and sends data under the control of the processor 300, and the processor 300 is used to perform the following process:
[0136] Obtaining a first instruction for a first task;
[0137] Inputting the first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model;
[0138] Obtaining a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which a difference in distribution between a latent vector of the first block and a latent vector of a last layer in the large language model exceeds a preset threshold;
[0139] Based on the latent vector of the first vector dimension, a target output result is obtained, where the target output result includes an output word unit of the first block and an output word unit of the last layer.
[0140] Optionally, the processor 300 is further configured to:
[0141] Adding the latent vector of the first vector dimension to the vector dimension corresponding to the latent vector of the last layer to obtain an updated large language model;
[0142] Based on the updated large language model, the target output result is obtained.
[0143] Optionally, the processor 300 is further configured to:
[0144] Get the instruction sets of multiple tasks. Different tasks correspond to different instruction sets.
[0145] For each task, input each instruction in the instruction set corresponding to the task into the large language model to obtain an output result;
[0146] Based on the output result, determining a block strongly related to the task;
[0147] After adding the latent vector of the second vector dimension to the vector dimension corresponding to the latent vector of the last layer, outputting the output word unit of the block and the output word unit of the last layer; wherein the second vector dimension is the vector dimension in which the difference in distribution between the latent vector of the block and the latent vector of the last layer in the large language model exceeds a preset threshold.
[0148] Optionally, the processor 300 is further configured to:
[0149] For each task, get the pre-built seed instructions;
[0150] The seed instructions are learned to generate an instruction set corresponding to the task.
[0151] Optionally, the output result includes a first output result of an incorrect answer and a second output result of a correct answer and an answer consistent with the first output result; the processor 300 is further configured to:
[0152] For each first instruction in the first instruction set corresponding to the first output result, input the first instruction into the large language model to obtain a first word unit token output by each layer in the large language model, and visualize the first token output by each layer in the large language model;
[0153] For each second instruction in the second instruction set corresponding to the second output result, input the second instruction into the large language model to obtain a second word unit token output by each layer in the large language model, and visualize the second token output by each layer in the large language model;
[0154] Based on the visually displayed first token and the visually displayed second token, a block strongly related to the task is determined.
[0155] Optionally, the output result includes a word unit token output by each layer in the large language model; the processor 300 is further used to:
[0156] Visualize the word-unit tokens output by each layer in the large language model;
[0157] Based on the visualized tokens, determine the blocks in the large language model that are strongly related to the task.
[0158] The task processing device of the embodiment of the present invention obtains a first instruction of a first task; inputs the first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model; obtains a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which the difference in distribution between the latent vector of the first block and the latent vector of the last layer in the large language model exceeds a preset threshold; obtains a target output result based on the latent vector of the first vector dimension, wherein the target output result includes an output word unit of the first block and an output word unit of the last layer, so that when the large language model is used for task reasoning, the latent vector of the vector dimension in which the latent vector of the block strongly related to the task and the latent vector of the last layer in the large language model have a significant difference in distribution is used as the latent information of the task; the latent information of the task reflects the internal logic of the large language model in solving the task, and the output result corresponding to the task obtained based on this has a high accuracy rate.
[0159] An embodiment of the present invention also provides a task processing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the various processes in the task processing method embodiment described above are implemented, and the same technical effect can be achieved. To avoid repetition, they will not be described here.
[0160] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, each process in the task processing method embodiment described above is implemented, and the same technical effect can be achieved. To avoid repetition, it is not described here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0161] An embodiment of the present invention further provides a computer program product, including computer instructions, which implement the steps in the task processing method as described above when executed by a processor.
[0162] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0163] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A device that specifies functions in one or more processes and / or one or more blocks.
[0164] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable storage medium produce a paper product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0165] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that the computer or other programmable device executes a series of operating steps to produce a computer-implemented process, thereby providing instructions executed on the computer or other programmable device for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0166] The above is a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A task processing method, characterized in that: include: Obtaining a first instruction for a first task; Inputting the first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model; Obtaining a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which a difference in distribution between a latent vector of the first block and a latent vector of a last layer in the large language model exceeds a preset threshold; Based on the latent vector of the first vector dimension, a target output result is obtained, where the target output result includes an output word unit of the first block and an output word unit of the last layer.
2. The method according to claim 1, characterized in that The step of obtaining a target output result based on the latent vector of the first vector dimension includes: Adding the latent vector of the first vector dimension to the vector dimension corresponding to the latent vector of the last layer to obtain an updated large language model; Based on the updated large language model, the target output result is obtained.
3. The method according to claim 1, characterized in that The method further comprises: Get the instruction sets of multiple tasks. Different tasks correspond to different instruction sets. For each task, input each instruction in the instruction set corresponding to the task into the large language model to obtain an output result; Based on the output result, determining a block strongly related to the task; After adding the latent vector of the second vector dimension to the vector dimension corresponding to the latent vector of the last layer, outputting the output word unit of the block and the output word unit of the last layer; wherein the second vector dimension is the vector dimension in which the difference in distribution between the latent vector of the block and the latent vector of the last layer in the large language model exceeds a preset threshold.
4. The method according to claim 3, characterized in that The instruction set for obtaining multiple tasks includes: For each task, get the pre-built seed instructions; The seed instructions are learned to generate an instruction set corresponding to the task.
5. The method according to claim 3, characterized in that: The output result includes a first output result in which the answer is incorrect and a second output result in which the answer is correct and the answer is consistent with the first output result; The determining, based on the output result, a block strongly related to the task, comprises: For each first instruction in the first instruction set corresponding to the first output result, input the first instruction into the large language model to obtain a first word unit token output by each layer in the large language model, and visualize the first token output by each layer in the large language model; For each second instruction in the second instruction set corresponding to the second output result, input the second instruction into the large language model to obtain a second word unit token output by each layer in the large language model, and visualize the second token output by each layer in the large language model; Based on the visually displayed first token and the visually displayed second token, a block strongly related to the task is determined.
6. The method according to claim 3, characterized in that The output result includes the word unit token output by each layer in the large language model; The determining, based on the output result, a block strongly related to the task, comprises: Visualize the word-unit tokens output by each layer in the large language model; Based on the visualized tokens, determine the blocks in the large language model that are strongly related to the task.
7. A task processing device, characterized in that: include: A first acquisition module, used to acquire a first instruction of a first task; A first processing module, configured to input a first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model; A second acquisition module is used to acquire a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which the difference in distribution between the latent vector of the first block and the latent vector of the last layer in the large language model exceeds a preset threshold; The second processing module is used to obtain a target output result based on the latent vector of the first vector dimension, where the target output result includes an output word unit of the first block and an output word unit of the last layer.
8. A task processing device, comprising a processor and a transceiver, wherein the transceiver receives and sends data under the control of the processor, characterized in that: The processor is configured to perform the following operations: Obtaining a first instruction for a first task; Inputting the first instruction of the first task into a large language model to obtain a first block of the large language model, wherein the first block is a block strongly related to the first task, and the first block includes at least one layer in the large language model; Obtaining a latent vector of a first vector dimension, wherein the first vector dimension is a vector dimension in which a difference in distribution between a latent vector of the first block and a latent vector of a last layer in the large language model exceeds a preset threshold; Based on the latent vector of the first vector dimension, a target output result is obtained, where the target output result includes an output word unit of the first block and an output word unit of the last layer.
9. A task processing device, comprising a memory, a processor, and a program stored in the memory and executable on the processor; characterized in that: When the processor executes the program, the task processing method according to any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the task processing method according to any one of claims 1 to 6 are implemented.
11. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps in the task processing method according to any one of claims 1 to 6.
