Method and device for determining similarity of text processing tasks, equipment and medium

By setting the importance coefficient in the neural network and using text samples to train the neural network, it solves the problems of high acquisition cost and low accuracy of embedded features in text processing tasks in the existing technology, and achieves low-cost and high-accuracy task similarity assessment. .

CN118568515APending Publication Date: 2024-08-30BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202410674677.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-28
Publication Date
2024-08-30

AI Technical Summary

Technical Problem

Existing technologies have high computational costs and storage requirements when obtaining embedded features for text processing tasks, and the accuracy of similarity assessment between different tasks needs to be improved.

Method used

Set multiple importance coefficients for scaling the output of multiple network modules in the neural network, and use text samples of the text processing task to train the neural network, and determine the embedded features of the text processing task based on the importance coefficients after training, through the same The structured neural network obtains the embedded features of the task.

Benefits of technology

It achieves the acquisition of embedded features for different text processing tasks with low computational cost and storage overhead, and improves the accuracy of task similarity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568515A
    Figure CN118568515A
Patent Text Reader

Abstract

The invention provides a method and device for determining similarity of text processing tasks, equipment and a medium, and relates to the technical field of artificial intelligence, in particular to the technical field of natural language processing, deep learning and the like. The method comprises the steps that a first task, a second task and a to-be-trained neural network are determined, the to-be-trained neural network comprises multiple network modules and multiple importance coefficients corresponding to the multiple network modules, and the multiple importance coefficients are used for scaling output values of the corresponding network modules; the first task and the second task are used as target tasks to execute target operation to obtain respective embedded features of the first task and the second task, and the target operation comprises the steps of training a to-be-trained neural network by using text samples corresponding to the target tasks, and obtaining a plurality of importance coefficients after training; based on the plurality of importance coefficients after training, determining an embedding feature of the target task; and determining the task similarity of the first task and the second task based on the respective embedding characteristics of the first task and the second task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to technical fields such as natural language processing and deep learning, and specifically to a method for determining the similarity of text processing tasks, an apparatus for determining the similarity of text processing tasks, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] Artificial intelligence is a discipline that studies how computers can simulate certain human thought processes and intelligent behaviors (such as learning, training of neural network models, thinking, planning, etc.). It includes both hardware-level and software-level technologies. Artificial intelligence hardware technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, and big data processing; artificial intelligence software technologies mainly include natural language processing technology, computer vision technology, speech recognition technology, as well as machine learning / deep learning, big data processing technology, knowledge graph technology, and other major directions.

[0003] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention

[0004] The present disclosure provides a method for determining the similarity of text processing tasks, an apparatus for determining the similarity of text processing tasks, an electronic device, a computer-readable storage medium, and a computer program product.

[0005] According to one aspect of the present disclosure, a method for determining the similarity of text processing tasks is provided, comprising: determining a first task, a second task and a neural network to be trained, the neural network to be trained comprising a plurality of network modules and a plurality of importance coefficients corresponding to the plurality of network modules, the plurality of importance coefficients being respectively used to scale the output values ​​of the corresponding network modules; performing a target operation on the first task and the second task as target tasks respectively to obtain respective embedding features of the first task and the second task, the target operation comprising: training the neural network to be trained using a text sample corresponding to the target task, and obtaining a plurality of importance coefficients after training; and determining the embedding features of the target task based on the plurality of importance coefficients after training; and determining the task similarity of the first task and the second task based on the respective embedding features of the first task and the second task.

[0006] According to another aspect of the present disclosure, there is provided a device for determining the similarity of text processing tasks, comprising: a first determination unit, configured to determine a first task, a second task and a neural network to be trained, the neural network to be trained comprising a plurality of network modules and a plurality of importance coefficients corresponding to the plurality of network modules, the plurality of importance coefficients being respectively used to scale the output values ​​of the corresponding network modules; an embedding feature acquisition unit, configured to respectively perform a target operation on the first task and the second task as target tasks to obtain respective embedding features of the first task and the second task, the embedding feature acquisition unit comprising: a training subunit, configured to train the neural network to be trained using a text sample corresponding to the target task, and obtain a plurality of importance coefficients after training; and a first determination subunit, configured to determine the embedding features of the target task based on the plurality of importance coefficients after training; and a second determination unit, configured to determine the task similarity of the first task and the second task based on their respective embedding features.

