Task performance control method and device, equipment, storage medium and program product

Through the causal tracking method, the key input words and neurons of the large language model in different tasks are determined, and their activation levels are adjusted, which solves the problem of different performances of the model in a multi-task environment and realizes effective control of the performance of the model task .

CN119415223AActive Publication Date: 2025-02-11INST OF AUTOMATION CHINESE ACAD OF SCI +1
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411278711.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-12
Publication Date
2025-02-11
Estimated Expiration
2044-09-12

AI Technical Summary

Technical Problem

Existing large language models are difficult to effectively control their processing performance in different tasks in multi-task environments, resulting in different performances of models when processing different tasks.

Method used

The causal tracking method determines the key input words of the target model in performing context learning tasks, and calculates the gradient changes on these words, determines the neuron with the largest gradient changes as the key neuron, and controls the activation levels of these neurons by adjusting the activation levels of these neurons Task performance of the model.

Benefits of technology

The task performance control of the same model in different tasks is realized, and the important neurons of the model are determined when processing different tasks are determined, thereby improving the overall performance of the model in a multi-task environment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119415223A_ABST
    Figure CN119415223A_ABST
Patent Text Reader

Abstract

The invention provides a task performance control method and device, equipment, a storage medium and a program product, and is applied to the technical field of natural language processing. The method comprises the following steps: determining key input words of a target model in executing a context learning task based on a causal tracking method; determining the gradient change of the target model on the key input word in the reasoning execution process; determining the neurons at the preset number of positions with the maximum gradient change as key neurons; and controlling the task performance of the target model by adjusting the activation level of the key neurons.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language processing technology, and in particular to a task performance control method, device, equipment, storage medium and program product. Background Art

[0002] With the rapid development of large language model technology, various natural language processing tasks have demonstrated the remarkable capabilities of large language models. These large language models have achieved remarkable achievements in many fields such as translation, text generation, and question-answering systems.

[0003] In the existing technology, there are huge differences between the knowledge and capabilities required by large language models when facing different tasks. In order to optimize and improve the performance of the model in a multi-task environment, it is particularly important to control the processing performance of the same model when handling different tasks. Summary of the invention

[0004] The present invention provides a task performance control method, device, equipment, storage medium and program product, which are used to control the processing performance of the same model when processing different tasks.

[0005] The present invention provides a task performance control method, comprising: determining the key input words of a target model in executing a context learning task based on a causal tracing method; determining the gradient change of the target model on the key input words during the reasoning process; determining neurons at a preset number of positions with the largest gradient changes as key neurons; and controlling the task performance of the target model by adjusting the activation level of the key neurons.

[0006] According to a task performance control method provided by the present invention, the causal tracing method is used to determine the key input words of the target model in executing the context learning task, including: adding noise to each input word of the feedforward neural network layer to obtain a fluorescence vector; determining the predicted probability of the correct label corresponding to the fluorescence vector in executing the context learning task to obtain a perturbation matrix; and determining the key input words based on the perturbation matrix.

[0007] According to a task performance control method provided by the present invention, determining the gradient change of the target model on the key input word during the reasoning process includes: calculating the loss function when the key input word is predicted, and determining the gradient change based on the loss function.

[0008] According to a task performance control method provided by the present invention, the task performance of the target model is controlled by adjusting the activation level of the key neuron, including: amplifying the activation value of the key neuron by increasing the activation level; or, suppressing the activation value of the key neuron by reducing the activation level.

[0009] According to a task performance control method provided by the present invention, the context learning task includes at least one of the following: a question-answering task, a sentiment analysis task, a question understanding task, a text classification task, a legal text classification task, a causal relationship classification task, a sentiment classification task, and a text matching task.

[0010] The present invention also provides a task performance control device, comprising the following modules: a determination module and an adjustment module; the determination module is used to determine the key input words of the target model in executing the context learning task based on the causal tracing method; determine the gradient change of the target model on the key input words during the reasoning process; determine the neurons at a preset number of positions with the largest gradient change as key neurons; the adjustment module is used to control the task performance of the target model by adjusting the activation level of the key neurons.

[0011] According to a task performance control device provided by the present invention, the determination module is used to add noise to each input word of the feedforward neural network layer to obtain a fluorescence vector; determine the predicted probability of the correct label corresponding to the fluorescence vector in executing the context learning task to obtain a perturbation matrix; and determine the key input word according to the perturbation matrix.

