Label generation method and device and electronic equipment
Through the combination of hierarchical labeling system and large language models, intermediate and terminating nodes are determined at a level, which solves the problem of tag omission in extreme multi-label text classification, improves the accuracy and efficiency of tag generation, and enhances the business recommendation effect.
Patent Information
- Application Number
- CN202411337666.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2024-12-13
AI Technical Summary
The existing technology often has the problem of partial label omissions in the extreme multi-label text classification task, which affects the effectiveness of business recommendations. Especially when the data volume is large and the variety of class labels is diverse, it is difficult for existing methods to effectively improve the label generation effect. .
Using a hierarchical label system and a large language model, the intermediate nodes and terminating nodes related to the target object are determined hierarchically, thereby generating the labels of the target object, combining coarse-grained retrieval and fine-grained screening to improve the accuracy and efficiency of label generation.
It effectively reduces label omissions, improves the accuracy and efficiency of label generation, and enhances the service recommendation effect based on labels, especially in scenarios with large data volume and diverse class tags.
Smart Images

Figure CN119128272A_ABST
Abstract
Description
Technical Field
[0001] This document belongs to the field of data processing technology, and specifically relates to a method, device and electronic device for generating labels. Background Art
[0002] Multi-label text classification is an important task that uses machines to efficiently and automatically process and summarize massive amounts of text information, that is, to associate a sample example with a subset of labels. In the real world, data is produced quickly and in large volumes, with obvious diversity and complexity. Correspondingly, the number of class labels is no longer in units of tens or hundreds, but in units of thousands, tens of thousands, or even hundreds of thousands. In this regard, multi-label text classification tasks with more than a thousand class labels are usually called extreme multi-label text classification tasks.
[0003] For data that does not infringe user privacy, the method of using classifiers to determine labels often results in some labels being missed, which will affect the effect of business recommendations based on labels (such as movie recommendations, product recommendations, etc.). Therefore, it is necessary to provide a better label generation solution to improve the label generation effect, and thus improve the effect of business recommendations based on labels. Summary of the invention
[0004] The embodiments of the present specification provide a method, device and electronic device for generating a label, so as to provide a label generation solution.
[0005] In a first aspect, an embodiment of the present specification provides a method for label generation, the method comprising: receiving a label generation instruction for a target object input by a user, the label generation instruction comprising description information of the target object, the description information comprising at least an identifier of the object; obtaining a hierarchical label system matching the target object, the hierarchical label system being a label system with a hierarchical structure constructed according to a preset label set, the labels in the label set being stored in at least one termination node in the hierarchical label system, in which the labels stored in the node comprise labels stored in each node of the next level connected to the node, the intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node; based on a large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system, determining the intermediate nodes related to the target object layer by layer; in the hierarchical label system, determining the termination node connected to the intermediate node related to the target object as the target termination node, and determining the label of the target object from the labels stored in the target termination node.
[0006] In a second aspect, an embodiment of the present specification provides a device for generating labels, including: an instruction receiving module, which is used to receive a label generation instruction for a target object input by a user, wherein the label generation instruction includes description information of the target object, and the description information includes at least an identifier of the object; a system acquisition module, which is used to acquire a hierarchical label system matching the target object, wherein the hierarchical label system is a label system with a hierarchical structure constructed according to a preset label set, wherein labels in the label set are stored in at least one termination node in the hierarchical label system, and in the hierarchical label system, labels stored in the node include labels stored in each node of the next level connected to the node, and the intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node; a node determination module, which is used to determine the intermediate nodes related to the target object layer by layer based on a large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system; a label generation module, which is used to determine the termination node connected to the intermediate node related to the target object as the target termination node in the hierarchical label system, and determine the label of the target object from the labels stored in the target termination node.
[0007] In a third aspect, an embodiment of the present specification provides an electronic device, which includes: a processor, and a memory arranged to store computer executable instructions, when the executable instructions are executed, the processor can: receive a label generation instruction for a target object input by a user, the label generation instruction includes description information of the target object, and the description information includes at least an identifier of the object; obtain a hierarchical label system matching the target object, the hierarchical label system is a label system with a hierarchical structure constructed according to a preset label set, the labels in the label set are stored in at least one termination node in the hierarchical label system, in the hierarchical label system, the labels stored in the node include labels stored in each node of the next level connected to the node, the intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node; based on a large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system, determine the intermediate nodes related to the target object layer by layer; in the hierarchical label system, determine the termination node connected to the intermediate node related to the target object as the target termination node, and determine the label of the target object from the labels stored in the target termination node.
[0008] In a fourth aspect, an embodiment of the present specification provides a storage medium for storing a computer program, wherein the computer program can be executed by a processor to implement the following process: receiving a label generation instruction for a target object input by a user, wherein the label generation instruction includes description information of the target object, and the description information includes at least an identifier of the object; obtaining a hierarchical label system matching the target object, wherein the hierarchical label system is a label system with a hierarchical structure constructed according to a preset label set, wherein labels in the label set are stored in at least one termination node in the hierarchical label system, and in the hierarchical label system, labels stored in the node include labels stored in each node of the next level connected to the node, and the intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node; based on a large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system, determining the intermediate nodes related to the target object layer by layer; in the hierarchical label system, determining the termination node connected to the intermediate node related to the target object as the target termination node, and determining the label of the target object from the labels stored in the target termination node.
[0009] In a fifth aspect, an embodiment of the present specification provides a computer program product, including a computer program, which implements the following process when executed by a processor: receiving a label generation instruction for a target object input by a user, the label generation instruction includes description information of the target object, and the description information includes at least an identifier of the object; obtaining a hierarchical label system matching the target object, the hierarchical label system is a label system with a hierarchical structure constructed according to a preset label set, and the labels in the label set are stored in at least one termination node in the hierarchical label system, in which the labels stored in the node include the labels stored in each node of the next level connected to the node, and the intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node; based on a large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system, determining the intermediate nodes related to the target object layer by layer; in the hierarchical label system, determining the termination node connected to the intermediate node related to the target object as the target termination node, and determining the label of the target object from the labels stored in the target termination node. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate one or more embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in one or more embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0011] Figure 1 It is a flowchart of a method for generating a label provided in an embodiment of this specification; Figure 2 It is a schematic diagram of a process of using an agent to determine a label of user input content provided by an embodiment of this specification; Figure 3 This is a schematic diagram of an application scenario of a label generation method provided in an embodiment of this specification; Figure 4 It is a schematic diagram of a partial process of constructing a hierarchical labeling system provided in an embodiment of this specification; Figure 5 is a schematic diagram of a result determined by an intelligent agent provided in an embodiment of this specification; Figure 6 It is a schematic diagram of a method for using a deductive template and an inductive template provided in an embodiment of this specification; Figure 7 It is a structural schematic diagram of a label generation device provided in an embodiment of this specification; Figure 8 It is a structural diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0012] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this document.
[0013] The terms "first", "second", etc. in the specification and claims of this document are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of this specification can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0014] The label generation method, device and electronic device provided in the embodiments of this specification are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0015] Figure 1 A method for generating a label provided by an embodiment of the present invention is shown. The method can be executed by an electronic device, and the electronic device may include: a server and / or a terminal device, wherein the terminal device may be, for example, a vehicle-mounted terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed in the aforementioned electronic device, and the method for generating a label includes the following steps: Step S102: receiving a tag generation instruction for a target object input by a user.
[0016] The target object is an object input by the user for generating a tag, which can be a physical object, such as a commodity, an animal, etc., or a virtual object, such as a movie, a virtual service, etc. The type of the target object is not specifically limited in this specification and can be determined according to actual conditions. In order to better illustrate this specification and highlight the main purpose of this specification, the specific embodiments in this specification use the song as the description object. Those skilled in the art should understand that this specification can also be implemented for other types of objects.
[0017] Specifically, the tag generation instruction may include descriptive information of the target object, such as the identifier of the object. For example, when the target object is a song, the descriptive information may be the song's identifier, i.e., the song's name; when the target object is a novel, the descriptive information may be the novel's identifier, i.e., the novel's name. In cases where the descriptive information is relatively common, such as when the song's name for which a tag is to be generated is used as the song's name by multiple songs, other descriptive information may be added to the descriptive information, such as the author of the song. The content of the descriptive information is not specifically limited in this specification and may be determined based on actual conditions. Typically, the descriptive information is information in text form.
[0018] Step S104: Acquire a hierarchical label system that matches the target object.
[0019] Different application scenarios, different object types, etc. will result in different labels being generated and used. Therefore, different hierarchical label systems can be constructed according to different application scenarios, etc., and after obtaining the target object, it is necessary to first determine the hierarchical label system that matches the target object, and then determine the label of the target object. Specifically, the application scenario of the target object can be set in the description information, and then the hierarchical label system that matches the target object can be determined according to the application scenario of the target object.
[0020] The preset label set is a collection of labels collected in a specific application scenario, which can be used to build a hierarchical label system with a hierarchical structure. The nodes in the hierarchical label system can be divided into root nodes, intermediate nodes (internal nodes) and terminal nodes (leaf nodes). The root node in the hierarchical label system can store each label in the label set, and the label stored in each node contains the labels stored in each node of the next level under the node. Each terminal node can store a label in the label set. A label in the label set corresponds to a label stored in at least one terminal node of the hierarchical label system, that is, each terminal node corresponds to a label and the labels stored in different terminal nodes can be the same.
[0021] The structure of the hierarchical label system is not specifically limited in this specification, and may be a tree structure or a graph structure. For the latter, there may be situations where different terminal nodes store the same label.
[0022] In the case where the labels stored in different terminal nodes in the hierarchical label system may be the same, when determining the label of the node at the next level for a node, even if a label of the target object is missing in one branch, other branches may supplement the missing label, which can reduce the phenomenon of incomplete labels of the generated target object. The construction process of the hierarchical label system in this specification can refer to the subsequent embodiments and will not be repeated here.
[0023] Step S106: Based on the large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system, the intermediate nodes related to the target object are determined layer by layer.
[0024] For each intermediate node in the hierarchical label system, the stored label is subordinate to the generated label. The generated label can be generated based on some or all of the labels stored in the intermediate node. The generation method of the generated label can refer to the subsequent embodiments and will not be described here. For example, for an intermediate node, its generated label is "music", and its stored labels "guitar", "pop music", etc. are subordinate to the generated label "music".
[0025] Based on the characteristics corresponding to the labels in the label set in step S104 and the labels stored in at least one terminal node of the hierarchical label system, a strategy similar to breadth search is set for the hierarchical label system in step S106 to achieve coarse-grained retrieval of nodes (including intermediate nodes and terminal nodes), expand the retrieval scope, and further reduce the probability of missing the label of the target object.
[0026] In one example, the description information can be input into an intelligent agent capable of making decisions and taking actions autonomously. Based on the description information and the generated labels of each intermediate node, the intelligent agent starts from the root node of the hierarchical label system, finds the intermediate nodes of the second level related to the target object from the intermediate nodes of the second level connected to the root node (first level), and then finds the intermediate nodes of the third level related to the target object from the intermediate nodes of the third level connected to the intermediate nodes of the second level related to the target object. This is done sequentially until the intermediate nodes are retrieved. During the retrieval process, the intermediate nodes of the next level related to the target object are subordinate to at least one intermediate node of the previous level related to the target object.
[0027] In one example, based on the large language model technology, the intermediate nodes related to the target object in each level can be determined in the hierarchical label system. That is, the above-mentioned intelligent agent can be constructed based on the large language model.
[0028] Step S108: In the hierarchical label system, the terminal node connected to the intermediate node related to the target object is determined as the target terminal node, and the label of the target object is determined from the label stored in the target terminal node.
[0029] Among them, the target end node is the end node related to the target object, and the target end node is connected to the aforementioned part of the intermediate nodes related to the target object. The labels stored in these target end nodes include the labels of the target object. In one example, the number of labels stored in the target end node (i.e., the number of target end nodes) can be determined first. When the number is small, all these labels are directly determined as the labels of the target object. When the data is large, several labels can be selected from these labels, and the selected labels are determined as the labels of the target object.
[0030] Figure 2 FIG. 4 shows a schematic diagram of the process of using an agent to determine the label of user input content. Figure 2As shown, the user inputs the song name "XXXX" to the agent, and the agent built based on the large language model starts from the intermediate node of the second level connected to the root node, and finds the intermediate node "Art" related to the input song name from the intermediate nodes "Clothing", "Art", and "Sports" of the second level, and finds the intermediate nodes "Dance" and "Music" related to the song name from the intermediate nodes "Dance" and "Music" connected to the intermediate node "Art". Then, the terminal node connected to the intermediate nodes "Dance" and "Music" is determined as the target terminal node, and the labels "Latin Dance" and "Pop Music" of the song "XXXX" are found from the labels "Latin Dance", "Samba", "Rock", "Guitar", and "Pop Music" stored in these target terminal nodes. At this time, the retrieval of the label of the input song name in the hierarchical label system is completed.
[0031] In the embodiment of the present specification, after receiving the label generation instruction, the intermediate nodes related to the target object are first determined from the root node of the hierarchical label system layer by layer, and then the target terminal node is determined, and then the label of the target object is determined from the label stored in the target terminal node. For the hierarchical label system where the label of the terminal node may be repeated, this process uses a coarse-grained method of screening the target nodes related to the description information based on a large language model, thereby avoiding the omission of the label of the target object, improving the label generation effect of the target object, and further improving the object recommendation effect based on the label.
[0032] Figure 3 A schematic diagram of an application scenario of a label generation method is provided, such as Figure 3 As shown, the user sends a service request to the server through a terminal such as a mobile phone. The service request includes: executing the target task of label generation based on the description information of the target object provided by the user. After receiving the service request, the server uses the label generation method in this specification to obtain the label of the target object, and sends the label of the target object to the terminal for the user's reference.
[0033] In the process of recommending objects or services to users based on tags, users will only browse a limited number of items with limited time and energy to determine the objects that meet their expectations. If the number of tags of the target object is too large, it will result in too many object categories being recommended to the user, or even recommending less relevant objects to the user, which will affect the conversion rate of the recommended objects and the user's experience. Therefore, the number of tags of the target object should not be too large. In one implementation, step S108 can be executed as the following steps A1-A2: Step A1, when the number of tags stored in the target termination node is greater than a first preset value, sorting the relevance between the tags stored in the target termination node and the description information of the target object based on the large language model; Step A2: According to the sorting result, determine the label of the target object from the labels stored in the target termination node.
[0034] In the process of determining the label of the target object, when the number of labels stored in the target termination node is large, labels that are more matched with the target object can be selected from the labels stored in the target termination node. Specifically, the correlation between the labels stored in the target termination node and the description information can be calculated first, and then the sorting result of the labels stored in the target termination node can be determined according to the correlation, and then the labels of the target object whose number is a first preset value can be screened out from the sorting result.
[0035] The relevance between the label and the description information stored in the target termination node can be determined using a similarity measurement method. Specifically, the similarity measurement method can be to measure the distance or angle between the vectors corresponding to the label and the description information stored in the target termination node. The similarity measurement method can be Euclidean distance, cosine similarity, Pearson correlation coefficient, etc. The specific similarity measurement method is not limited in this specification.
[0036] like Figure 2 As shown, the labels stored in the target termination node determined by the agent are "Latin dance" and "Pop music". Since the number of labels is small, no further screening is required and the song labels "Latin dance" and "Pop music" are directly output.
[0037] In the embodiments of the present specification, based on a large language model, a fine-grained method of filtering the label of the target object from the label of the target termination node is adopted, thereby improving the accuracy of the label of the target object that is finally output. At the same time, this method makes the label generation process both efficient and accurate, which helps to further improve the label generation effect, thereby improving the conversion rate and user experience of object recommendations based on the label of the target object.
[0038] In one implementation, the process of constructing the hierarchical label system can be performed as follows: Steps B1-B2: Step B1, based on a large language model, according to the types of labels obtained by sampling the label set multiple times, generate intermediate nodes in the hierarchical label system and their generated labels, and store the labels in the label set in each intermediate node in the hierarchical label system according to the generated labels, and the set of labels stored in the intermediate node is the same as the set of labels stored in each intermediate node of the next level connected to the intermediate node; Step B2, when the number of labels stored in the intermediate nodes of the hierarchical label system is less than the second preset value, generate a terminal node in the hierarchical label system that corresponds one-to-one to the labels stored in the intermediate nodes, and store the labels stored in the intermediate nodes in the terminal nodes corresponding to the labels.
[0039] In this specification, a method of generating intermediate nodes by sampling is used to construct a hierarchical label system. Specifically, the process of generating intermediate nodes by sampling may include: sampling the label set multiple times to generate intermediate nodes, generating generated labels for the intermediate nodes according to the types of labels in the sampling results, and comparing the labels in the label set with the generated labels of each intermediate node to determine the labels in the label set assigned to each intermediate node, and storing the assigned labels in the intermediate node. In the case where the number of labels stored in the intermediate node is less than the second preset value, a termination node under the intermediate node may be constructed, and the termination node corresponds one-to-one with the labels in the intermediate node. Furthermore, the labels stored in the intermediate node may be stored one-to-one in the corresponding termination node.
[0040] Furthermore, the structure of the intermediate nodes in the hierarchical label system can be determined based on the hierarchical relationship of each intermediate node, wherein the hierarchical relationship can be determined based on the relationship between the corresponding generated labels. In addition, the intermediate nodes can be generated directly from the root node in sequence, so that the generated intermediate nodes naturally have a hierarchical relationship. In one implementation, step B1 can be executed as the following steps C1-C4: Step C1, based on the large language model, according to the types of labels obtained by sampling the label set multiple times, generate the intermediate nodes of the second level in the hierarchical label system and their generated labels; Step C2, based on the generated labels of the second level, the labels in the label set are stored in each intermediate node of the second level in the hierarchical label system; Step C3, generating the intermediate nodes of the i-th level in the hierarchical label system and their generated labels according to the types of labels obtained by sampling the labels stored in the intermediate nodes of the i-1th level in the hierarchical label system multiple times, where i is greater than 1; Step C4, based on the generated labels of the i-th level, the labels stored in the intermediate nodes of the i-1th level in the hierarchical label system are stored in each intermediate node of the i-th level connected to the intermediate node of the i-1th level.
[0041] Specifically, the label set can be sampled first, and based on the large language model, the intermediate nodes of the second level in the hierarchical label system can be generated. The generated labels corresponding to the intermediate nodes can be generated according to the types of the sampled labels corresponding to the intermediate nodes. Furthermore, the labels in the label set can be assigned to the intermediate nodes of the second level, and the assignment method can be determined by comparing the labels in the label set with the generated labels. The generation process of the intermediate nodes of other levels is similar to that of the intermediate nodes of the second level. The difference is that the source of the labels assigned to the intermediate nodes of the second level is the labels in the label set, while the source of the labels assigned to the intermediate nodes of other levels is the labels stored in the intermediate nodes of the previous level connected to the intermediate nodes.
[0042] It should be noted that when sampling the labels stored in the intermediate nodes of each level, the number of sampled labels can be proportional to the number of labels stored in the intermediate nodes. The more labels stored in the intermediate nodes, the more labels are sampled each time when generating the intermediate nodes of the next level, and vice versa.
[0043] The method of generating intermediate nodes by sampling can make different terminal nodes store the same label. However, in special cases, the method of generating intermediate nodes by sampling may result in a large number of repeated labels in two branches. If these two branches are retained at the same time, it will lead to subsequent waste of resources. Therefore, it is necessary to correct this phenomenon and discard some of the divisions with high overlap. This process can be performed recursively. Specifically, in the process of constructing a hierarchical label system, the labels stored in each intermediate node of the same level can be compared. When the repetition rate of the labels stored in two intermediate nodes exceeds a threshold, the branches corresponding to the two intermediate nodes in the hierarchical label system can be merged.
[0044] Figure 4 A schematic diagram of part of the process of constructing a hierarchical label system is shown, Figure 4 As shown in the figure, the 6000 tags in the tag set are first stored in the root node, and then the tags in the tag set are sampled for the first time to generate the first-level intermediate nodes and their generated labels. The generated labels of these intermediate nodes are "sports", "creation", "art" and "clothing", and according to the generated labels of the intermediate nodes, the tags in the tag set are stored in each intermediate node. In the case that the repetition rate of the tags contained in the intermediate nodes "creation" and "art" is high, the two intermediate nodes are merged, leaving only the intermediate node "art".
[0045] In the process of using and maintaining the hierarchical label system, you may encounter labels that are not stored in the hierarchical label system. In this case, you need to add the labels to the hierarchical label system to maintain the hierarchical label system to improve the use effect of the hierarchical label system. In one implementation, the hierarchical label system construction process can also be executed as the following steps D1-D3: Step D1, receiving newly added labels that are not stored in each termination node of the hierarchical label system; Step D2, based on the large language model, starting from the root node of the hierarchical label system, determining the intermediate nodes corresponding to the newly added labels layer by layer, and storing the newly added labels in the intermediate nodes corresponding to the newly added labels; Step D3: when the intermediate node storing the newly added label is connected to the termination node, a termination node subordinate to the intermediate node storing the newly added label is generated, and the newly added label is stored in the newly generated termination node.
[0046] Specifically, a label that is not stored in the termination node of the hierarchical label system can be used as a new label. The method of inserting a new label into the hierarchical label system can be similar to the aforementioned label generation process, starting from the root node, determining the intermediate nodes related to the new label layer by layer (the number of intermediate nodes here is not limited, and there can be multiple intermediate nodes related to the new label), and then generating a new termination node at the intermediate node related to the new label at the last level, and the new label will be stored in the root node, each related intermediate node and the new termination node.
[0047] In the embodiments of this specification, a hierarchical label system is generated by sampling and label allocation. Since some labels may be allocated to multiple different intermediate nodes at the same level during the label allocation process, this will cause the label duplication of the terminal node in the generated hierarchical label system. This phenomenon will avoid or reduce the omission of labels related to the target object during the label generation process, thereby improving the effect of label generation. At the same time, this process seamlessly adds new labels without destroying the overall structure of the original hierarchical label system, making the hierarchical label index an extensible hierarchical label index, which can reduce the complexity of the training process for the intelligent agent.
[0048] In one implementation, the label generation method is used for an intelligent agent, and the training process of the intelligent agent can be performed as follows: Steps E1-E4: Step E1, obtaining a training data set and a preset hierarchical label system, the training data set including a plurality of sample objects with initial labels and description information; Step E2, based on the large language model, starting from the root node of the preset hierarchical label system, according to the description information of the sample object and the generated labels of each intermediate node in the preset hierarchical label system, determine the intermediate nodes related to the sample object layer by layer; Step E3, in a preset hierarchical label system, determining the end node connected to the intermediate node related to the sample object as the sample end node, and determining the label of the sample object from the labels stored in the sample end node; Step E4, when the label of the sample object is different from the initial label, the parameters of the agent are adjusted to obtain a trained agent.
[0049] Among them, the training data set can be a data set used to train an intelligent agent for a preset scenario, the preset hierarchical label system can be a label system constructed according to a preset label set, which can be a graph or tree structure data, the preset label set is a collection of labels collected under a preset scenario, and the preset scenarios corresponding to the training data set and the preset hierarchical label system should be the same. After the training is completed, when the user inputs a target object to the intelligent agent, the intelligent agent can use the preset hierarchical label system used when training the intelligent agent to determine the label of the target object and output it to the user, so that the user can make recommendations for services based on the label of the target object.
[0050] Similar to the aforementioned process of determining the label of the target object, the process of determining the label of the sample object is also based on a large language model. According to the description information of the sample object and the generated labels of each intermediate node in the preset hierarchical label system, the intermediate nodes related to the sample object are determined layer by layer from the preset hierarchical label system, and then the terminal node connected to the intermediate node related to the sample object is determined as the target terminal node, and then the label of the sample object is determined from the label stored in the target terminal node.
[0051] When the label of the sample object is different from the initial label, the parameters of the agent are adjusted to achieve training of the agent. The difference between the label of the sample object and the initial label includes a different number of labels and / or different labels. Since the hierarchical label system contains multiple levels of labels, the agent can be trained layer by layer from top to bottom. In one implementation, step E4 can be executed as the following steps F1-F5: Step F1, starting from the terminal node with the initial label in the hierarchical label system, determine the intermediate nodes containing the initial label layer by layer; Step F2, determining the label of the node containing the initial label as the first label of the sample object; Step F3, determining the label of the node containing the label of the sample object as the second label of the sample object; Step F4, after the first label and the second label of the i-1th level have been used to adjust the parameters of the agent, when the first label and the second label of the i-th level are different, obtaining a preset adjustment template, i is greater than 1 and less than or equal to N, N is the number of levels of the preset hierarchical label system; Step F5, using a preset adjustment template, constructs input information including description information of the sample object and the first label of the i-th level, and inputs the input information into the agent to adjust the parameters of the agent to obtain a trained agent.
[0052] The training process of the agent will first use two types of labels. The first is the label of the sample object output by the agent, and the second is the initial label of the pre-labeled sample object. If the two are different, it means that the parameters of the current agent need to be adjusted.
[0053] During the training process of the intelligent agent, the hierarchical label system can be traversed from the terminal node storing the initial label according to the initial label to determine the nodes containing the initial label (i.e., the root node, intermediate node and terminal node containing the initial label), and then determine the first label of the sample object; then, according to the nodes containing the label of the sample object (i.e., the root node, intermediate node and terminal node containing the label of the sample product), the second label of the sample object is determined; finally, starting from the root node of the hierarchical label system, the first label and the second label are compared layer by layer. When the first label and the second label of each layer are different, the parameters of the intelligent agent are adjusted until the label of the sample object output by the terminal node is the same as the initial label.
[0054] Specifically, the parameter adjustment process of the agent can be to input the correct information into the agent. In order to ensure the standardization of the information input into the agent and facilitate the agent to accurately understand the user's intention, a preset adjustment template can be used to construct the input information. The adjustment template is a template that uses prompt words to standardize the user input to obtain the input information. The adjustment template contains prompt words, which play a vital role. Its quality directly determines the training quality of the agent.
[0055] Figure 5 A schematic diagram showing the results determined by the agent is shown. Figure 5 As shown in the figure, the agent returned the labels "Latin Dance" and "Pop Music", the former is a label that is irrelevant to the input song name (wrong), the latter is a label that is relevant to the input song name (correct), and the label "Rock" is a label that is relevant to the input song name but is not hit by the agent. Therefore, the labels "Latin Dance" and "Rock" are both labels that need to be input into the agent based on the adjustment model to adjust the agent parameters.
[0056] In one implementation, step F5 may be performed as the following steps G1-G3: Step G1, constructing first input information including description information according to the object prompt words in the adjustment template; Step G2, when the adjustment template is a deductive template, construct second input information for determining whether the sample object has an initial label according to the instruction prompt words in the adjustment template; Step G3, when the adjustment template is an inductive template, construct second input information for selecting a label of a sample object from a plurality of labels including the initial label according to the instruction prompt words in the inductive template.
[0057] Among them, the adjustment template can include object prompt words and instruction prompt words. The object prompt words are used to input descriptive information of the object, such as the name of a song, into the intelligent agent, and the instruction prompt words are used to issue instructions to the intelligent agent so that the intelligent agent can accept and understand the correct information.
[0058] The object prompt words of the deductive template and the inductive template are the same, but the instruction prompt words are different. Specifically, the instruction prompt words of the deductive template are used to show the correct initial label corresponding to the wrong label to the intelligent agent, so as to train the intelligent agent to have the classification criteria corresponding to the correct label; the object prompt words of the inductive template are used to show the correct initial label corresponding to the wrong label and other labels (which can be other initial labels of sample objects or other wrong labels) to the intelligent agent at the same time, so that the intelligent agent can select the correct label from the input labels. That is, the deductive template is mainly used to repair the wrong output label, and the inductive template is mainly used to repair the missing label.
[0059] Figure 6 The following is a schematic diagram showing the usage of deductive templates and inductive templates. Figure 6 As shown, both the deductive template and the inductive template contain the object prompt word "object description", which is used to instruct the user to input the description information of the object. Here, the user inputs the song name; the instruction indicator word corresponding to the deductive template is "instruction", which is used to instruct the user to input the correct label classification. It can be seen that the user here inputs the prompt information containing the correct label "rock"; the instruction prompt words corresponding to the inductive template are "instruction" and "candidate list". The former is used to instruct the user to input the adjustment target, and the latter is used to instruct the user to input the candidate label corresponding to the adjustment target. It can be seen that the user inputs multiple labels containing the correct initial label "rock". Since the prompt words corresponding to the inductive template and the deductive template are different, the information input by the user is different, and thus the reply corresponding to the reply prompt word "expected reply" is also different. Among them, the reply prompt word is used to prompt the intelligent agent to output information according to the prompt format.
[0060] Both deductive templates and inductive templates can instruct the agent to adjust parameters, and their uses are also different. In one example, the two templates can be mixed and the usage ratio of the two can be constrained. Under the constraint of the preset ratio, the agent can randomly determine the adjustment template for the sample objects corresponding to the wrong labels, so that the agent can adjust parameters based on repairing the missing labels and repairing the wrong labels, which fully improves the performance of the agent.
[0061] In addition to the aforementioned object prompt words and instruction prompt words, the adjustment template can also include answer prompt words to further instruct the agent's answer. Figure 6 As shown, the response prompts of the deductive template and the inductive template are different. The former gives the reason for the correct answer, while the latter lists multiple labels including the correct label.
[0062] In the embodiment of the present specification, when the label of the sample object is different from the initial label, the parameters of the agent are adjusted so that the agent can output a highly accurate label for the input object, thereby improving the user's satisfaction with the recommended object.
[0063] It should be noted that the method for label generation provided in the embodiments of this specification may be executed by a label generation device or a control module in the label generation device for executing the label generation method. In the embodiments of this specification, the label generation device executing the label generation method is taken as an example to illustrate the label generation device provided in the embodiments of this specification.
[0064] Figure 7 Schematic diagram of the structure of a device for generating labels according to an embodiment of the present invention. Figure 7 As shown, the label generation device 700 includes: The instruction receiving module 710 is used to receive a tag generation instruction for a target object input by a user, where the tag generation instruction includes description information of the target object, and the description information includes at least an identifier of the object; The system acquisition module 720 is used to acquire a hierarchical label system that matches the target object. The hierarchical label system is a label system with a hierarchical structure constructed according to a preset label set. Labels in the label set are stored in at least one terminal node in the hierarchical label system. In the hierarchical label system, the labels stored in the node include the labels stored in each node of the next level connected to the node. The intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node. A node determination module 730 is used to determine the intermediate nodes related to the target object layer by layer based on the large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system; The label generation module 740 is used to determine the terminal node connected to the intermediate node related to the target object as the target terminal node in the hierarchical label system, and determine the label of the target object from the label stored in the target terminal node.
[0065] In one embodiment, the tag generation module 740 includes: A sorting unit, configured to sort the relevance between the labels stored in the target terminating node and the description information of the target object based on the large language model when the number of labels stored in the target terminating node is greater than a first preset value; The label generation unit is used to determine the label of the target object from the labels stored in the target termination node according to the sorting result.
[0066] In one embodiment, the process of constructing a hierarchical label system includes: Based on a large language model, the intermediate nodes in the hierarchical label system and their generated labels are generated according to the types of labels obtained by multiple sampling of the label set, and the labels in the label set are stored in each intermediate node in the hierarchical label system according to the generated labels. The set of labels stored in the intermediate node is the same as the set of labels stored in each intermediate node of the next level connected to the intermediate node; When the number of labels stored in the intermediate nodes of the hierarchical label system is less than a second preset value, a termination node corresponding to the labels stored in the intermediate nodes in the hierarchical label system is generated, and the labels stored in the intermediate nodes are stored in the termination nodes corresponding to the labels.
[0067] In one embodiment, based on a large language model, intermediate nodes in a hierarchical tag system and their generated labels are generated according to the types of labels obtained by sampling the tag set multiple times, and the labels in the tag set are stored in each intermediate node in the hierarchical tag system according to the generated labels, including: Based on a large language model, the intermediate nodes of the second level in the hierarchical label system and their generated labels are generated according to the types of labels obtained by multiple sampling of the label set; According to the generated labels of the second level, the labels in the label set are stored in each intermediate node of the second level in the hierarchical label system; According to the types of labels obtained by sampling the labels stored in the intermediate nodes of the i-1th level in the hierarchical label system multiple times, the intermediate nodes of the i-th level in the hierarchical label system and their generated labels are generated, where i is greater than 1; According to the generated labels of the i-th level, the labels stored in the intermediate nodes of the i-1th level in the hierarchical label system are stored in each intermediate node of the i-th level connected to the intermediate nodes of the i-1th level.
[0068] In one embodiment, the hierarchical label system construction process further includes: Receive newly added labels that are not stored in each terminating node of the hierarchical label system; Based on the large language model, starting from the root node of the hierarchical label system, the intermediate nodes corresponding to the newly added labels are determined layer by layer, and the newly added labels are stored in the intermediate nodes corresponding to the newly added labels; When the intermediate node storing the newly added label is connected to the termination node, a termination node subordinate to the intermediate node storing the newly added label is generated, and the newly added label is stored in the newly generated termination node.
[0069] In one embodiment, the method is used for an intelligent agent, and the training process of the intelligent agent includes: Obtain a training data set and a preset hierarchical label system, where the training data set includes multiple sample objects with initial labels and description information; Based on a large language model, starting from the root node of a preset hierarchical label system, according to the description information of the sample object and the generated labels of each intermediate node in the preset hierarchical label system, the intermediate nodes related to the sample object are determined layer by layer; In the preset hierarchical label system, the terminal node connected to the intermediate node related to the sample object is determined as the sample terminal node, and the label of the sample object is determined from the label stored in the sample terminal node; When the label of the sample object is different from the initial label, the parameters of the agent are adjusted to obtain the trained agent.
[0070] In one embodiment, when the label of the sample object is different from the initial label, the parameters of the agent are adjusted to obtain a trained agent, including: Starting from the terminal node with the initial label in the hierarchical label system, determine the intermediate nodes containing the initial label layer by layer; Determine the label of the node containing the initial label as the first label of the sample object; Determine the label of the node containing the label of the sample object as the second label of the sample object; After the first label and the second label of the i-1th level have been used to adjust the parameters of the agent, when the first label and the second label of the i-th level are different, obtaining a preset adjustment template, where i is greater than 1 and less than or equal to N, and N is the number of levels of the preset hierarchical label system; Using a preset adjustment template, construct input information including description information of the sample object and the first label of the i-th level, and input the input information into the intelligent agent to adjust the parameters of the intelligent agent to obtain a trained intelligent agent.
[0071] In one embodiment, the adjustment template includes a deductive template and an inductive template. Using the preset adjustment template, constructing input information including description information of the sample object and the first label of the i-th level includes: Constructing first input information including description information according to the object prompt words in the adjustment template; In the case where the adjustment template is a deductive template, constructing second input information for determining whether the sample object has an initial label according to the instruction prompt words in the adjustment template; When the adjustment template is an inductive template, second input information for selecting a label of a sample object from a plurality of labels including the initial label is constructed according to the instruction prompt words in the inductive template.
[0072] It should be noted that the embodiment of the device for label generation in this specification and the embodiment of the method for label generation in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding label generation method mentioned above, and the repeated parts will not be repeated.
[0073] Each module in the above-mentioned label generation device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the terminal device or the processor on the server side in the form of hardware, or can be stored in the memory in the terminal device or the memory on the server side in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0074] Further, corresponding to the label generation method described above, based on the same technical concept, one or more embodiments of this specification also provide an electronic device, which is used to execute the label generation method described above. Figure 8 A schematic diagram of the structure of an electronic device provided for one or more embodiments of this specification.
[0075] Based on the same idea, one or more embodiments of this specification also provide an electronic device, such as Figure 8As shown. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 801 and memory 802, and the memory 802 may store one or more storage applications or data. Among them, the memory 802 can be a temporary storage or a permanent storage. The application stored in the memory 802 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 801 can be configured to communicate with the memory 802 to execute a series of computer executable instructions in the memory 802 on the electronic device. The electronic device may also include one or more power supplies 803, one or more wired or wireless network interfaces 804, one or more input and output interfaces 805, and one or more keyboards 806.
[0076] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs configured to be executed by one or more processors include the following computer executable instructions: Receiving a tag generation instruction for a target object input by a user, the tag generation instruction including description information of the target object, the description information at least including an identifier of the object; Obtain a hierarchical label system that matches the target object. The hierarchical label system is a label system with a hierarchical structure constructed according to a preset label set. Labels in the label set are stored in at least one terminal node in the hierarchical label system. In the hierarchical label system, the labels stored in the node include the labels stored in each node of the next level connected to the node. The intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node. Based on a large language model, starting from the root node of the hierarchical label system, the intermediate nodes related to the target object are determined layer by layer according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system; In the hierarchical label system, the terminal node connected to the intermediate node related to the target object is determined as the target terminal node, and the label of the target object is determined from the label stored in the target terminal node.
[0077] It should be noted that the embodiment of the electronic device in this specification and the embodiment of the method for label generation in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding label generation method mentioned above, and the repeated parts will not be repeated.
[0078] Furthermore, corresponding to the label generation method described above, based on the same technical concept, one or more embodiments of this specification further provide a storage medium for storing computer executable instructions. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer executable instructions stored in the storage medium are executed by the processor, the following process can be implemented: Receiving a tag generation instruction for a target object input by a user, the tag generation instruction including description information of the target object, the description information at least including an identifier of the object; Obtain a hierarchical label system that matches the target object. The hierarchical label system is a label system with a hierarchical structure constructed according to a preset label set. Labels in the label set are stored in at least one terminal node in the hierarchical label system. In the hierarchical label system, the labels stored in the node include the labels stored in each node of the next level connected to the node. The intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node. Based on a large language model, starting from the root node of the hierarchical label system, the intermediate nodes related to the target object are determined layer by layer according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system; In the hierarchical label system, the terminal node connected to the intermediate node related to the target object is determined as the target terminal node, and the label of the target object is determined from the label stored in the target terminal node.
[0079] It should be noted that the embodiment of the storage medium in this specification and the method for label generation in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding label generation method mentioned above, and the repeated parts will not be repeated.
[0080] Furthermore, corresponding to the label generation method described above, based on the same technical concept, one or more embodiments of this specification further provide a computer program product, the computer program product includes a computer program, and when the computer program is executed by a processor, the following process can be implemented: Receiving a tag generation instruction for a target object input by a user, the tag generation instruction including description information of the target object, the description information at least including an identifier of the object; Obtain a hierarchical label system that matches the target object. The hierarchical label system is a label system with a hierarchical structure constructed according to a preset label set. Labels in the label set are stored in at least one terminal node in the hierarchical label system. In the hierarchical label system, the labels stored in the node include the labels stored in each node of the next level connected to the node. The intermediate node is provided with a generated label, and the label stored in the intermediate node is subordinate to the generated label of the intermediate node. Based on a large language model, starting from the root node of the hierarchical label system, the intermediate nodes related to the target object are determined layer by layer according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system; In the hierarchical label system, the terminal node connected to the intermediate node related to the target object is determined as the target terminal node, and the label of the target object is determined from the label stored in the target terminal node.
[0081] It should be noted that the embodiment of the computer program product in this specification and the embodiment of the label generation method in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding label generation method mentioned above, and the repeated parts will not be repeated.
[0082] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0083] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0084] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0085] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0086] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0087] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0088] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0089] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0090] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0091] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0092] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0093] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0094] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0095] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0096] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0097] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. A method for generating a label, comprising: receiving a tag generation instruction for a target object input by a user, wherein the tag generation instruction includes description information of the target object, and the description information includes at least an identifier of the object; Obtaining a hierarchical label system that matches the target object, wherein the hierarchical label system is a label system with a hierarchical structure constructed based on a preset label set, wherein labels in the label set are stored in at least one terminal node in the hierarchical label system, wherein the labels stored in a node include labels stored in each node in the next level connected to the node, and wherein intermediate nodes are provided with generated labels, and labels stored in the intermediate nodes are subordinate to the generated labels of the intermediate nodes; Based on a large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system, the intermediate nodes related to the target object are determined layer by layer; In the hierarchical label system, the terminal node connected to the intermediate node related to the target object is determined as the target terminal node, and the label of the target object is determined from the labels stored in the target terminal node.
2. The method according to claim 1, wherein determining the label of the target object from the label stored in the target termination node comprises: When the number of tags stored in the target termination node is greater than a first preset value, sorting the relevance between the tags stored in the target termination node and the description information of the target object based on a large language model; According to the sorting result, the label of the target object is determined from the labels stored in the target termination node.
3. The method according to claim 1, wherein the process of constructing the hierarchical label system comprises: Based on a large language model, intermediate nodes in the hierarchical labeling system and their generated labels are generated according to the types of labels obtained by multiple sampling of the label set, and the labels in the label set are stored in each intermediate node in the hierarchical labeling system according to the generated labels, so that the set of labels stored in the intermediate node is the same as the set of labels stored in each intermediate node in the next layer connected to the intermediate node; When the number of labels stored in the intermediate nodes of the hierarchical label system is less than a second preset value, a terminal node in the hierarchical label system corresponding one-to-one to the labels stored in the intermediate nodes is generated, and the labels stored in the intermediate nodes are stored in the terminal nodes corresponding to the labels.
4. The method according to claim 3, wherein the step of generating intermediate nodes and generated labels in the hierarchical labeling system based on the types of labels obtained by multiple sampling of the label set based on a large language model, and storing the labels in the label set at each intermediate node in the hierarchical labeling system based on the generated labels, comprises: Based on a large language model, generating intermediate nodes of a second level in the hierarchical labeling system and their generated labels according to the types of labels obtained by sampling the label set multiple times; According to the generated labels of the second level, the labels in the label set are stored in each intermediate node of the second level in the hierarchical label system; Generate an intermediate node at level i in the hierarchical label system and its generated label based on the types of labels obtained by multiple sampling of labels stored in the intermediate nodes at level i-1 in the hierarchical label system, where i is greater than 1; According to the generated labels of the i-th level, the labels stored in the intermediate nodes of the i-1-th level in the hierarchical label system are stored in each intermediate node of the i-th level connected to the intermediate nodes of the i-1-th level.
5. The method according to claim 3, wherein the hierarchical label system construction process further comprises: receiving newly added labels that are not stored in each terminating node of the hierarchical label system; Based on the large language model, starting from the root node of the hierarchical label system, determining the intermediate nodes corresponding to the newly added labels layer by layer, and storing the newly added labels in the intermediate nodes corresponding to the newly added labels; In the case that the intermediate node storing the newly added label is connected to the terminal node, a terminal node subordinate to the intermediate node storing the newly added label is generated, and the newly added label is stored in the newly generated terminal node.
6. The method according to claim 1, wherein the method is used for an intelligent agent, and the training process of the intelligent agent comprises: Obtaining a training data set and a preset hierarchical labeling system, wherein the training data set includes a plurality of sample objects with initial labels and description information; Based on the large language model, starting from the root node of the preset hierarchical label system, according to the description information of the sample object and the generated labels of each intermediate node in the preset hierarchical label system, determine the intermediate nodes related to the sample object layer by layer; In the preset hierarchical label system, determining the end node connected to the intermediate node related to the sample object as the sample end node, and determining the label of the sample object from the labels stored in the sample end node; When the label of the sample object is different from the initial label, the parameters of the agent are adjusted to obtain a trained agent.
7. The method according to claim 6, wherein when the label of the sample object is different from the initial label, adjusting the parameters of the agent to obtain a trained agent comprises: Starting from the terminal node with the initial label in the hierarchical label system, determining the intermediate nodes containing the initial label layer by layer; Determining the label of the node containing the initial label as the first label of the sample object; Determining the label of the node containing the label of the sample object as the second label of the sample object; After adjusting the parameters of the agent using the first label and the second label of the i-1th level, if the first label and the second label of the i-th level are different, obtaining a preset adjustment template, where i is greater than 1 and less than or equal to N, where N is the number of levels in the preset hierarchical label system; Using a preset adjustment template, construct input information including the description information of the sample object and the first label of the i-th level, and input the input information into the intelligent agent to adjust the parameters of the intelligent agent to obtain a trained intelligent agent.
8. The method according to claim 7, wherein the adjustment template includes a deductive template and an inductive template, and wherein using the preset adjustment template to construct input information including the descriptive information of the sample object and the first label of the i-th level comprises: constructing first input information including the description information according to the object prompt word in the adjustment template; In the case where the adjustment template is a deductive template, constructing second input information for determining whether the sample object has the initial label according to the instruction prompt words in the adjustment template; In the case where the adjustment template is a summary template, second input information for selecting a label of the sample object from a plurality of labels including the initial label is constructed according to the instruction prompt words in the summary template.
9. A device for generating a label, comprising: An instruction receiving module, configured to receive a tag generation instruction for a target object input by a user, wherein the tag generation instruction includes description information of the target object, and the description information includes at least an identifier of the object; A system acquisition module is used to acquire a hierarchical label system that matches the target object. The hierarchical label system is a label system with a hierarchical structure constructed based on a preset label set. Labels in the label set are stored in at least one terminal node in the hierarchical label system. In the hierarchical label system, the labels stored in the node include the labels stored in each node in the next level connected to the node. Intermediate nodes are provided with generated labels, and the labels stored in the intermediate nodes are subordinate to the generated labels of the intermediate nodes. a node determination module, configured to determine, based on a large language model and starting from the root node of the hierarchical labeling system, the intermediate nodes related to the target object layer by layer according to the description information of the target object and the generated labels of each intermediate node in the hierarchical labeling system; The label generation module is used to determine the terminal node connected to the intermediate node related to the target object as the target terminal node in the hierarchical label system, and determine the label of the target object from the labels stored in the target terminal node.
10. An electronic device comprising: processor, and a memory arranged to store computer-executable instructions which, when executed, cause the processor to: receiving a tag generation instruction for a target object input by a user, wherein the tag generation instruction includes description information of the target object, and the description information includes at least an identifier of the object; Obtaining a hierarchical label system that matches the target object, wherein the hierarchical label system is a label system with a hierarchical structure constructed based on a preset label set, wherein labels in the label set are stored in at least one terminal node in the hierarchical label system, wherein the labels stored in a node include labels stored in each node in the next level connected to the node, and wherein intermediate nodes are provided with generated labels, and labels stored in the intermediate nodes are subordinate to the generated labels of the intermediate nodes; Based on a large language model, starting from the root node of the hierarchical label system, according to the description information of the target object and the generated labels of each intermediate node in the hierarchical label system, the intermediate nodes related to the target object are determined layer by layer; In the hierarchical label system, the terminal node connected to the intermediate node related to the target object is determined as the target terminal node, and the label of the target object is determined from the labels stored in the target terminal node.