[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above method.

[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the above method.

[0009] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program implements the above method when executed by a processor.

[0010] According to one or more embodiments of the present disclosure, the present disclosure sets multiple importance coefficients for scaling the outputs of multiple network modules in a neural network, trains the neural network using text samples of text processing tasks, and then determines the embedding features of the text processing tasks based on the importance coefficients after training, thereby achieving the acquisition of embedding features of different text processing tasks at a lower computational cost and storage overhead. In addition, by using text samples of different text processing tasks to train a neural network of the same structure to obtain the embedding features of the task, a more accurate task similarity can be obtained.

[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0013] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;

[0014] Figure 2 A flowchart of a method for determining similarity of text processing tasks according to an exemplary embodiment of the present disclosure is shown;

[0015] Figure 3 A flowchart of a method for determining similarity of text processing tasks according to an exemplary embodiment of the present disclosure is shown;

[0016] Figure 4 A flowchart of training a neural network to be trained according to an exemplary embodiment of the present disclosure is shown;

[0017] Figure 5 A flowchart of training a neural network to be trained according to an exemplary embodiment of the present disclosure is shown;

[0018] Figure 6 A structural block diagram of an apparatus for determining similarity of text processing tasks according to an exemplary embodiment of the present disclosure is shown; and

[0019] Figure 7 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0020] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0021] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.

[0022] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.

[0023] A text processing task (hereinafter referred to as a task in this disclosure) refers to a specific work that requires processing and analyzing text data. By obtaining the embedded features of the task (task-specific vector representation), it is possible to measure the similarity between different text processing tasks.

[0024] In the related art, existing methods of obtaining task embeddings for text processing tasks require high computational costs and storage requirements, and the accuracy of evaluating the similarities between different tasks needs to be improved.

[0025] To solve the above problems, multiple importance coefficients for scaling the outputs of multiple network modules are set in the neural network, and the neural network is trained with text samples of text processing tasks. Then, the embedding features of the text processing tasks are determined based on the importance coefficients after training, so that the embedding features of different text processing tasks can be obtained with lower computational cost and storage overhead. In addition, by using text samples of different text processing tasks to train a neural network with the same structure to obtain the embedding features of the task, a more accurate task similarity can be obtained.

[0026] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0027] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.

[0028] In an embodiment of the present disclosure, the server 120 may run one or more services or software applications that enable execution of the methods of the present disclosure.

[0029] In some embodiments, server 120 may also provide other services or software applications, which may include non-virtualized environments and virtualized environments. In some embodiments, these services may be provided as web-based services or cloud services, such as provided to users of client devices 101, 102, 103, 104, 105, and / or 106 under a software as a service (SaaS) model.

[0030] exist Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.

[0031] The user can use client devices 101, 102, 103, 104, 105 and / or 106 to perform human-computer interaction. The client device can provide an interface that enables the user of the client device to interact with the client device. The client device can also output information to the user via the interface. Figure 1 Only six client devices are depicted, but one skilled in the art will appreciate that the present disclosure may support any number of client devices.

[0032] Client devices 101, 102, 103, 104, 105 and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, game systems, thin clients, various messaging devices, sensors or other sensing devices, etc. These computer devices may run various types and versions of software applications and operating systems, such as MICROSOFT Windows, APPLE iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as GOOGLE Chrome OS); or include various mobile operating systems, such as MICROSOFT Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular phones, smart phones, tablet computers, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Game systems may include various handheld game devices, Internet-enabled game devices, etc. Client devices are capable of executing various different applications, such as various Internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and may use various communication protocols.

[0033] The network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.

[0034] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0035] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0036] In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and / or 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and / or 106.

[0037] In some embodiments, the server 120 may be a server of a distributed system, or a server combined with a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in a cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and virtual private servers (VPS) services.