[0012] According to a task performance control device provided by the present invention, the determination module is used to calculate the loss function when the key input word is predicted, and determine the gradient change according to the loss function.

[0013] According to a task performance control device provided by the present invention, the adjustment module is used to amplify the activation value of the key neuron by increasing the activation level; or to suppress the activation value of the key neuron by reducing the activation level.

[0014] According to a task performance control device provided by the present invention, the context learning task includes at least one of the following: a question-answering task, a sentiment analysis task, a question understanding task, a text classification task, a legal text classification task, a causal relationship classification task, a sentiment classification task, and a text matching task.

[0015] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the task performance control methods described above is implemented.

[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the task performance control method as described in any one of the above is implemented.

[0017] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the task performance control method described above is implemented.

[0018] The task performance control method, device, equipment, storage medium and program product provided by the present invention can determine the key input words of the target model in executing the context learning task based on the causal tracing method; determine the gradient change of the target model on the key input words during the reasoning process; determine the neurons at the preset number of positions with the largest gradient change as key neurons; and control the task performance of the target model by adjusting the activation level of the key neurons. Through this scheme, since the neurons at the preset number of positions with the largest gradient change can be determined as key neurons, and the task performance of the target model can be controlled by adjusting the activation level of the key neurons, it is possible to determine the important neurons of the target model when processing different tasks, thereby achieving control of the task performance of the target model. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0020] Figure 1 It is a flowchart of the task performance control method provided by the present invention; Figure 2 It is a structural schematic diagram of the task performance control device provided by the present invention; Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0022] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0023] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0024] In order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", etc. are used to distinguish the same items or similar items with basically the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. are not limiting the quantity and execution order.

[0025] The embodiments of the present application describe some exemplary embodiments for the purpose of explanation. It should be understood that the present application can be implemented in other ways that are not specifically shown in the drawings.

[0026] like Figure 1 As shown, the embodiment of the present application provides a task performance control method, which can be applied to a task performance control device. The task performance control method may include S101-S104: S101. The task performance control device determines the key input words of the target model in executing the context learning task based on the causal tracing method.

[0027] Optionally, the context learning task includes at least one of the following: a question answering task, a sentiment analysis task, a question understanding task, a text classification task, a legal text classification task, a causal relationship classification task, a sentiment classification task, and a text matching task.

[0028] Specifically, the question answering (QA) task can generate answers to SQuAD 1.1 questions based on documents; the sentiment analysis (SA) task refers to classifying the sentiment of English tweets on social media and judging whether their sentiment is positive or negative; the question understanding (QU) task refers to determining whether the clarification of a query is correct by answering "yes" or "no" in a conversation; the text classification (TC) task refers to classifying the topic of an English news article into one of four categories; the legal text classification (LTC) task refers to classifying English sentences as overturning or non-overturning in the legal field; the causal relationship classification (CEC) task refers to judging whether the second sentence is logically derived from the first sentence in common sense reasoning; the sentiment classification (EC) task refers to classifying the sentiment in a post into one of six categories, namely sadness, joy, love, anger, fear or surprise, and performing sentiment classification in social media; the text matching (TM) task refers to classifying question pairs in the medical and health fields into two categories.

[0029] It should be noted that for each task, the data can be divided into two parts: half is used for training to identify key neurons, and the other half is used for testing to evaluate the target model performance. The LLama2-7b-chat model and 5-shot ICL can be used for inference. The total number of neurons in the model is calculated by multiplying 32 (the number of model layers) by 11,008 (the hidden state size).

[0030] Optionally, the task performance control device determines the key input words of the target model in executing the context learning task based on the causal tracing method, including: adding noise to each input word of the feedforward neural network layer to obtain a fluorescence vector; determining the predicted probability of the correct label corresponding to the fluorescence vector in executing the context learning task to obtain a perturbation matrix; and determining the key input words according to the perturbation matrix.

[0031] Specifically, the task performance control device can add noise as a fluorescence vector to each input word of each feedforward neural network (FFN) layer, and record the predicted probability of the correct label to construct a perturbation matrix A. The rows and columns of the matrix correspond to the index of the FFN layer and the length of the input, respectively. Finally, the input word corresponding to the predicted probability with a larger degree of perturbation in the perturbation matrix is ​​selected as the key input word.