[0038] The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The databases 130 may reside in various locations. For example, the database used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The databases 130 may be of different types. In some embodiments, the databases used by the server 120 may be, for example, relational databases. One or more of these databases may store, update, and retrieve data to and from the databases in response to commands.

[0039] In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the applications may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.

[0040] Figure 1The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.

[0041] According to one aspect of the present disclosure, a method for determining similarity of text processing tasks is provided. Figure 2 FIG. 2 shows a flow chart of a method 200 for determining similarity of text processing tasks according to an exemplary embodiment of the present disclosure. Figure 2 As shown, the method includes: step S201, determining the first task, the second task and the neural network to be trained, the neural network to be trained includes multiple network modules and multiple importance coefficients corresponding to the multiple network modules, and the multiple importance coefficients are respectively used to scale the output values ​​of the corresponding network modules; step S202, respectively taking the first task and the second task as target tasks to perform target operations to obtain the respective embedded features of the first task and the second task, and the target operations include: step S2021, training the neural network to be trained using the text sample corresponding to the target task, and obtaining the multiple importance coefficients after training; and step S2022, determining the embedded features of the target task based on the multiple importance coefficients after training; and step S203, determining the task similarity of the first task and the second task based on the respective embedded features of the first task and the second task. It can be understood that step S2021 and step S2022 can be sub-steps of step S202.

[0042] Thus, by setting multiple importance coefficients for scaling the outputs of multiple network modules in the neural network, and using text samples of text processing tasks to train the neural network, and then determining the embedding features of the text processing tasks based on the importance coefficients after training, it is possible to obtain the embedding features of different text processing tasks with lower computational cost and storage overhead. In addition, by using text samples of different text processing tasks to train a neural network of the same structure to obtain the embedding features of the task, a more accurate task similarity can be obtained.

[0043] As described above, text processing tasks refer to specific tasks that require processing and analyzing text data, such as text classification, sentiment analysis, named entity recognition, summary generation, etc. These text processing tasks can be represented by task embeddings (task-specific vector representations). Task embeddings of different tasks can form a semantic space, thereby achieving the measurement of similarities between different text processing tasks.

[0044] According to some embodiments, after determining the task similarity between the first task and the second task in step S203, the two tasks may be processed downstream based on the task similarity between the two tasks. Figure 3As shown, the above method may further include: step S304, in response to determining that the task similarity between the first task and the second task is higher than the preset similarity, performing task migration between the first task and the second task. It can be understood that Figure 3 The operations and effects of steps S301 to S303 and their sub-steps in the above description can be referred to. Figure 2 The description of steps S201 to S203 and their sub-steps are not repeated here.

[0045] Task transfer refers to using the knowledge or model of one task to improve the performance of another related task. For example, the model and data of an existing news classification task can be used to help a new news classification task, such as migrating from a sports news classification task to an entertainment news classification task, or the existing movie review sentiment analysis model can be used to improve the effect of product review sentiment analysis. Through the above method, it is possible to quickly, automatically and accurately obtain the correlation between tasks, thereby achieving efficient task transfer.

[0046] In some embodiments, task transfer can be achieved through data enhancement, that is, using the training set of the source task (first task) to enhance the training set of the target task (second task). Especially when the target task data is small, the generalization ability of the model can be improved by increasing the data of related tasks.

[0047] In some embodiments, task migration can be achieved by migrating model parameters, that is, migrating part or all of the trained model parameters of the source task (first task) to the model of the target task (second task), thereby reducing the training time and resources of the target task.

[0048] In some embodiments, task migration can be achieved through joint training, that is, the models of the source task (first task) and the target task (second task) are trained simultaneously, and the performance of the two tasks is improved by sharing part of the network structure or parameters.

[0049] It can be seen that a reasonable source task can greatly improve the performance of the target task. Similarly, an incorrect source task can also harm the performance of the target task. Therefore, in task migration, the selection of source tasks is crucial. By using the method disclosed in the present invention, a large number of highly similar source tasks can be quickly found for the target task at a low computational cost and storage overhead.

[0050] In some embodiments, after determining the similarity of the text processing tasks, the following operations may be performed:

[0051] Task clustering: After determining the task similarity between multiple tasks including the first task and the second task, the multiple tasks can be clustered based on the task similarity between the multiple tasks, so that similar tasks are clustered together. This is very useful for organizing and managing a large number of tasks, especially in the scenarios of multi-task learning or multi-task management.

[0052] Task recommendation: On some platforms (such as machine learning model sharing platforms), task embedding can be used to recommend related tasks or models. In an exemplary embodiment, based on the embedding features of the first task that the user is working on, multiple other tasks can be used as second tasks to determine task similarity, thereby recommending tasks and models similar to the first task, helping users quickly find related resources (datasets, models, etc. for similar tasks).

[0053] It is understandable that the method for determining the similarity of text processing tasks provided by the present disclosure can also be used in richer scenarios and is not limited here.

[0054] In step S201, the first task and the second task may be two pre-selected text processing tasks for which task similarity needs to be determined. The neural network model to be trained may be any neural network model that can be used for text processing.

[0055] According to some embodiments, the neural network to be trained is a Transformer architecture, and the multiple network modules include multiple self-attention modules and multiple feedforward neural network modules.

[0056] In the Transformer neural network, each layer mainly consists of two parts: the Multi-Head Attention module and the Feed Forward Neural Network module. The Multi-Head Self-Attention mechanism can be formalized as:

[0057]

[0058] Among them, Att(x) represents the calculation of input x based on the self-attention mechanism, N h Indicates the number of long positions, W K , W Q , W V , W O is a learnable parameter in the self-attention module.

[0059] The feedforward neural network module can be formalized as:

[0060] FFN(x)=GELU(XW U )·W D

[0061] Among them, GELU(·) is Gaussian Error Linear Units, x is the input of the feedforward neural network, and W D and W U is a learnable parameter in a feedforward neural network.

[0062] Each self-attention head can be assigned a learnable importance coefficient m H , and assign a learnable importance coefficient m to each feedforward neural network F :

[0063]

[0064] FFN(x)=m F GELU(XW U )·W D

[0065] In some embodiments, the neural network to be trained may also adopt other network structures, and the multiple network modules may also be other network modules. For example, for a fully connected network, the multiple network modules may be multiple layers or multiple neurons.

[0066] After learning, the above importance coefficients can scale the output values ​​of the corresponding network modules, thereby maintaining or amplifying the output values ​​of important network modules and reducing the output values ​​of network modules that have less impact on the output.

[0067] In step S202, the first task and the second task may be respectively used as target tasks to perform a target operation to obtain respective embedded features of the first task and the second task. As described above, the target operation may include step S2021 and step S2022.

[0068] Before executing step S2021, a training set or data set corresponding to the target task may be obtained, which may include multiple text samples. The text sample may include text data and may include corresponding ground truth labels.

[0069] In step S2021, the text data in the text sample can be input into the neural network to be trained, and the text processing result output by the neural network to be trained can be obtained. Then, the parameters of the neural network to be trained can be adjusted based on the difference between the text processing result and the true label, including the learnable parameters and multiple importance coefficients in multiple network modules. After the training of the neural network to be trained is completed, multiple importance coefficients after training can be obtained.

[0070] In step S2022, the trained multiple importance coefficients can be directly determined as embedded features of the target task.

[0071] According to some embodiments, the neural network to be trained is a large language model. For a large language model, the computational cost and storage cost of obtaining task embedding using existing methods are very high, while using the method disclosed herein, the amount of data that needs to be stored is only the number of multi-head attention modules and the number of feedforward neural networks in the large language model. In some embodiments, the importance coefficient can be a Boolean variable (which will be described in detail below), thereby further reducing the amount of data that needs to be stored.

[0072] According to some embodiments, the initial values ​​of the multiple importance coefficients are obtained by random initialization. By training the neural network to be trained using text samples of different tasks, the multiple importance coefficients obtained by random initialization can converge to importance coefficient combinations corresponding to different tasks.