[0032] ; in, represents the prediction after adding noise to the i-th input word at the j-th layer, is the fluorescence vector, and .

[0033] S102: The task performance control device determines the gradient change of the target model on the key input word during the reasoning process.

[0034] Optionally, the task performance control device determines the gradient change of the target model on the key input word during the reasoning process, including: calculating the loss function when the key input word is predicted, and determining the gradient change based on the loss function.

[0035] Specifically, the task performance control device can use the data of a specific task to perform a forward pass, that is, calculate the loss function when a special tag is predicted, as shown below: ; Among them, s represents the position of the key input word, Represents the focused input set.

[0036] Next, the gradient change is calculated on the training set for the specific task, and the gradient of the gated weights is determined based on the loss value as follows: ; in, , l represents the number of layers, and d represents the dimension of each layer. Since the size of the FFN gating value of each layer is 4d-dimensional, the gradient change is compressed to d-dimensional to obtain Matrices of the same size.

[0037] S103: The task performance control device determines neurons at a preset number of positions with the largest gradient changes as key neurons.

[0038] Optionally, the task performance control device can select n positions with the largest global changes as key neurons, which are considered to be critical to the task. A single neuron can be represented as .

[0039] S104, the task performance control device controls the task performance of the target model by adjusting the activation level of the key neurons.

[0040] Optionally, the task performance control device controls the task performance of the target model by adjusting the activation level of the key neuron, including: amplifying the activation value of the key neuron by increasing the activation level; or, suppressing the activation value of the key neuron by reducing the activation level.

[0041] Specifically, using these identified key neurons, they can be further manipulated to affect the overall performance of the target model. Specifically, the activation value of the key neurons can be amplified by increasing the activation level, or suppressed by decreasing the activation level. The operation is as follows: ; in, Represents the selected neuron in layer l. The value of this neuron is set to less than 1 when inhibited; the value is set to greater than 1 when amplified; and the value is equal to 1 during normal inference.

[0042] It should be noted that the present application eliminates redundant markers, minimizes interference from non-essential neurons, and identifies task-specific neurons by focusing on the most important markers in the task processing process. Compared with traditional neuron localization methods, the present application can more effectively identify task-specific neurons. The present application also conducted experiments on eight different tasks. The experiment proved that the present application can accurately locate task-specific neurons by inhibiting and enhancing the identified neurons.

[0043] In an embodiment of the present application, since the neurons at a preset number of positions with the largest gradient changes can be determined as key neurons, and the task performance of the target model can be controlled by adjusting the activation level of the key neurons, the important neurons of the target model when processing different tasks can be determined, thereby achieving control of the task performance of the target model.

[0044] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to realize the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment disclosed herein, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0045] The task performance control method provided in the embodiment of the present application can be executed by a task performance control device or a control module for task performance control in the task performance control device. In the embodiment of the present application, the task performance control device provided in the embodiment of the present application is described by taking the task performance control method executed by the task performance control device as an example.

[0046] It should be noted that the embodiment of the present application can divide the functional modules of the task performance control device according to the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. Optionally, the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.

[0047] like Figure 2 As shown, an embodiment of the present application provides a task performance control device 200. The task performance control device 200 includes: a determination module 201 and an adjustment module 202; the determination module 201 is used to determine the key input words of the target model in executing the context learning task based on the causal tracing method; determine the gradient change of the target model on the key input words during the reasoning process; determine the neurons at the preset number of positions with the largest gradient change as key neurons; the adjustment module 202 is used to control the task performance of the target model by adjusting the activation level of the key neurons.

[0048] Optionally, the determination module 201 is used to add noise to each input word of the feedforward neural network layer to obtain a fluorescence vector; determine the predicted probability of the correct label corresponding to the fluorescence vector in executing the context learning task to obtain a perturbation matrix; and determine the key input word based on the perturbation matrix.

[0049] Optionally, the determination module 201 is used to calculate a loss function when the key input word is predicted, and determine a gradient change according to the loss function.

[0050] Optionally, the adjustment module 202 is used to amplify the activation value of the key neuron by increasing the activation level; or to suppress the activation value of the key neuron by reducing the activation level.