[0073] According to some embodiments, Figure 4 As shown, step S2021, training the neural network to be trained using the text sample corresponding to the target task, and obtaining multiple importance coefficients after training may include: step S401, determining a first loss value based on multiple importance coefficients, the first loss value is positively correlated with the absolute values ​​of the multiple importance coefficients; step S402, obtaining the text processing result output by the neural network to be trained based on the text sample, and determining a second loss value based on the text processing result, the second loss value is used to evaluate the text processing result; and step S403, adjusting multiple importance coefficients and learnable parameters of multiple network modules based on the first loss value and the second loss value.

[0074] Considering that neural networks are usually sparse, that is, the network modules that play an important role in neural networks are sparse, the multiple importance coefficients trained should also be sparse. In order to ensure the sparsity of the importance coefficients, an additional regularization term can be added to the training objective, namely the first loss value:

[0075]

[0076] Among them, λ H and λ F is the balance coefficient. The overall training objective of the neural network to be trained can be:

[0077]

[0078] in, Represents the second loss value used to evaluate text processing results.

[0079] According to some embodiments, Figure 5As shown, step S2021, using the text sample corresponding to the target task to train the neural network to be trained, and obtaining multiple importance coefficients after training may include: step S504, after adjusting the parameters for a preset number of iterations, converting the current multiple importance coefficients into multiple indication values ​​based on a preset threshold; and step S505, in response to determining that after adjusting the parameters for a consecutive number of preset iterations, the changes in the multiple indication values ​​meet the preset rules, stopping the training of the neural network to be trained. It can be understood that Figure 5 The operations of step S501 to step S503 in the above description of step S401 to step S403 can be referred to, and will not be repeated here.

[0080] In some embodiments, the importance coefficients can be converted into indicator values, and these indicator values ​​can converge at an early stage (no more than one round, i.e., no more than one complete training set traversal). Therefore, an early stopping strategy can be adopted to stop the model at an early stage of training according to the above rules. It should be noted that the neural network itself may not have converged at this time, i.e., the neural network cannot complete the corresponding target task well, but the indicator values ​​obtained by converting the importance coefficients have converged.

[0081] The preset number of iterations is also referred to as a small round or a micro-round (mini-epoch) in some cases, and its value can be set according to the needs and is not limited here. In step S505, in response to determining that after adjusting the parameters of the preset number of iterations for N consecutive times, the changes in the multiple indicator values ​​meet the preset rules, the training of the neural network to be trained can be stopped. It can be understood that the value of N can be set according to the needs and is not limited here.

[0082] In some embodiments, the indicator value may be 0 or 1, and the importance coefficient exceeding the preset threshold may be converted to 1, and the importance coefficient not exceeding the preset threshold may be converted to 0.

[0083] According to some embodiments, the multiple indicator values ​​are all Boolean variables, and the preset rule includes that after adjusting the parameters for multiple consecutive preset iterations, the number of indicator values ​​that have changed in the multiple indicator values ​​does not exceed the preset parameters.

[0084] In some embodiments, training can be stopped when the mask changes for several consecutive mini-epochs do not exceed a fixed parameter γ. It is understandable that the value of γ can be set according to needs and is not limited here.

[0085] According to some embodiments, step S2022, determining the embedded features of the target task based on the multiple importance coefficients after training, may include: determining the multiple indicator values ​​obtained from the last conversion as the embedded features of the target task.

[0086] In some embodiments, the indication values ​​obtained by the last conversion of the importance coefficients corresponding to multiple self-attention mechanism modules and the indication values ​​obtained by the last conversion of the importance coefficients corresponding to multiple feedforward neural network modules can be spliced ​​to obtain the embedded features of the target task.

[0087] According to some embodiments, step S203, determining the task similarity of the first task and the second task based on the respective embedded features of the first task and the second task may include: determining the task similarity of the first task and the second task based on the number of indicator values ​​that have the same position and the same value in the embedded features of the first task and the embedded features of the second task.

[0088] It can be understood that the indicator values ​​at the same position correspond to the same network module (self-attention head or feedforward neural network), and the same value means that the network module is important or unimportant in the first task or the second task. Therefore, the above method can easily and quickly obtain accurate task similarity.

[0089] According to another aspect of the present disclosure, a device for determining the similarity of text processing tasks is provided. Figure 6 As shown, the device 600 includes: a first determination unit 610, configured to determine a first task, a second task and a neural network to be trained, the neural network to be trained includes multiple network modules and multiple importance coefficients corresponding to the multiple network modules, and the multiple importance coefficients are respectively used to scale the output values ​​of the corresponding network modules; an embedding feature acquisition unit 620, configured to perform a target operation on the first task and the second task as target tasks respectively to obtain the respective embedding features of the first task and the second task, the embedding feature acquisition unit includes: a training subunit 622, configured to train the neural network to be trained using a text sample corresponding to the target task, and obtain the multiple importance coefficients after training; and a first determination subunit 624, configured to determine the embedding feature of the target task based on the multiple importance coefficients after training; and a second determination unit 630, configured to determine the task similarity of the first task and the second task based on the respective embedding features of the first task and the second task.

[0090] It can be understood that the operations and effects of the units 610 to 630 and their sub-units in the device 600 can refer to the above description of steps S201 to S203 and their sub-steps, and are not described in detail here.

[0091] According to some embodiments, the apparatus for determining the similarity of text processing tasks may further include: a task migration unit configured to perform task migration between the first task and the second task in response to determining that the task similarity between the first task and the second task is higher than a preset similarity.

[0092] According to some embodiments, task migration may include at least one of the following: using the training set of the first task to enhance the training set of the second task; migrating at least a portion of model parameters in the trained neural network for the first task to the neural network for the second task; and simultaneously training the neural network for the first task and the neural network for the second task, wherein the neural network for the first task and the neural network for the second task share part of the structure or parameters.

[0093] According to some embodiments, the neural network to be trained may be a Transformer architecture, and the multiple network modules may include multiple self-attention modules and multiple feedforward neural network modules.

[0094] According to some embodiments, the neural network to be trained may be a large language model.

[0095] According to some embodiments, initial values ​​of the plurality of importance coefficients may be obtained by random initialization.

[0096] According to some embodiments, the training subunit may include: a second determination subunit, configured to determine a first loss value based on multiple importance coefficients, the first loss value being positively correlated with the absolute values ​​of the multiple importance coefficients; an acquisition subunit, configured to obtain a text processing result output by the neural network to be trained based on the text sample, and determine a second loss value based on the text processing result, the second loss value being used to evaluate the text processing result; and a parameter adjustment subunit, configured to adjust multiple importance coefficients and learnable parameters of multiple network modules based on the first loss value and the second loss value.

[0097] According to some embodiments, the training subunit may include: a conversion subunit, configured to convert the current multiple importance coefficients into multiple indication values ​​based on a preset threshold after adjusting the parameters for a preset number of iterations; and an early stopping subunit, configured to stop training the neural network to be trained in response to determining that the changes in the multiple indication values ​​meet preset rules after adjusting the parameters for multiple consecutive preset numbers of iterations.

[0098] According to some embodiments, the multiple indicator values ​​may all be Boolean variables, and the preset rule may include that after multiple consecutive preset iterations of parameter adjustment, the number of indicator values ​​that have changed in the multiple indicator values ​​does not exceed the preset parameter.

[0099] According to some embodiments, the first determining subunit may include: a third determining subunit configured to determine the multiple indication values ​​obtained by the last conversion as embedded features of the target task.

[0100] According to some embodiments, the second determination unit may include: a fourth determination subunit configured to determine the task similarity between the first task and the second task based on the number of indication values ​​with the same position and the same value in the embedded features of the first task and the embedded features of the second task.

[0101] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0102] According to an embodiment of the present disclosure, an electronic device, a readable storage medium and a computer program product are also provided.