[0051] Optionally, the context learning task includes at least one of the following: a question-answering task, a sentiment analysis task, a question understanding task, a text classification task, a legal text classification task, a causal relationship classification task, a sentiment classification task, and a text matching task.

[0052] In an embodiment of the present application, since the neurons at a preset number of positions with the largest gradient changes can be determined as key neurons, and the task performance of the target model can be controlled by adjusting the activation level of the key neurons, the important neurons of the target model when processing different tasks can be determined, thereby achieving control of the task performance of the target model.

[0053] Figure 3An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the task performance control method, which includes: determining the key input words of the target model in the execution of the context learning task based on the causal tracing method; determining the gradient change of the target model on the key input words during the execution of the reasoning process; determining the neurons at the preset number of positions with the largest gradient change as key neurons; and controlling the task performance of the target model by adjusting the activation level of the key neurons.

[0054] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0055] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the task performance control method provided by the above-mentioned methods, which includes: determining the key input words of the target model in executing the context learning task based on the causal tracing method; determining the gradient change of the target model on the key input words during the reasoning process; determining the neurons at a preset number of positions with the largest gradient change as key neurons; and controlling the task performance of the target model by adjusting the activation level of the key neurons.

[0056] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the task performance control method provided by the above-mentioned methods, the method comprising: determining the key input words of the target model in executing the context learning task based on a causal tracing method; determining the gradient change of the target model on the key input words during the reasoning process; determining the neurons at a preset number of positions with the largest gradient change as key neurons; and controlling the task performance of the target model by adjusting the activation level of the key neurons.

[0057] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0058] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0059] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A task performance control method, characterized in that: include: Determine the key input words of the target model in performing contextual learning tasks based on the causal tracing method; Determining a gradient change of the target model on the key input word during the reasoning process; The neurons at the preset number of positions with the largest gradient changes are determined as key neurons; The task performance of the target model is controlled by adjusting the activation level of the focus neurons.

2. The task performance control method according to claim 1, characterized in that: The method of determining the key input words of the target model in executing the context learning task based on the causal tracing method includes: Add noise to each input word of the feed-forward neural network layer to obtain the fluorescence vector; Determining the predicted probability of the correct label corresponding to the fluorescence vector in performing the context learning task to obtain a perturbation matrix; The key input word is determined according to the disturbance matrix.

3. The task performance control method according to claim 1, characterized in that: Determining the gradient change of the target model on the key input word during the reasoning process includes: A loss function when the key input word is predicted is calculated, and a gradient change is determined according to the loss function.

4. The task performance control method according to claim 1, characterized in that: The step of controlling the task performance of the target model by adjusting the activation level of the key neurons comprises: The activation value of the key neuron is amplified by increasing the activation level; or the activation value of the key neuron is inhibited by decreasing the activation level.

5. The task performance control method according to any one of claims 1 to 4, characterized in that: The context learning task includes at least one of the following: a question answering task, a sentiment analysis task, a question understanding task, a text classification task, a legal text classification task, a causal relationship classification task, a sentiment classification task, and a text matching task.

6. A task performance control device, characterized in that: include: Determine modules and adjust modules; The determination module is used to determine the key input words of the target model in performing the context learning task based on the causal tracing method; Determine the gradient change of the target model on the key input word during the reasoning process; determine the neurons at the preset number of positions with the largest gradient change as key neurons; The adjustment module is used to control the task performance of the target model by adjusting the activation level of the key neurons.

7. The task performance control device according to claim 6, characterized in that: The determination module is used to add noise to each input word of the feedforward neural network layer to obtain a fluorescence vector; determine the predicted probability of the correct label corresponding to the fluorescence vector in executing the context learning task to obtain a perturbation matrix; and determine the key input word according to the perturbation matrix.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the task performance control method as described in any one of claims 1 to 5 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the task performance control method as described in any one of claims 1 to 5 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the task performance control method as described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Contextual real-time feedback for neuromorphic model development

    CN106104586A

  • Data processing method and device based on artificial intelligence, equipment and medium

    CN112116912A

  • Speech synthesis model training method and device, and speech synthesis method and device

    CN112786001A

  • Image processing method and device, electronic equipment and storage medium

    CN115705619A

  • Selective activation-based pulse neural network continuous learning target recognition system

    CN117710789A