[0103] refer to Figure 7 , a block diagram of an electronic device 700 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0104] like Figure 7 As shown, the electronic device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0105] Multiple components in the electronic device 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 can be any type of device that can input information to the electronic device 700. The input unit 706 can receive input digital or character information and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 707 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 can include but is not limited to a disk, an optical disk. The communication unit 709 allows the electronic device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0106] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods, processes, and / or processes described above. For example, in some embodiments, these methods, processes, and / or processes may be implemented as computer software programs, which are tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 700 via ROM 702 and / or communication unit 709. When the computer program is loaded into RAM 703 and executed by the computing unit 701, one or more steps of the methods, processes, and / or processes described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to perform these methods, processes, and / or processes in any other appropriate manner (e.g., by means of firmware).

[0107] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0108] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0109] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0110] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0111] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0112] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0113] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0114] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.

Claims

1. A method for determining similarity of text processing tasks, comprising: Determine a first task, a second task, and a neural network to be trained, wherein the neural network to be trained includes a plurality of network modules and a plurality of importance coefficients corresponding to the plurality of network modules, wherein the plurality of importance coefficients are respectively used to scale output values ​​of corresponding network modules; The first task and the second task are respectively used as target tasks to perform target operations to obtain respective embedded features of the first task and the second task, wherein the target operations include: Using the text samples corresponding to the target task to train the neural network to be trained, and obtaining a plurality of importance coefficients after training; and Determining an embedding feature of the target task based on the multiple importance coefficients after training; and Based on the respective embedded features of the first task and the second task, task similarity between the first task and the second task is determined.

2. The method according to claim 1, wherein: Using the text sample corresponding to the target task to train the neural network to be trained, and obtaining multiple importance coefficients after training includes: Determining a first loss value based on the plurality of importance coefficients, wherein the first loss value is positively correlated with absolute values ​​of the plurality of importance coefficients; Obtaining a text processing result output by the neural network to be trained based on the text sample, and determining a second loss value based on the text processing result, wherein the second loss value is used to evaluate the text processing result; and Based on the first loss value and the second loss value, the plurality of importance coefficients and the learnable parameters of the plurality of network modules are adjusted.

3. The method according to claim 2, wherein: Using the text sample corresponding to the target task to train the neural network to be trained, and obtaining multiple importance coefficients after training includes: After adjusting the parameters for a preset number of iterations, converting the current multiple importance coefficients into multiple indication values ​​based on a preset threshold; and In response to determining that after a plurality of consecutive preset iterations of parameter adjustment, changes in a plurality of indicator values ​​satisfy preset rules, training of the neural network to be trained is stopped.

4. The method according to claim 3, wherein: The multiple indicator values ​​are all Boolean variables, and the preset rule includes that after the parameter is adjusted for multiple consecutive preset iterations, the number of changed indicator values ​​among the multiple indicator values ​​does not exceed the preset parameter.

5. The method according to claim 3, wherein: Determining the embedding features of the target task based on the multiple importance coefficients after the training includes: The multiple indicator values ​​obtained by the last conversion are determined as the embedded features of the target task.

6. The method according to claim 5, wherein: Determining the task similarity between the first task and the second task based on respective embedded features of the first task and the second task includes: The task similarity between the first task and the second task is determined based on the number of indicator values ​​having the same position and the same value in the embedded feature of the first task and the embedded feature of the second task.

7. The method according to any one of claims 1 to 6, wherein: The neural network to be trained is a Transformer architecture, and the multiple network modules include multiple self-attention modules and multiple feedforward neural network modules.

8. The method according to claim 7, wherein: The neural network to be trained is a large language model.

9. The method according to any one of claims 1 to 6, wherein: The initial values ​​of the multiple importance coefficients are obtained by random initialization.

10. The method according to any one of claims 1 to 6, further comprising: In response to determining that the task similarity between the first task and the second task is higher than a preset similarity, task migration is performed between the first task and the second task.

11. The method according to claim 10, wherein: The task migration includes at least one of the following: Using the training set of the first task to enhance the training set of the second task; Transferring at least a portion of model parameters in a neural network trained for the first task to a neural network for the second task; as well as The neural network for the first task and the neural network for the second task are trained simultaneously, wherein the neural network for the first task and the neural network for the second task share part of the structure or parameters.

12. A device for determining similarity of text processing tasks, comprising: A first determining unit is configured to determine a first task, a second task, and a neural network to be trained, wherein the neural network to be trained includes a plurality of network modules and a plurality of importance coefficients corresponding to the plurality of network modules, wherein the plurality of importance coefficients are respectively used to scale output values ​​of corresponding network modules; An embedding feature acquisition unit is configured to perform a target operation on the first task and the second task as target tasks, respectively, to obtain respective embedding features of the first task and the second task, the embedding feature acquisition unit comprising: A training subunit is configured to train the neural network to be trained using the text sample corresponding to the target task, and obtain a plurality of importance coefficients after training; and A first determining subunit is configured to determine the embedding features of the target task based on the trained multiple importance coefficients; and The second determining unit is configured to determine the task similarity between the first task and the second task based on respective embedded features of the first task and the second task.

13. The device according to claim 12, wherein: The training subunit comprises: a second determining subunit, configured to determine a first loss value based on the plurality of importance coefficients, wherein the first loss value is positively correlated with absolute values ​​of the plurality of importance coefficients; an acquisition subunit, configured to acquire a text processing result output by the neural network to be trained based on the text sample, and determine a second loss value based on the text processing result, wherein the second loss value is used to evaluate the text processing result; and A parameter adjustment subunit is configured to adjust the multiple importance coefficients and the learnable parameters of the multiple network modules based on the first loss value and the second loss value.

14. The device according to claim 13, wherein: The training subunit comprises: a conversion subunit, configured to convert the current plurality of importance coefficients into a plurality of indication values ​​based on a preset threshold after adjusting the parameters for a preset number of iterations; and The early stopping subunit is configured to stop training the neural network to be trained in response to determining that after adjusting the parameters for a plurality of consecutive preset iterations, changes in a plurality of indication values ​​satisfy preset rules.

15. The device according to claim 14, wherein: The multiple indicator values ​​are all Boolean variables, and the preset rule includes that after the parameter is adjusted for multiple consecutive preset iterations, the number of changed indicator values ​​among the multiple indicator values ​​does not exceed the preset parameter.

16. The device according to claim 14, wherein: The first determining subunit includes: The third determining subunit is configured to determine the multiple indication values ​​obtained by the last conversion as the embedded features of the target task.

17. The device according to claim 16, wherein: The second determining unit includes: The fourth determining subunit is configured to determine the task similarity between the first task and the second task based on the number of indication values ​​having the same position and the same value in the embedded feature of the first task and the embedded feature of the second task.

18. The device according to any one of claims 12 to 17, wherein: The neural network to be trained is a Transformer architecture, and the multiple network modules include multiple self-attention modules and multiple feedforward neural network modules.

19. The device according to claim 18, wherein The neural network to be trained is a large language model.

20. The device according to any one of claims 12 to 17, wherein: The initial values ​​of the multiple importance coefficients are obtained by random initialization.

21. The apparatus according to any one of claims 12 to 17, further comprising: The task migration unit is configured to perform task migration between the first task and the second task in response to determining that the task similarity between the first task and the second task is higher than a preset similarity.

22. The device according to claim 21, wherein The task migration includes at least one of the following: Using the training set of the first task to enhance the training set of the second task; Transferring at least a portion of model parameters in a neural network trained for the first task to a neural network for the second task; as well as The neural network for the first task and the neural network for the second task are trained simultaneously, wherein the neural network for the first task and the neural network for the second task share part of the structure or parameters.

23. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; wherein The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 11.

24. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-11.

25. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Intelligent voice signature method and device based on text semantic similarity and medium

    CN110502610A

  • Text similarity determination method and device, equipment and medium

    CN111737954A

  • Multi-task learning network training method and device, electronic equipment and storage medium

    CN117829212A

  • Method for optimizing sentence vector model and method and device for calculating text similarity

    CN117910522A

  • Artificial intelligence system for image similarity analysis using optimized image pair selection and multi-scale convolutional neural networks

    US10467526B1