Method and apparatus for training long-tail data representation model

By training a long-tail data representation model using a first-graph neural network and a second-graph neural network, the long-tail bias problem was solved, the representation ability of long-tail data was improved, and high-quality ranking of long-tail search terms was achieved.

CN116401453BActive Publication Date: 2025-11-21ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310355474.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-31
Publication Date
2025-11-21
Estimated Expiration
2043-03-31

AI Technical Summary

Technical Problem

The existing search scenarios suffer from a long-tail bias problem, where popular search terms account for the vast majority of exposure, while long-tail search terms cannot obtain sufficient training data, making it difficult for the model to output high-quality ranking results.

Method used

A long-tail data representation model is trained using a first-graph neural network and a second-graph neural network. By iteratively training the sample set, the matching of the tail historical query data nodes with the head historical query data nodes is determined. Knowledge transfer is used to compare the loss values ​​and adjust the model parameters to improve the representation ability of long-tail data.

Benefits of technology

It improves the representation ability of long-tail data, enhances search performance, and ensures high-quality ranking results for long-tail search terms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116401453B_ABST
    Figure CN116401453B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a method and device for training a long-tail data representation model. In the method for training a long-tail data representation model, the following model training process is cyclically executed: the head subgraph data and the tail subgraph data of the current training sample set are respectively provided to the first graph neural network and the second graph neural network of the current long-tail data representation model to obtain the feature representation corresponding to the head historical query data node and the tail historical query data node of the current training sample set; for each tail historical query data node, the matching head historical query data node of the tail historical query data node is determined in the current training sample set; according to the positive sample pair composed of the tail historical query data node and the corresponding matching head historical query data node, a knowledge transfer contrast loss value is determined; in response to not satisfying the training end condition, the parameters of the current long-tail data representation model are adjusted based on the knowledge transfer contrast loss value.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present specification generally relate to the technical field of computer technology, and in particular, to a method and apparatus for training a long-tail data representation model. BACKGROUND

[0002] With the rapid development of artificial intelligence technology, in fields such as service search, it is often necessary to calculate the similarity between the search word (query) and the representation corresponding to the to-be-matched item. In existing search scenarios, there is often a long-tail bias problem, that is, popular search words usually account for the vast majority of exposure, while long-tail search words cannot obtain sufficient training data. In this case, when a user inputs a long-tail search word, the model has difficulty in outputting a high-quality ranking result for the search word. Therefore, how to train the model to improve the representation ability of long-tail data has become a problem to be solved. SUMMARY

[0003] In view of the above, the embodiments of the present specification provide a method and apparatus for training a long-tail data representation model. By using the method and apparatus, effective representation of long-tail data can be achieved, thereby improving the corresponding search effect.

[0004] According to an aspect of an embodiment of the present specification, a method for training a long-tail data representation model is provided, wherein the long-tail data representation model includes a first graph neural network and a second graph neural network, and the method includes: cyclically executing a model training process on a training sample set until a training end condition is met, the training sample set including a head subgraph data composed of head historical query data nodes and corresponding historical associated data nodes and a tail subgraph data composed of tail historical query data nodes and corresponding historical associated data nodes: providing the head subgraph data and the tail subgraph data of the current training sample set to the first graph neural network and the second graph neural network of the current long-tail data representation model, respectively, to obtain feature representations corresponding to the head historical query data nodes and the tail historical query data nodes of the current training sample set, respectively; for each tail historical query data node, determining a matching head historical query data node of the tail historical query data node in the current training sample set; determining a knowledge transfer contrast loss value according to a positive sample pair composed of a tail historical query data node and a corresponding matching head historical query data node; in response to not meeting the training end condition, adjusting the model parameters of the current long-tail data representation model based on the knowledge transfer contrast loss value, wherein the long-tail data representation model after the model parameter adjustment serves as the current long-tail data representation model of the next model training process.

[0005] According to another aspect of the embodiments of the present disclosure, a method for representing query data is provided, comprising: receiving data to be queried; determining whether the data to be queried belongs to long-tail data; if yes, providing graph data matched with the data to be queried to a second graph neural network of a long-tail data representation model trained by the method as described above, to obtain a feature representation corresponding to the data to be queried; if no, providing graph data matched with the data to be queried to a first graph neural network of a long-tail data representation model trained by the method as described above, to obtain a feature representation corresponding to the data to be queried; wherein the graph data matched with the data to be queried comprises a node for indicating the data to be queried, and associated historical query data nodes and historical matched data nodes.

[0006] According to still another aspect of the embodiments of the present disclosure, a service search method is provided, comprising: receiving a user service search request; determining whether the user service search request belongs to long-tail search requests; if yes, providing graph data matched with the user service search request to a second graph neural network of a long-tail data representation model trained by the method as described above, to obtain a feature representation corresponding to the user service search request and each service to be matched; if no, providing graph data matched with the user service search request to a first graph neural network of a long-tail data representation model trained by the method as described above, to obtain a feature representation corresponding to the user service search request and each service to be matched; selecting a target number of services to be matched most similar to the user service search request from each service to be matched according to the obtained feature representation corresponding to the user service search request and each service to be matched; wherein the graph data matched with the user service search request comprises a node for indicating the user service search request, and associated historical user service search request nodes and service nodes to be matched.

[0007] According to yet another aspect of the embodiments of the present specification, there is provided an apparatus for training a long-tail data representation model, wherein the long-tail data representation model comprises a first graph neural network and a second graph neural network, the apparatus is configured to perform a model training process via a training unit cyclically using a training sample set until a training end condition is met, the training sample set comprises head subgraph data composed of head historical query data nodes and corresponding historical associated data nodes and tail subgraph data composed of tail historical query data nodes and corresponding historical associated data nodes, the training unit comprises: a node feature extraction module configured to provide the head subgraph data and the tail subgraph data of a current training sample set to the first graph neural network and the second graph neural network of a current long-tail data representation model respectively, to obtain feature representations corresponding to the head historical query data nodes and the tail historical query data nodes of the current training sample set respectively; a node matching module configured to determine, for each tail historical query data node, a matching head historical query data node of the tail historical query data node in the current training sample set; a first contrast loss value determination module configured to determine a knowledge transfer contrast loss value according to a positive sample pair composed of a tail historical query data node and a corresponding matching head historical query data node; and the apparatus further comprises: a parameter adjustment unit configured to, in response to the training end condition not being met, adjust model parameters of the current long-tail data representation model based on the knowledge transfer contrast loss value, wherein the long-tail data representation model after the model parameter adjustment serves as the current long-tail data representation model of a next model training process.

[0008] According to another aspect of the embodiments of the present specification, there is provided an apparatus for representing query data, comprising: a data receiving unit configured to receive to-be-queried data; a first feature representation unit configured to determine whether the to-be-queried data belongs to long-tail data; if yes, providing graph data matched with the to-be-queried data to a second graph neural network of a long-tail data representation model trained by the method as described above, to obtain a feature representation corresponding to the to-be-queried data; if not, providing graph data matched with the to-be-queried data to a first graph neural network of a long-tail data representation model trained by the method as described above, to obtain a feature representation corresponding to the to-be-queried data, wherein the graph data matched with the to-be-queried data comprises a node for indicating the to-be-queried data and associated historical query data nodes and historical matching data nodes.

[0009] According to a further aspect of the embodiments of the present disclosure, there is provided a service search apparatus, comprising: a service request receiving unit configured to receive a user service search request; a second feature representation unit configured to determine whether the user service search request belongs to a long tail search request; if yes, providing graph data matched with the user service search request to a second graph neural network of a long tail data representation model trained by the method as described above, to obtain feature representations corresponding to the user service search request and each service to be matched; if not, providing graph data matched with the user service search request to a first graph neural network of a long tail data representation model trained by the method as described above, to obtain feature representations corresponding to the user service search request and each service to be matched, wherein the graph data matched with the user service search request comprises a node for indicating the user service search request and associated historical user service search request nodes and service nodes to be matched; and a service selection unit configured to select a target number of services to be matched most similar to the user service search request from each service to be matched according to the obtained feature representations corresponding to the user service search request and each service to be matched.

[0010] According to a further aspect of the embodiments of the present disclosure, there is provided an apparatus for training a long tail data representation model, comprising: at least one processor, and a memory coupled to the at least one processor, the memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the method for training a long tail data representation model as described above.

[0011] According to a further aspect of the embodiments of the present disclosure, there is provided an apparatus for representing query data, comprising: at least one processor, and a memory coupled to the at least one processor, the memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the method for representing query data as described above.

[0012] According to a further aspect of the embodiments of the present disclosure, there is provided a service search apparatus, comprising: at least one processor, and a memory coupled to the at least one processor, the memory storing instructions that, when executed by the at least one processor, cause the at least one processor to perform the service search method as described above.

[0013] According to a further aspect of the embodiments of the present disclosure, there is provided a computer readable storage medium storing a computer program, which, when executed by a processor, implements the method for training a long tail data representation model, the method for representing query data and / or the service search method as described above.

[0014] According to another aspect of the embodiments of the present specification, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method for training a long-tail data representation model, the method for representing query data and / or the service search method as described above. BRIEF DESCRIPTION OF DRAWINGS

[0015] A further understanding of the nature and advantages of the present specification can be realized by reference to the following drawings. In the drawings, like reference numerals can designate similar components or features.

[0016] Figure 1 An exemplary architecture of the method for training a long-tail data representation model, the method for representing query data, the service search method and apparatus according to the embodiments of the present specification is shown.

[0017] Figure 2 A flowchart of one example of the method for training a long-tail data representation model according to the embodiments of the present specification is shown.

[0018] Figure 3 A schematic diagram of one example of the determination process of the feature representation corresponding to the head historical query data node and the tail historical query data node respectively according to the embodiments of the present specification is shown.

[0019] Figure 4 A flowchart of one example of the determination process of the matching head historical query data node according to the embodiments of the present specification is shown.

[0020] Figure 5 A flowchart of one example of the determination process of the knowledge transfer contrast loss value according to the embodiments of the present specification is shown.

[0021] Figure 6 A flowchart of yet another example of the method for training a long-tail data representation model according to the embodiments of the present specification is shown.

[0022] Figure 7 A flowchart of still another example of the method for training a long-tail data representation model according to the embodiments of the present specification is shown.

[0023] Figure 8 A schematic diagram of another example of the method for training a long-tail data representation model according to the embodiments of the present specification is shown.

[0024] Figure 9 A flowchart of one example of the method for representing query data according to the embodiments of the present specification is shown.

[0025] Figure 10A flowchart showing one example of a service search method according to an embodiment of the present specification is shown.

[0026] Figure 11 A flowchart showing one example of an application scenario of a service search method according to an embodiment of the present specification is shown.

[0027] Figure 12 A block diagram showing one example of an apparatus for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0028] Figure 13 A block diagram showing one example of a node matching module in an apparatus for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0029] Figure 14 A block diagram showing yet another example of an apparatus for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0030] Figure 15 A block diagram showing still another example of an apparatus for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0031] Figure 16 A block diagram showing another example of an apparatus for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0032] Figure 17 A block diagram showing one example of an apparatus for representing query data according to an embodiment of the present specification is shown.

[0033] Figure 18 A block diagram showing one example of a service search apparatus according to an embodiment of the present specification is shown.

[0034] Figure 19 A block diagram showing one example of an apparatus for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0035] Figure 20 A block diagram showing one example of an apparatus for representing query data according to an embodiment of the present specification is shown.

[0036] Figure 21 A block diagram showing one example of a service search apparatus according to an embodiment of the present specification is shown. DETAILED DESCRIPTION

[0037] The subject matter described herein will now be discussed with reference to example implementations. It should be understood that the implementations discussed are merely provided for illustration and persons of ordinary skill in the art are capable of implementing the subject matter described herein using the claims without departing from the scope of the present specification. Changes can be made in function and arrangement of elements discussed without departing from the scope of the present specification. Various examples can omit, substitute, or add various procedures or components as appropriate. Also, the description described some examples with reference to particular features or marcs of features. Such features and / or marcs can be combined with features of other examples.

[0038] As used herein, the term "includes" and its variants are meant to be interpreted broadly. The term "based on" means "based, at least in part, on." The terms "one embodiment" and "an embodiment" mean "at least one embodiment." The term "another embodiment" means "at least one additional embodiment." The terms "a first," "a second," etc. do not require, unless otherwise specified, that the first, second, etc. entities be different. The following detailed description is presented in terms of examples. It should be understood, however, that these examples are not limiting. Numerous specific details are described in order to provide a thorough understanding of the present description. Well known methods, procedures, components, and modules have not been described in detail since they would be understood by persons of ordinary skill in the art. References to examples, embodiments, components, etc. should not be construed as being singular or alternative but as being non-exclusive examples.

[0039] In the present specification, the term "long-tail data" can refer to samples that occupy a relatively small proportion of influence and are distributed with more instances, in relation to a few categories containing a large number of samples (which can be referred to as the head), in a skew distribution such as a long-tail distribution.

[0040] In the present specification, the term "feature representation" can refer to representing features in various ways, such as one-hot representation, embedding representation, etc.

[0041] In the present specification, the term "graph neural network (GNN)" can refer to a connection model that can acquire dependency relationships in a graph through information transmission between nodes in the network, and update the state of the node from neighbors of any depth of the node.

[0042] The method and apparatus for training a long-tail data representation model, the method for representing query data, the service search method and apparatus according to the embodiments of the present specification will be described in detail below with reference to the accompanying drawings.

[0043] Figure 1 An exemplary architecture 100 of the method and apparatus for training a long-tail data representation model, the method for representing query data, the service search method and apparatus according to the embodiments of the present specification is shown.

[0044] In Figure 1In some embodiments, the network 110 is applied to interconnect the terminal device 120 and the application server 130.

[0045] The network 110 can be any type of network capable of interconnecting network entities. The network 110 can be a single network or a combination of various networks. In terms of coverage, the network 110 can be a local area network (LAN), a wide area network (WAN), etc. In terms of bearing medium, the network 110 can be a wired network, a wireless network, etc. In terms of data exchange technology, the network 110 can be a circuit switching network, a packet switching network, etc.

[0046] The terminal device 120 can be any type of electronic computing device capable of connecting to the network 110, accessing servers or websites on the network 110, processing data or signals, etc. For example, the terminal device 120 can be a desktop computer, a notebook computer, a tablet computer, a smart phone, etc. Although only one terminal device is shown in the Figure 1 In some embodiments, there can be different numbers of terminal devices connected to the network 110.

[0047] In one embodiment, the terminal device 120 can be used by a user. The terminal device 120 can include an application client (e.g., the application client 121) that can provide various services for the user. In some cases, the application client 121 can interact with the application server 130. For example, the application client 121 can transmit a message input by the user to the application server 130, and receive a response associated with the message from the application server 130. However, it should be understood that in other cases, the application client 121 can also locally generate a response to the message input by the user without interacting with the application server 130. In this document, a "message" can refer to any input information, such as a search term 1211 from a user input, etc.

[0048] The application server 130 can be connected with a model training server 140. The model training server 140 can be configured to train a long tail data representation model. In one example, the model training server 140 can transmit the trained long tail data representation model to the application server 130. The application server 130 can be connected with a candidate information database 150. The candidate information database 150 can include a set of candidate texts or a set of candidate services (e.g., applets). In one example, the application server 130 can obtain a feature representation corresponding to a search term from the application client 121 using the trained long tail data representation model. Then, according to the similarity between the obtained feature representation and the feature representation corresponding to each item in the set of candidate texts or the set of candidate services (e.g., applets) in the candidate information database 150, the application server 130 can obtain a matching item corresponding to the search term.

[0049] It should be understood that,Figure 1 All network entities shown are exemplary, and any other network entities may be involved in Architecture 100 depending on the specific application requirements.

[0050] Figure 2 A flowchart of a method 200 for training a long-tail data representation model according to an embodiment of this specification is shown. In this embodiment, the long-tail data representation model may include a first graph neural network and a second graph neural network.

[0051] like Figure 2 As shown in 210, the following model training process is executed iteratively using the training sample set until the training termination condition is met.

[0052] In this embodiment, the training sample set may include header subgraph data and tail subgraph data. The header subgraph data may consist of header historical query data nodes and corresponding historical associated data nodes. The tail subgraph data may consist of tail historical query data nodes and corresponding historical associated data nodes. In one example, the training sample set can be obtained by processing historical data. In one example, historical data may include a user's historical query records and corresponding reference data records. The header historical query dataset can be partitioned from the historical query records in various ways (e.g., using Q...). hea (representation) and tail history query dataset (e.g., can be represented by Q) tail (This is represented as an example). In one example, a threshold for dividing the search terms into head and tail segments can be set based on the page views (PV) over a recent period (e.g., the last 30 days). For instance, the top 10,000 search terms belong to the head historical search data. Similarly, search terms with page views exceeding the set threshold belong to the head historical search data. Then, head subgraph data and tail subgraph data can be constructed separately based on the head historical search data and its corresponding reference data, as well as the tail historical search data and its corresponding reference data.

[0053] In one example, historical query records can include the search text used by the user. The corresponding reference data records can include various match data associated with the search text. For example, the search text can be a search term. The corresponding reference records can be news articles, product pages, services (such as mini-programs), etc., associated with the search term. In one example, the aforementioned "associated" could be clicks made by users who entered the search term within a recent period (e.g., the last 30 days), or items with the same or similar attributes as the search term. Then, for each historical search term, an edge can be constructed between the historical query data node representing that historical search term and the corresponding historical association data node representing the match data associated with that historical search term, thereby forming the aforementioned head subgraph data and tail subgraph data.

[0054] Optionally, the head historical query data node, the tail historical query data node and the corresponding historical association data node can each correspond to an attribute. In one example, in the field of service search, the attributes corresponding to the head historical query data node and the tail historical query data node can include, but are not limited to, at least one of the following: city, identifier, brand, intent (such as “rental”, “express delivery”, “life”, etc.). The attribute corresponding to the historical association data node can include, but is not limited to, at least one of the following: city, identifier, brand (such as a certain mobile phone brand, a certain drone brand, a certain camera brand, a certain express delivery company name, etc.), level, category (such as “digital”).

[0055] At 220, the head subgraph data and the tail subgraph data of the current training sample set are respectively provided to the first graph neural network and the second graph neural network of the current long-tail data representation model, to obtain the feature representation corresponding to the head historical query data node and the tail historical query data node of the current training sample set, respectively.

[0056] In the present embodiment, the head subgraph data of the current training sample set can be provided to the first graph neural network of the current long-tail data representation model, to obtain the feature representation corresponding to the head historical query data node of the current training sample set. Similarly, the tail subgraph data of the current training sample set can be provided to the second graph neural network of the current long-tail data representation model, to obtain the feature representation corresponding to the tail historical query data node of the current training sample set. In one example, the first graph neural network and the second graph neural network described above can include various neural networks for encoding graphs, which can utilize neural network structures to represent the vertices of a graph as low-dimensional vectors.

[0057] Optionally, reference will be made below to Figure 3 , Figure 3 A schematic diagram showing one example of a determination process 300 of the feature representation corresponding to the head historical query data node and the tail historical query data node, respectively, according to an embodiment of the present specification.

[0058] At 310, the head subgraph data of the current training sample set is provided to the first graph neural network of the current long-tail data representation model, to obtain the feature representation corresponding to the head historical query data node and the corresponding historical association data node of the current training sample set.

[0059] In the present embodiment, the first graph neural network of the current long-tail data representation model can be utilized to obtain the feature representation of the head historical query data node (which can be represented by h, for example) of the current training sample set. ​and the head historical query data node corresponds to a feature representation of the head historical query data node (which can be denoted as and the head historical query data node corresponds to a feature representation of the head historical query data node (which can be denoted as .

[0060] At 320, the tail subgraph data of the current training sample set is provided to the second graph neural network of the current long-tail data representation model, to obtain a feature representation of the tail historical query data node and the corresponding historical associated data node corresponding to the tail historical query data node corresponding to the feature representation of the tail historical query data node.

[0061] In this embodiment, the second graph neural network of the current long-tail data representation model can be used to obtain a feature representation of the tail historical query data node (which can be denoted as and the head historical query data node corresponds to a feature representation of the head historical query data node (which can be denoted as and the head historical query data node corresponds to a feature representation of the head historical query data node (which can be denoted as and the head historical query data node corresponds to a feature representation of the head historical query data node (which can be denoted as and the head historical query data node corresponds to a feature representation of the head historical query data node (which can be denoted as

[0062] Based on this, the present scheme can obtain the feature representation of the tail historical query data node and the corresponding historical associated data node corresponding to the tail historical query data node based on the first graph neural network and the second graph neural network of the current long-tail data representation model, respectively.

[0063] Returning to Figure 2 At 230, for each tail historical query data node, a matching head historical query data node of the tail historical query data node in the current training sample set is determined.

[0064] In this embodiment, the matching head historical query data node of each tail historical query data node in the current training sample set can be determined in various ways, thereby forming a tail historical query data node-matching head historical query data node pair.

[0065] Optionally, the matching head historical query data node can be determined according to at least one of the semantic relevance, the attribute matching degree corresponding to the node, and the historical hotness. In an example, the semantic relevance can be a similarity between a feature representation corresponding to the head historical query data node and a feature representation corresponding to the tail historical query data node. In an example, the attribute matching degree corresponding to the node can be determined according to whether the city, the brand, the category, and the like attributes corresponding to the head historical query data node and the tail historical query data node are consistent. In an example, the historical hotness can refer to an exposure amount of the head historical query data node.

[0066] In an example, the matching head historical query data node can be determined for each tail historical query data node according to at least one of the semantic relevance, the attribute matching degree corresponding to the node, and the historical hotness. In an example, for each tail historical query data node, scores of the above-mentioned items on each head historical query data node in the current training sample set can be determined, and a matching score of each head historical query data node can be determined by weighted summation. Thus, the head historical query data node with the highest matching score can be determined as the matching head historical query data node of the tail historical query data node.

[0067] Optionally, reference can be made to the following Figure 4 , Figure 4 A flowchart illustrating one example of a determination process 400 of a matching head historical query data node according to an embodiment of the present specification is shown. For each tail historical query data node, the matching head historical query data node of the tail historical query data node can be determined by the following steps:

[0068] At 410, a first number of initial candidate head historical query data nodes with the highest semantic relevance to the tail historical query data node are selected from the current training sample set.

[0069] In an example, the head historical query data nodes with the top 100 semantic relevance can be selected from the current training sample set as the initial candidate head historical query data nodes.

[0070] At 420, a second number of candidate head historical query data nodes matching the target attribute of the tail historical query data node are selected from the first number of initial candidate head historical query data nodes.

[0071] In an example, the above-mentioned target attribute can include at least one of the city, the brand, and the category. In an example, the head historical query data nodes with the same city, brand, and category as the tail historical query data node can be selected from the above-mentioned 100 initial candidate head historical query data nodes as the candidate head historical query data nodes (for example, 20).

[0072] At 430, the head historical query data node with the highest historical hotness is selected from the second number of candidate head historical query data nodes as a matching head historical query data node.

[0073] In this embodiment, the head historical query data node with the highest historical hotness among the second number (e.g., 20) of candidate head historical query data nodes can be selected as the matching head historical query data node. In one example, the historical hotness can be reflected by the exposure amount, for example.

[0074] Based on this, the present scheme can filter from the semantic relevance, the target attribute matching degree and the historical hotness to determine the matching head historical query data node of each tail historical query data node, thereby effectively improving the matching quality of the constructed sample pair and providing a basis for effective development of contrast learning.

[0075] Returning to Figure 2 At 240, a knowledge transfer contrast loss value is determined according to the positive sample pair composed of the tail historical query data node and the corresponding matching head historical query data node.

[0076] In this embodiment, the tail historical query data node and the corresponding matching head historical query data node can be composed into a positive sample pair. Then, various loss functions (e.g., hinge loss, InfoNCE loss, etc.) that can be used for contrast learning can be used to determine the knowledge transfer contrast loss value. The above knowledge transfer contrast loss value is usually negatively correlated with the similarity of the feature representation corresponding to the above positive sample pair. That is, minimizing the loss function corresponding to the loss value is equivalent to maximizing the similarity between the feature representations of the positive sample pair. The tail historical query data node and other head historical query data nodes in the current training sample set can also be composed into a negative sample pair. The above knowledge transfer contrast loss value is usually positively correlated with the similarity of the feature representation corresponding to the above negative sample pair. That is, minimizing the loss function corresponding to the loss value is equivalent to minimizing the similarity between the feature representations of the negative sample pair.

[0077] Optionally, reference is made to Figure 5 , Figure 5 A flowchart showing one example of a process 500 of determining a knowledge transfer contrast loss value according to an embodiment of the present specification is shown.

[0078] At 510, a first knowledge transfer contrast loss value is determined according to the positive sample pair composed of the tail historical query data node and the corresponding matching head historical query data node.

[0079] In this embodiment, the tail historical query data node and the corresponding matching head historical query data node can be combined to form a positive sample pair, and the tail historical query data node and other head historical query data nodes in the current training sample set can be combined to form a negative sample pair. Then, various loss functions that can be used for contrastive learning can be used to determine the first knowledge transfer contrastive loss value.

[0080] In one example, the first knowledge transfer contrastive loss value may be determined according to the following formula:

[0081]

[0082] wherein q tail may be used to represent the tail historical query data node. Q tail may be used to represent the set of tail historical query data nodes. and may be used to represent the feature representation of the tail historical query data node and the corresponding matching head historical query data node, respectively. may be used to represent the set of head historical query data nodes of the current training sample set (i.e., the current batch of training sample set). may be used to represent the feature representation of the matching head historical query data node in the other positive sample pair in the current training sample set other than the above-mentioned corresponding matching head historical query data node. τ may be used to represent the temperature coefficient, which is a hyperparameter.

[0083] At 520, a second knowledge transfer contrastive loss value is determined according to a positive sample pair formed by the feature representations of the head historical query data node and the tail historical query data node corresponding to the same historical association data node, respectively.

[0084] In this embodiment, the feature representations of the head historical query data node and the tail historical query data node corresponding to the same historical association data node can be combined to form a positive sample pair, and the feature representation of the historical association data node and the feature representations of other historical query data nodes in the current training sample set can be combined to form a negative sample pair. Then, various loss functions that can be used for contrastive learning can be used to determine the second knowledge transfer contrastive loss value.

[0085] In one example, the second knowledge transfer contrastive loss value may be determined according to the following formula:

[0086]

[0087] wherein s may be used to represent the historical association data node. S may be used to represent the set of historical association data nodes. and The feature representation can be used to represent that the same historical correlation data node corresponds to the head historical query data node and the tail historical query data node, respectively. The historical correlation data node set can be used to represent the current training sample set (i.e., the current batch of training sample set). And The feature representation can be used to represent that the same historical correlation data node corresponds to the head historical query data node and the tail historical query data node, respectively. τ can be used to represent the temperature coefficient, which belongs to the hyperparameter.

[0088] At 530, the knowledge transfer contrast loss value is determined according to the first knowledge transfer contrast loss value and the second knowledge transfer contrast loss value.

[0089] In this embodiment, the knowledge transfer contrast loss value can be determined in various ways. In one example, the sum of the first knowledge transfer contrast loss value (which can be represented as ) and the second knowledge transfer contrast loss value (which can be represented as ) can be determined as the knowledge transfer contrast loss value (which can be represented as In one example, the weighted sum of the first knowledge transfer contrast loss value and the second knowledge transfer contrast loss value can be determined as the knowledge transfer contrast loss value.

[0090] Based on this, the present scheme can combine the information of the head historical query data node to transfer the information of the tail historical query data node, and compare the feature representation of the same historical correlation data node corresponding to the head historical query data node and the tail historical query data node, thereby improving the feature representation quality of the long-tail data representation model.

[0091] Returning to Figure 2 , at 250, it is determined whether the training end condition is met.

[0092] In one example, it can be determined whether the training end condition is met by judging whether the number of iterations reaches a preset number, whether the training duration reaches a preset duration, whether the loss value converges, etc.

[0093] At 260, in response to the training end condition not being met, the model parameters of the current long-tail data representation model are adjusted based on the knowledge transfer contrast loss value.

[0094] In this embodiment, in response to the training end condition not being met, in one example, the gradient can be determined according to the determined knowledge transfer contrast loss value, and then combined with the learning rate to determine an adjustment value, so as to adjust the model parameters of the current long-tail data representation model. For example, the model parameters of the first graph neural network and the second graph neural network can be adjusted. The long-tail data representation model after the model parameter adjustment can serve as the current long-tail data representation model in the next model training process. Subsequently, the current training sample set can be re-determined using the training sample set described above, and the model training process 220-250 can be continued to be executed until the training end condition is met.

[0095] With reference to the foregoing description of the method 500 for training a long-tail data representation model, the method 500 can be implemented by a computer program product. The computer program product can include a computer readable storage medium having stored thereon computer readable program code. The computer readable program code can include instructions for causing a computer to perform the steps of the method 500. Figure 6 , Figure 6 A flowchart illustrating yet another example of a method 600 for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0096] At 610, the following model training process is executed in a loop using a training sample set until a training end condition is met.

[0097] At 620, the head subgraph data and the tail subgraph data of the current training sample set are provided to the first graph neural network and the second graph neural network of the current long-tail data representation model, respectively, to obtain feature representations corresponding to the head historical query data nodes and the tail historical query data nodes of the current training sample set, respectively.

[0098] In this embodiment, the first graph neural network and the second graph neural network described above are multi-layer graph neural networks. The first graph neural network and the second graph neural network can include a plurality of graph neural network layers. It can be understood that for each graph neural network layer located in the middle (not the first layer and the last layer), the output of the previous graph neural network layer can be taken as the input of the current graph neural network layer, and the output of the current graph neural network layer can be taken as the input of the next graph neural network layer.

[0099] At 630, for each tail historical query data node, a matching head historical query data node of the tail historical query data node is determined in the current training sample set.

[0100] At 640, a knowledge transfer contrast loss value is determined according to a positive sample pair composed of a tail historical query data node and a corresponding matching head historical query data node.

[0101] It should be noted that the steps 610-640 described above can be consistent with the corresponding steps described in the foregoing Figure 2 embodiments of steps 210-240 and Figure 3 , Figure 4 , Figure 5 embodiments described in the foregoing description, and will not be described here again.

[0102] At 650, for a target node in the current training sample set, a structure-enhanced contrastive loss value is determined according to a positive sample pair composed of a node initial representation of the target node corresponding to the multi-layer graph neural network and node feature representations output by other layers.

[0103] In the embodiment, the target node can include at least one of the following: a head historical query data node, a tail historical query data node, a head subgraph data historical association data node, and a tail subgraph data historical association data node. The positive sample pair composed of the node initial representation of the target node corresponding to the multi-layer graph neural network (e.g., the output result of the first graph neural network layer) and the node feature representations output by other layers can be determined. Then, various loss functions that can be used for contrastive learning (e.g., hinge loss, InfoNCE loss, etc.) can be used to determine the structure-enhanced contrastive loss value. The structure-enhanced contrastive loss value is generally negatively correlated with the similarity of the feature representations corresponding to the positive sample pair. That is, minimizing the loss function corresponding to the loss value is equivalent to maximizing the similarity between the feature representations of the positive sample pair. The target node corresponding to the node initial representation of the multi-layer graph neural network and the node feature representations output by other layers corresponding to the node initial representation of the multi-layer graph neural network can also be composed into a negative sample pair. Similarly, the target node corresponding to the node feature representations output by other layers of the multi-layer graph neural network and the node initial representation of the multi-layer graph neural network corresponding to the node initial representation of the multi-layer graph neural network can also be composed into a negative sample pair. The structure-enhanced contrastive loss value is generally positively correlated with the similarity of the feature representations corresponding to the negative sample pair. That is, minimizing the loss function corresponding to the loss value is equivalent to minimizing the similarity between the feature representations of the negative sample pair.

[0104] In one example, taking the head historical query data node and the tail historical query data node as examples of the above target node, the structure-enhanced contrastive loss value of the historical query data node The structure-enhanced contrastive loss value can be determined according to the following formula:

[0105]

[0106] Wherein, q can be used to represent the head historical query data node or the tail historical query data node. Q can be used to represent the set of head historical query data nodes and the set of tail historical query data nodes. And Can be used to represent the node initial representation of the target node q corresponding to the multi-layer graph neural network and the node feature representations output by other layers. Can be used to represent the set of head historical query data nodes and the set of tail historical query data nodes of the current training sample set (i.e., the current batch of training sample set). The node feature representation of the other layer output of the target node q can be used to represent the node feature representation of the other layer output of the multi-layer graph neural network for the head historical query data node or the tail historical query data node in the current training sample set other than the target node q. τ can be used to represent a temperature coefficient, which is a hyperparameter. L can be used to represent the number of layers of the first graph neural network or the second graph neural network, which can be determined according to the value of the target node q.

[0107] It can be understood that when the target node includes at least one of the historical association data node of the head subgraph data and the historical association data node of the tail subgraph data, the structural enhancement contrast loss value of the historical association data node The structural enhancement contrast loss value can be determined according to a formula similar to the above, which will not be described again here.

[0108] Therefore, the structural enhancement contrast loss value can be determined according to the structural enhancement contrast loss value of the historical query data node and the structural enhancement contrast loss value of the historical association data node For example, the sum or the weighted sum of the two can be determined as the structural enhancement contrast loss value.

[0109] Optionally, the node feature of the other layer output can include the node feature of the even layer output of the multi-layer graph neural network. That is, the value of l in the above formula is an even number. After analyzing the node features of the outputs of each layer of the multi-layer graph neural network, the inventors found that the feature representation of the even layer output of the multi-layer graph neural network is more representative, and thus the calculation method of the structural enhancement contrast loss value can be optimized in the above manner, thereby improving the calculation speed.

[0110] At 660, it is determined whether the training end condition is met.

[0111] At 670, in response to the training end condition not being met, the model parameters of the current long-tail data representation model are adjusted based on the total loss value obtained by the knowledge transfer contrast loss value and the structural enhancement contrast loss value.

[0112] In this embodiment, the total loss value can be obtained based on the knowledge transfer contrast loss value and the structural enhancement contrast loss value in various ways. In one example, the sum of the knowledge transfer contrast loss value and the structural enhancement contrast loss value can be determined as the total loss value. In one example, the total loss value The total loss value can be determined by . Wherein, and The meanings of and can be consistent with the foregoing description, and α can be used to represent a weight coefficient less than 1. The operation of adjusting the model parameters of the current long-tail data representation model based on the total loss value can refer to the foregoing Figure 6 ​The relevant description of step 260 in the embodiment will not be repeated here.

[0113] Based on this, the present scheme can construct a structure-enhanced contrast loss based on the node features output by different layers of the graph neural network, on the one hand, to supplement the explicit interaction relationship between the neighbor nodes in the head subgraph data and the tail subgraph data, thereby helping to improve the effect of the final feature representation; on the other hand, to encourage balanced information utilization in the graph, thereby helping to reduce uncontrollable noise in the aggregation process of the graph neural network.

[0114] With reference to the foregoing description of the method for training a long-tail data representation model, the method for training a long-tail data representation model according to the embodiments of the present specification can further include the following steps. Figure 7 Figure 8 A flowchart illustrating still another example of a method 700 for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0115] At 710, the following model training process is performed in a loop with the training sample set until a training end condition is met.

[0116] In the present embodiment, the above-mentioned training sample set can further include hierarchical intent data corresponding to the head subgraph data and the tail subgraph data. The above-mentioned hierarchical intent data can include graph data composed of intent nodes. In one example, for the head historical query data nodes, the tail historical query data nodes, and the respective corresponding historical associated data nodes in the head subgraph data and the tail subgraph data, each node can correspond to a respective hierarchical intent data. In one example, the hierarchical intent data can be a tree structure with multiple levels. For example, the first-level intent "second-hand / rental" can be divided into the second-level intents "rental intent", "second-hand transaction intent", and "sharing intent". The second-level intent "rental intent" can be further divided into the third-level intents "renting 3C digital", "renting clothing", and the like. The third-level intent "renting 3C digital" can be further divided into the more granular intents "renting mobile phone", "renting digital camera", and "renting tablet". For another example, the first-level intent "transportation" can be divided into the second-level intents "public transportation intent" and "ride-hailing intent". The second-level intent "public transportation intent" can be further divided into the third-level intents "purchasing a travel weekly card", "purchasing a travel monthly card", and "purchasing a travel single-ride card".

[0117] At 720, the head subgraph data and the tail subgraph data of the current training sample set are respectively provided to the first graph neural network and the second graph neural network of the current long-tail data representation model, to obtain the feature representations corresponding to the head historical query data nodes and the tail historical query data nodes of the current training sample set, respectively.

[0118] ​At 730, for each tail historical query data node, a matching head historical query data node of the tail historical query data node is determined in the current training sample set.

[0119] At 740, a knowledge transfer contrastive loss value is determined according to a positive sample pair composed of a tail historical query data node and a corresponding matching head historical query data node.

[0120] It should be noted that the above steps 710-740 can be consistent with the corresponding steps described in the foregoing Figure 8 embodiments of steps 210-240 and Figure 2 、 Figure 3 、 Figure 4 、 Figure 5 embodiments, and will not be described here.

[0121] At 750, for a target node in the current training sample set, a hierarchical intent contrastive loss value is determined according to a positive sample pair composed of a feature representation of the target node and a feature representation of a matching intent node corresponding to the target node.

[0122] In the present embodiment, the target node includes at least one of the following: a head historical query data node, a tail historical query data node, a historical associated data node of head subgraph data, and a historical associated data node of tail subgraph data. The matching intent node can include a sibling matching intent node and a parent node of the sibling matching intent node. The sibling matching intent node is an intent node in the hierarchical intent data that matches the target node. In one example, if the target node is a head historical query data node representing "renting a mobile phone", the matching intent node of the target node can include an intent node representing "renting a mobile phone" and a parent node of the intent node representing "renting a mobile phone" (e.g., an intent node representing "renting 3C digital products").

[0123] The positive sample pair composed of the feature representation of the target node and the feature representation of the matching intent node corresponding to the target node can be formed. Then, various loss functions that can be used for contrastive learning (such as hinge loss, InfoNCE loss, etc.) can be used to determine the hierarchical intent contrastive loss value. The hierarchical intent contrastive loss value is generally negatively correlated with the similarity of the feature representations corresponding to the positive sample pair. That is, minimizing the loss value of the loss function corresponds to maximizing the similarity between the feature representations of the positive sample pair.

[0124] Optionally, the hierarchical intent data can include graph data composed of multiple intent trees. For a target node in the current training sample set, a hierarchical intent contrast loss value is determined according to a positive sample pair composed of a feature representation of the target node and a feature representation of a matching intent node of the target node, and a negative sample pair composed of the feature representation of the target node and a feature representation of a sibling intent node of the sibling matching intent node of the target node belonging to a same intent tree as the sibling matching intent node of the target node. In an example, if the target node is a head historical query data node representing “rent a mobile phone”, the matching intent nodes of the target node can include an intent node representing “rent a mobile phone” and a parent node of the intent node representing “rent a mobile phone” (for example, an intent node representing “rent 3C digital products”); and the sibling intent nodes of the sibling matching intent node of the target node (for example, the intent node representing “rent a mobile phone”) belonging to a same intent tree as the sibling matching intent node of the target node can include, for example, an intent node representing “rent a digital camera” and an intent node representing “rent a tablet” both belonging to the “second-hand / rental” intent tree.

[0125] Optionally, the hierarchical intent data can include graph data composed of multiple intent trees. For a target node in the current training sample set, a hierarchical intent contrast loss value is determined according to a positive sample pair composed of a feature representation of the target node and a feature representation of a matching intent node of the target node, and a negative sample pair composed of the feature representation of the target node and a feature representation of a sibling intent node of the sibling matching intent node of the target node belonging to a different intent tree as the sibling matching intent node of the target node. In an example, if the target node is a head historical query data node representing “rent a mobile phone”, the matching intent nodes of the target node can include an intent node representing “rent a mobile phone” and a parent node of the intent node representing “rent a mobile phone” (for example, an intent node representing “rent 3C digital products”); and the sibling intent nodes of the sibling matching intent node of the target node (for example, the intent node representing “rent a mobile phone”) belonging to a different intent tree as the sibling matching intent node of the target node can include, for example, intent nodes representing “purchase a travel weekly card”, “purchase a travel monthly card”, and “purchase a travel one-time card” belonging to the “transportation” intent tree and being siblings of “rent a mobile phone”.

[0126] It can be understood that the hierarchical intent contrast loss value is generally positively correlated with the similarity of the feature representations corresponding to the negative sample pair. That is, minimizing the loss function corresponding to the loss value is equivalent to minimizing the similarity between the feature representations of the negative sample pair.

[0127] In an example, taking the head historical query data node and the tail historical query data node as examples, the hierarchical intent contrast loss value of the historical query data node is determined according to a positive sample pair composed of a feature representation of the historical query data node and a feature representation of a matching intent node of the historical query data node, and a negative sample pair composed of the feature representation of the historical query data node and a feature representation of a sibling intent node of the sibling matching intent node of the historical query data node belonging to a different intent tree as the sibling matching intent node of the historical query data node. The hierarchical intent contrast loss value can be determined according to the following formula:

[0128]

[0129] wherein q can be used to represent a head historical query data node or a tail historical query data node. Q can be used to represent a head historical query data node set and a tail historical query data node set. can be used to represent a matching intent node set of the target node q. can be used to represent a number of nodes in the matching intent node set of the target node q. i can be used to represent a sibling matching intent node of the target node q. and can be used to represent a feature representation of the target node q and a feature representation of the matching intent node of the target node q, respectively. can be used to represent an intent tree to which the matching intent node of the target node q belongs. can be used to represent at least one of: a sibling intent node set belonging to the same intent tree as the sibling matching intent node of the target node q (e.g., as a “hard sample”), a sibling intent node set belonging to different intent trees as the sibling matching intent node of the target node q (e.g., as a “easy sample”). can be used to represent a feature representation of the other intent node in the negative sample pair, other than the target node q. τ can be used to represent a temperature coefficient, which is a hyperparameter.

[0130] It can be understood that when the target node includes at least one of a head historical association data node of the head subgraph data and a tail historical association data node of the tail subgraph data, the hierarchical intent contrast loss value of the historical association data node can be determined according to a similar formula as described above, which will not be described again here.

[0131] Thus, the hierarchical intent contrast loss value and the hierarchical intent contrast loss value of the historical association data node can be determined according to the hierarchical intent contrast loss value of the historical query data node For example, the sum or weighted sum of the two can be determined as the hierarchical intent contrast loss value.

[0132] Optionally, the hierarchical intent data described above can include graph data composed of multiple intent trees. The feature representation of the matching intent node can be obtained by aggregating the feature representations of the child nodes of the matching intent node. In one example, a model structure similar to a graph neural network can be used to obtain the feature representation of the matching intent node. For example, the graph data composed of multiple intent trees can be provided to the model structure used to aggregate the feature representations, so that the feature representation of any intent node in the graph data can be obtained.

[0133] At 760, it is determined whether a training end condition is met.

[0134] At 770, in response to the training end condition not being met, a total loss value obtained based on the knowledge transfer contrast loss value and the hierarchical intent contrast loss value is used to adjust model parameters of the current long-tail data representation model.

[0135] In this embodiment, the total loss value can be obtained based on the knowledge transfer contrast loss value and the hierarchical intent contrast loss value in various ways. In one example, the sum of the knowledge transfer contrast loss value and the hierarchical intent contrast loss value is determined as the total loss value. In one example, the total loss value may be determined by In one example, the total loss value may also be determined by . Wherein α, and The meanings of and can be consistent with the foregoing description, and β can be used to represent a weight coefficient less than 1.

[0136] Based on this, the present scheme can construct a contrast loss function based on the hierarchical relationship between the intents matched with the nodes in the head subgraph data and the tail subgraph data, realize more sufficient mining of information, and thus help improve the effect of the final feature representation.

[0137] Next, reference is made to Figure 6 , Figure 7 FIG. 8 shows a schematic diagram of another example of a method 800 for training a long-tail data representation model according to an embodiment of the present specification.

[0138] At 810, the following model training process is performed in a loop using the training sample set until a training end condition is met.

[0139] At 820, the head subgraph data and the tail subgraph data of the current training sample set are respectively provided to the first graph neural network and the second graph neural network of the current long-tail data representation model, to obtain feature representations corresponding to the head historical query data nodes and the tail historical query data nodes of the current training sample set, respectively.

[0140] At 830, for each tail historical query data node, a matching head historical query data node of the tail historical query data node is determined in the current training sample set.

[0141] At 840, a knowledge transfer contrast loss value is determined according to a positive sample pair composed of a tail historical query data node and a corresponding matching head historical query data node.

[0142] At 850, it is determined whether a training end condition is met.

[0143] At 860, in response to the training end condition not being met, the model parameter of the current long tail data representation model is adjusted based on the knowledge transfer contrast loss value.

[0144] It should be noted that the above steps 810-860 can be consistent with the corresponding steps described in the foregoing Figures 1-8 steps 210-260 and Figure 9 , Figure 9 , Figure 9 , Figures 2-8 , Figures 2-8 embodiments, and will not be described here.

[0145] At 870, in response to the training end condition being met, the current long tail data representation model is determined as the pre-trained long tail data representation model.

[0146] At 880, the search model is fine-tuned using a label sample set matching the training sample set.

[0147] In the embodiment, the above-mentioned label sample set can include historical query data as features and historical matching data corresponding to the historical query data as labels. The above-mentioned training sample set can include nodes for representing the above-mentioned historical query data and corresponding historical matching data. The above-mentioned search model can include the above-mentioned pre-trained long tail data representation model and a classification model (for example, it can be a fully connected layer + Softmax). The search model containing the above-mentioned pre-trained long tail data representation model can be supervised trained using the above-mentioned label sample set, to obtain a long tail data representation model after secondary training. Thus, the contrast learning stage can be used as pre-training, and the model obtained through contrast learning can be fine-tuned through supervised training, to further optimize the representation ability of the features generated by the model.

[0148] Using the method for training a long tail data representation model disclosed in Figure 10 , by dividing the head subgraph data and the tail subgraph data and inputting them into two independent graph neural networks (i.e., the first graph neural network and the second graph neural network) for feature representation, the feature representation training process of the head query data and the tail query data can be decoupled, so that the tail query data is not affected by the head query data during the training process. Moreover, by constructing a contrast learning loss function for node representation, the transfer of information from the head query data to the tail query data is realized, which helps to improve the quality of feature representation of the tail query data.

[0149] Further reference is made to Figure 10 , Figure 10 a flowchart illustrating one example of a method 900 for representing query data according to an embodiment of the present specification.

[0150] As shown in FIG. 9, at 910, the data to be queried is received. Figure 11

[0151] In this embodiment, the data to be queried can be received in various ways. In one example, the data to be queried can be a search word input by a user. In one example, the data to be queried can be a search term selected by a user.

[0152] At 920, it is determined whether the data to be queried belongs to long tail data.

[0153] In this embodiment, whether the data to be queried belongs to long tail data can be determined in various ways. In one example, a commonly used query database can be constructed by counting historical query data. If the data to be queried hits a query word in the commonly used query database, it can be determined that the data to be queried does not belong to long tail data; otherwise, it can be determined that the data to be queried belongs to long tail data. In one example, the number of times the data to be queried is searched in the past period of time (for example, within 30 days) can also be determined. If the number of times exceeds a preset threshold, it can be determined that the data to be queried does not belong to long tail data; otherwise, it can be determined that the data to be queried belongs to long tail data.

[0154] At 930, if it belongs to, the graph data matched with the data to be queried is provided to the second graph neural network of the long tail data representation model trained according to the method described in the foregoing embodiments, to obtain the feature representation corresponding to the data to be queried.

[0155] In this embodiment, if the data to be queried belongs to long tail data, the second graph neural network of the long tail data representation model trained according to the method described in the foregoing embodiments can be used to obtain the feature representation of the data to be queried. Figure 11

[0156] At 940, if it does not belong to, the graph data matched with the data to be queried is provided to the first graph neural network of the long tail data representation model trained according to the method described in the foregoing embodiments, to obtain the feature representation corresponding to the data to be queried.

[0157] In this embodiment, if the data to be queried does not belong to long tail data, the first graph neural network of the long tail data representation model trained according to the method described in the foregoing embodiments can be used to obtain the feature representation of the data to be queried. Figure 11

[0158] In this embodiment, the graph data matched with the data to be queried can include a node for indicating the data to be queried and associated historical query data nodes and historical matching data nodes. In one example, the graph data matched with the data to be queried can be obtained by collecting historical query data and corresponding historical matching data. The historical query data can include the data to be queried. ​​​

[0159] Based on the above, a feature representation method that can be applied to the data to be queried is provided to provide features with better representation effects, thereby providing a technical basis for efficient data query and matching.

[0160] Further reference is made to Figures 1-8 , Figure 11 A flowchart showing one example of a service search method 1000 according to an embodiment of the present specification is shown.

[0161] As Figure 12 shown, at 1010, a user service search request is received.

[0162] In this embodiment, the user service search request can be received in various ways. In one example, the user service search request can be "rent a mobile phone". In one example, the user service search request can be "check electricity bill".

[0163] At 1020, it is determined whether the user service search request belongs to a long-tail search request.

[0164] In this embodiment, whether the user service search request belongs to a long-tail search request can be determined in a similar manner as step 920 in the foregoing embodiment.

[0165] At 1030, if it does, the graph data matching the user service search request is provided to the second graph neural network of the long-tail data representation model trained by the method described above, to obtain feature representations corresponding to the user service search request and each service to be matched.

[0166] At 1040, if it does not, the graph data matching the user service search request is provided to the first graph neural network of the long-tail data representation model trained by the method described above, to obtain feature representations corresponding to the user service search request and each service to be matched.

[0167] In this embodiment, the graph data matching the user service search request can include nodes indicating the user service search request and associated historical user service search request nodes and service nodes to be matched. In one example, the graph data matching the user service search request can include nodes indicating "rent a mobile phone" and "check electricity bill" and associated historical user service search request nodes (e.g., nodes indicating "rent a camera", "rent an iPhone", "check water bill", "life payment") and service nodes to be matched (e.g., nodes indicating "xx rent" applet, nodes indicating "electricity bill query" page, nodes indicating "convenient life" applet).

[0168] It should be noted that specific operations of steps 1030 and 1040 described above can refer to the related descriptions of steps 930 and 940 in the foregoing embodiments, which will not be described here.

[0169] At 1050, according to the obtained user service search request and the feature representation corresponding to each to-be-matched service, a target number of to-be-matched services most similar to the user service search request are selected from each to-be-matched service.

[0170] In this embodiment, according to the similarity between the feature representation corresponding to the obtained user service search request and the feature representation corresponding to each to-be-matched service, the top N (for example, 10, 30) to-be-matched services in terms of similarity can be selected and provided to the user.

[0171] Continuing to refer to Figure 12 , Figures 2-8 A schematic diagram showing an example of one application scenario 1100 of the service search method according to an embodiment of the present specification is shown.

[0172] As shown in Figure 12 , a user can send a service search request to a server through a client 1110. Moreover, the service search requests sent by each client can be recorded in a database 1130. Through node feature extraction and relationship extraction between nodes on the original data records in the database 1130, node features and relationship data are obtained and stored in a database 1131 and a database 1132, respectively. Then, the graph data 1140 composed of the head subgraph data 1141 and the tail subgraph data 1142 can be constructed according to the data in the database 1131 and the database 1132. Then, the head subgraph data 1141 and the tail subgraph data 1142 can be provided to the first graph neural network and the second graph neural network of the current long-tail data representation model 1150, respectively, to obtain the feature representations 1161 and 1162 corresponding to the head historical query data nodes and the tail historical query data nodes, respectively. According to the positive sample pairs composed of the tail historical query data nodes and the corresponding matched head historical query data nodes (such as the node pairs connected by the dashed arrows shown in 1140 in the figure), the knowledge transfer contrast loss value 1170 is determined. The method described in the foregoing Figure 2 embodiments can be used to adjust the model parameters of the current long-tail data representation model 1150. Next, the trained long-tail data representation model can be deployed to an inference platform 1180.

[0173] In the service search field, after the server 1120 receives the service search request from the client 1110, the following processing process can be performed: according to whether the service search request belongs to long tail data, using the second graph neural network or the first graph neural network in the long tail data representation model deployed in the inference platform 1180 to obtain the feature representation 1181 of the to-be-matched service and the feature representation 1182 of the service search request; and then according to the similarity between the feature representation 1181 of the to-be-matched service and the feature representation 1182 of the service search request, the to-be-matched services are sorted from high to low (such as shown in the middle 1190), and the top several to-be-matched services are selected as the sorting result and fed back to the client 1110. Figure 3

[0174] Based on the above, a method that can apply the feature representation method to service search is provided to perform service search by using the feature representation provided by the trained long tail data representation model, thereby improving the service search effect.

[0175] Further reference is made to Figure 2 , Figure 13 FIG. 13 shows a block diagram of one example of an apparatus 1200 for training a long tail data representation model according to an embodiment of the present specification. The apparatus embodiment can correspond to the method embodiment shown in FIG. 12, and the apparatus can be specifically applied to various electronic devices. Figure 13

[0176] As shown in FIG. 13, the apparatus 1200 for training a long tail data representation model can include a training unit 1210 and a parameter adjustment unit 1220. The long tail data representation model includes a first graph neural network and a second graph neural network. The training unit 1210 can be configured to perform a model training process using a training sample set in a loop until a training end condition is met. The training sample set includes head subgraph data composed of head historical query data nodes and corresponding historical association data nodes, and tail subgraph data composed of tail historical query data nodes and corresponding historical association data nodes. The training unit 1210 can include a node feature extraction module 1211, a node matching module 1212, and a first contrastive loss value determination module 1213. Figure 4 The node feature extraction module 1211 is configured to provide the head subgraph data and the tail subgraph data of the current training sample set to the first graph neural network and the second graph neural network of the current long tail data representation model, respectively, to obtain the feature representation corresponding to the head historical query data nodes and the tail historical query data nodes of the current training sample set, respectively. The operation of the node feature extraction module 1211 can refer to the operation of 220 described above.

[0177] Figure 4

[0178] ​​​​In one example, the node feature extraction module 1211 is further configured to: provide the head subgraph data of the current training sample set to a first graph neural network of the current long-tail data representation model to obtain feature representations of the head historical query data nodes and the corresponding historical associated data nodes in the current training sample set corresponding to the head historical query data nodes; and provide the tail subgraph data of the current training sample set to a second graph neural network of the current long-tail data representation model to obtain feature representations of the tail historical query data nodes and the corresponding historical associated data nodes in the current training sample set corresponding to the tail historical query data nodes. The operations of the node feature extraction module 1211 can refer to the operations of the node feature extraction module 110 described above in connection with 210. Figure 4 The operations of 310-320 are described in the embodiments.

[0179] The node matching module 1212 is configured to, for each tail historical query data node, determine a matching head historical query data node of the tail historical query data node in the current training sample set. The operations of the node matching module 1212 can refer to the operations of the node matching module 120 described above in connection with 230. Figure 12

[0180] In one example, the matching head historical query data node is determined according to at least one of: semantic relevance, attribute matching degree of the nodes, historical hotness.

[0181] Optionally, continuing to refer to Figure 2 , Figure 5 FIG. 13 shows a block diagram of one example of a node matching module 1300 in an apparatus for training a long-tail data representation model according to an embodiment of the present specification.

[0182] The node matching module 1300 can include a semantic preliminary selection submodule 1310, an attribute candidate submodule 1320, and a hotness selection module 1330.

[0183] The semantic preliminary selection submodule 1310 is configured to, for each tail historical query data node, select a first number of initial candidate head historical query data nodes with the highest semantic relevance to the tail historical query data node from the current training sample set. The operations of the semantic preliminary selection submodule 1310 can refer to the operations of the semantic preliminary selection submodule 110 described above in connection with 410. Figure 2

[0184] The attribute candidate submodule 1320 is configured to select a second number of candidate head historical query data nodes matching the target attribute of the tail historical query data node from the first number of initial candidate head historical query data nodes. The operations of the attribute candidate submodule 1320 can refer to the operations of the attribute candidate submodule 120 described above in connection with 420. Figure 14

[0185] ​​​The hotness selection module 1330 is configured to select the head historical query data node with the highest historical hotness from the second number of candidate head historical query data nodes as the matched head historical query data node. The operation of the hotness selection module 1330 can refer to the operation of 430 described above. Figure 14 The operation of 430 described above.

[0186] Returning to Figure 12 , the first comparison loss value determination module 1213 is configured to determine the knowledge transfer comparison loss value according to the positive sample pair composed of the tail historical query data node and the corresponding matched head historical query data node. The operation of the first comparison loss value determination module 1213 can refer to the operation of 240 described above. Figure 6 The operation of 240 described above.

[0187] In one example, the first comparison loss value determination module 1213 is further configured to: determine a first knowledge transfer comparison loss value according to the positive sample pair composed of the tail historical query data node and the corresponding matched head historical query data node; determine a second knowledge transfer comparison loss value according to the positive sample pair composed of the feature representations respectively corresponding to the head historical query data node and the tail historical query data node of the same historical association data node; and determine the knowledge transfer comparison loss value according to the first knowledge transfer comparison loss value and the second knowledge transfer comparison loss value. The operation of the first comparison loss value determination module 1213 can refer to the operation of 510-530 described above. Figure 6 The operation of 510-530 described above.

[0188] The parameter adjustment unit 1220 is configured to, in response to the training end condition not being met, adjust the model parameters of the current long-tail data representation model based on the knowledge transfer comparison loss value. Wherein, the long-tail data representation model after the model parameter adjustment serves as the current long-tail data representation model of the next model training process. The operation of the parameter adjustment unit 1220 can refer to the operation of 260 described above. Figure 15 The operation of 260 described above.

[0189] Figure 15 A block diagram illustrating yet another example of an apparatus 1400 for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0190] As Figure 12As shown, the apparatus 1400 for training the long-tail data representation model can include a training unit 1410 and a parameter adjustment unit 1420. The long-tail data representation model includes a first graph neural network and a second graph neural network. The first graph neural network and the second graph neural network are multi-layer graph neural networks. The training unit 1410 can be configured to perform a model training process in cycles using a training sample set until a training end condition is met. The training sample set includes head subgraph data composed of head historical query data nodes and corresponding historical associated data nodes and tail subgraph data composed of tail historical query data nodes and corresponding historical associated data nodes. The training unit 1410 can include a node feature extraction module 1411, a node matching module 1412, a first contrastive loss value determination module 1413, and a second contrastive loss value determination module 1414.

[0191] The specific descriptions of the node feature extraction module 1411, the node matching module 1412, and the first contrastive loss value determination module 1413 described above can be referred to the foregoing Figure 7 The related descriptions of the node feature extraction module 1211, the node matching module 1212, and the first contrastive loss value determination module 1213 in the embodiments are not repeated here.

[0192] The second contrastive loss value determination module 1414 is configured to determine a structure-enhanced contrastive loss value for a target node in the current training sample set according to a positive sample pair composed of a node initial representation of the target node corresponding to the multi-layer graph neural network and node feature representations output by other layers. The target node includes at least one of the following: a head historical query data node, a tail historical query data node, a historical associated data node of the head subgraph data, and a historical associated data node of the tail subgraph data. The operation of the second contrastive loss value determination module 1414 can be referred to the operation of 650 described above. Figure 7

[0193] In one example, the node features output by the other layers include node features output by even layers of the multi-layer graph neural network.

[0194] The parameter adjustment unit 1420 is configured to, in response to the training end condition not being met, adjust model parameters of the current long-tail data representation model based on a total loss value obtained by the knowledge transfer contrastive loss value and the structure-enhanced contrastive loss value. The operation of the parameter adjustment unit 1420 can be referred to the operation of 670 described above. Figure 7

[0195] Figure 16 A block diagram illustrating still another example of an apparatus 1500 for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0196] As​​Figure 16 As shown, the apparatus 1500 for training the long-tail data representation model can include a training unit 1510 and a parameter adjustment unit 1520. The long-tail data representation model includes a first graph neural network and a second graph neural network. The training unit 1510 can be configured to perform a model training process cyclically using a training sample set until a training end condition is met. The training sample set includes head subgraph data composed of head historical query data nodes and corresponding historical associated data nodes, and tail subgraph data composed of tail historical query data nodes and corresponding historical associated data nodes. The training sample set also includes hierarchical intent data corresponding to the head subgraph data and the tail subgraph data. The hierarchical intent data includes graph data composed of intent nodes. The training unit 1510 can include a node feature extraction module 1511, a node matching module 1512, a first contrastive loss value determination module 1513, and a third contrastive loss value determination module 1514.

[0197] The specific descriptions of the above-mentioned node feature extraction module 1511, node matching module 1512, and first contrastive loss value determination module 1513 can be referred to the foregoing Figure 12 The specific descriptions of the node feature extraction module 1211, node matching module 1212, and first contrastive loss value determination module 1213 in the embodiments can be referred to the foregoing

[0198] The third contrastive loss value determination module 1514 is configured to determine a hierarchical intent contrastive loss value for a target node in the current training sample set according to a positive sample pair composed of a feature representation of the target node and a feature representation of a matching intent node of the target node. The target node includes at least one of the following: a head historical query data node, a tail historical query data node, a historical associated data node of the head subgraph data, and a historical associated data node of the tail subgraph data. The matching intent node includes a sibling matching intent node and a parent node of the sibling matching intent node. The sibling matching intent node is an intent node in the hierarchical intent data that matches the target node.

[0199] In one example, the hierarchical intent data includes graph data composed of multiple intent trees. The third contrastive loss value determination module 1514 is further configured to determine a hierarchical intent contrastive loss value for a target node in the current training sample set according to a positive sample pair composed of a feature representation of the target node and a feature representation of a matching intent node of the target node, and a negative sample pair composed of the feature representation of the target node and a feature representation of another sibling intent node that belongs to the same intent tree as the sibling matching intent node of the target node. The operation of the third contrastive loss value determination module 1514 can be referred to the foregoing Figure 8The operations described in the optional implementation of 750.

[0200] In one example, the hierarchical intent data comprises graph data composed of multiple intent trees. The third contrastive loss value determination module 1514 is further configured to determine, for a target node in the current training sample set, a hierarchical intent contrastive loss value according to a positive sample pair composed of a feature representation of the target node and a feature representation of a matching intent node corresponding to the target node, and a negative sample pair composed of the feature representation of the target node and a feature representation of a sibling intent node belonging to a different intent tree from the matching intent node of the same level as the target node. The operations of the third contrastive loss value determination module 1514 can be referred to the foregoing Figure 8 The operations described in the optional implementation of 750.

[0201] In one example, the hierarchical intent data comprises graph data composed of multiple intent trees, and the feature representation of the matching intent node is obtained by aggregating feature representations of child nodes of the matching intent node.

[0202] The parameter adjustment unit 1520 is configured to, in response to the training end condition not being met, adjust model parameters of the current long-tail data representation model based on a total loss value obtained by the knowledge transfer contrastive loss value and the hierarchical intent contrastive loss value. The operations of the parameter adjustment unit 1520 can be referred to the foregoing Figure 17 The operations of 770.

[0203] Figure 17 A block diagram illustrating another example of an apparatus 1600 for training a long-tail data representation model according to an embodiment of the present specification is shown.

[0204] As Figure 9 The apparatus 1600 for training a long-tail data representation model can include a training unit 1610, a parameter adjustment unit 1620, and a fine-tuning unit 1630, as shown. The long-tail data representation model includes a first graph neural network and a second graph neural network. The training unit 1610 can be configured to perform a model training process in cycles using a training sample set until a training end condition is met. The training sample set includes head subgraph data composed of head historical query data nodes and corresponding historical associated data nodes, and tail subgraph data composed of tail historical query data nodes and corresponding historical associated data nodes. The training unit 1610 can include a node feature extraction module 1611, a node matching module 1612, a first contrastive loss value determination module 1613.

[0205] The specific descriptions of the node feature extraction module 1611, the node matching module 1612, the first contrastive loss value determination module 1613, and the parameter adjustment unit 1620 described above can be referred to the foregoingFigure 17 The related descriptions of the node feature extraction module 1211, the node matching module 1212, the first contrast loss value determination module 1213 and the parameter adjustment unit 1220 in the embodiment are not repeated here.

[0206] The parameter adjustment unit 1620 is further configured to determine the current long tail data representation model as the pre-trained long tail data representation model in response to the training end condition being satisfied. The operation of the parameter adjustment unit 1620 can be referred to the operation of 860, 870 described above. Figure 9

[0207] The fine-tuning unit 1630 is configured to fine-tune the search model by using a label sample set matched with the training sample set. The label sample set includes historical query data as features and historical matching data corresponding to the historical query data as labels. The training sample set includes nodes for representing the historical query data and the corresponding historical matching data. The search model includes the pre-trained long tail data representation model and a classification model. The operation of the fine-tuning unit 1630 can be referred to the operation of 880 described above. Figure 9

[0208] With reference back to Figure 18 , Figure 18 A block diagram illustrating one example of an apparatus 1700 for representing query data according to embodiments of the present specification is shown. The apparatus embodiments can correspond to the method embodiments shown, and the apparatus can be specifically applied to various electronic devices. Figure 10

[0209] As shown in Figure 18 , the apparatus 1200 for representing query data can include a data receiving unit 1710 and a first feature representation unit 1720.

[0210] The data receiving unit 1710 is configured to receive to-be-queried data. The operation of the data receiving unit 1710 can be referred to the operation of 910 described above. Figure 10

[0211] ​​​​The first feature representation unit 1720 is configured to determine whether the to-be-queried data belongs to long-tail data; if yes, providing the graph data matched with the to-be-queried data to the second graph neural network of the long-tail data representation model trained by the method described above, to obtain the feature representation corresponding to the to-be-queried data; if not, providing the graph data matched with the to-be-queried data to the first graph neural network of the long-tail data representation model trained by the method described above, to obtain the feature representation corresponding to the to-be-queried data. The graph data matched with the to-be-queried data contains the node for indicating the to-be-queried data and the associated historical query data node and historical matched data node. The operation of the first feature representation unit 1720 can refer to the operation of 920-940 described above. Figure 10 The operation of 920-940 described above.

[0212] With reference to the method embodiment shown in Figure 10 , Figures 1 to 18 A block diagram illustrating one example of a service search apparatus 1800 according to an embodiment of the present specification is shown. The apparatus embodiment can correspond to the method embodiment shown in Figure 19 , and the apparatus can be specifically applied to various electronic devices.

[0213] As shown in Figure 19 , the service search apparatus 1800 can include a service request receiving unit 1810, a second feature representation unit 1820, and a service selection unit 1830.

[0214] The service request receiving unit 1810 is configured to receive a user service search request. The operation of the service request receiving unit 1810 can refer to the operation of 1010 described above. Figure 19

[0215] The second feature representation unit 1820 is configured to determine whether the user service search request belongs to a long-tail search request; if yes, providing the graph data matched with the user service search request to the second graph neural network of the long-tail data representation model trained by the method described above, to obtain the feature representation corresponding to the user service search request and each to-be-matched service; if not, providing the graph data matched with the user service search request to the first graph neural network of the long-tail data representation model trained by the method described above, to obtain the feature representation corresponding to the user service search request and each to-be-matched service. The graph data matched with the user service search request contains the node for indicating the user service search request and the associated historical user service search request node and to-be-matched service node. The operation of the second feature representation unit 1820 can refer to the operation of 1020-1040 described above. Figures 1-8

[0216] ​​The service selection unit 1830 is configured to select a target number of services most similar to the user service search request from among the services to be matched, based on the obtained user service search request and the feature representations corresponding to each service to be matched. The operation of the service selection unit 1830 can be referred to above. Figure 20 The operation of 1050 is described.

[0217] Reference above Figure 20 This specification describes embodiments of methods and apparatus for training long-tail data representation models, methods and apparatus for representing query data, and service search methods and apparatus.

[0218] The apparatus for training a long-tail data representation model, the apparatus for representing query data, and the service search apparatus in the embodiments of this specification can be implemented in hardware, software, or a combination of hardware and software. Taking software implementation as an example, as a logical device, it is formed by the processor of its host device reading the corresponding computer program instructions from the memory into memory and executing them. In the embodiments of this specification, the apparatus for training a long-tail data representation model, the apparatus for representing query data, and the service search apparatus can, for example, be implemented using electronic devices.

[0219] Continue to refer to Figure 20 , Figure 9 A schematic diagram of an apparatus 1900 for training a long-tail data representation model according to an embodiment of this specification is shown.

[0220] like Figure 21 As shown, the apparatus 1900 for training a long-tail data representation model may include at least one processor 1910, a memory (e.g., non-volatile memory) 1920, a main memory 1930, and a communication interface 1940, and the at least one processor 1910, memory 1920, main memory 1930, and communication interface 1940 are connected together via a bus 1950. At least one processor 1910 executes at least one computer-readable instruction (i.e., the elements implemented in software described above) stored or encoded in the memory.

[0221] In an embodiment, computer-executable instructions stored in the memory, which when executed, cause the at least one processor 1910 to: perform a model training process described below cyclically with a training sample set including head subgraph data consisting of head historical query data nodes and corresponding historical association data nodes and tail subgraph data consisting of tail historical query data nodes and corresponding historical association data nodes until a training end condition is met: provide the head subgraph data and the tail subgraph data of a current training sample set to a first graph neural network and a second graph neural network of a current long-tail data representation model respectively to obtain feature representations corresponding to the head historical query data nodes and the tail historical query data nodes of the current training sample set respectively; for each tail historical query data node, determine a matching head historical query data node of the tail historical query data node in the current training sample set; determine a knowledge transfer contrast loss value according to positive sample pairs consisting of tail historical query data nodes and corresponding matching head historical query data nodes; in response to the training end condition not being met, adjust model parameters of the current long-tail data representation model based on the knowledge transfer contrast loss value, wherein the long-tail data representation model after the model parameter adjustment serves as the current long-tail data representation model of a next model training process.

[0222] It should be understood that the computer-executable instructions stored in the memory, when executed, cause the at least one processor 1910 to perform various operations and functions described above in conjunction with the various embodiments of the present specification. Figure 21

[0223] The following refers to Figure 21 , Figure 10 A schematic diagram of an apparatus 2000 for representing query data according to an embodiment of the present specification is shown.

[0224] As Figure 11 shown, the apparatus 2000 for representing query data can include at least one processor 2010, a memory (e.g., a non-volatile memory) 2020, a memory 2030, and a communication interface 2040, and the at least one processor 2010, the memory 2020, the memory 2030, and the communication interface 2040 are connected together via a bus 2050. The at least one processor 2010 executes at least one computer-readable instruction (i.e., the above-mentioned elements implemented in software) stored or encoded in the memory.

[0225] ​In one embodiment, computer executable instructions stored in the memory, when executed, cause the at least one processor 2010 to: receive data to be queried; determine whether the data to be queried belongs to long tail data; if it belongs, provide graph data matched with the data to be queried to the second graph neural network of the long tail data representation model trained by the method described above to obtain a feature representation corresponding to the data to be queried; if it does not belong, provide graph data matched with the data to be queried to the first graph neural network of the long tail data representation model trained by the method described above to obtain a feature representation corresponding to the data to be queried; wherein the graph data matched with the data to be queried contains nodes for indicating the data to be queried and associated historical query data nodes and historical matching data nodes.

[0226] It should be understood that the computer executable instructions stored in the memory, when executed, cause the at least one processor 2010 to perform various operations and functions described above in conjunction with the various embodiments of the present specification. Figures 1-11

[0227] With reference to the above description of the method of the present specification, the service search apparatus 2100 can be configured to perform the method. ​ ​ A schematic diagram of a service search apparatus 2100 of an embodiment of the present specification is shown.

[0228] As shown in ​ , the service search apparatus 2100 can include at least one processor 2110, a memory (e.g., a non-volatile memory) 2120, an internal memory 2130, and a communication interface 2140, and the at least one processor 2110, the memory 2120, the internal memory 2130, and the communication interface 2140 are connected together via a bus 2150. The at least one processor 2110 executes at least one computer readable instruction (i.e., the above-mentioned elements implemented in software) stored or encoded in the memory.

[0229] ​​In one embodiment, computer executable instructions are stored in the memory, which when executed cause the at least one processor 2110 to: receive a user service search request; determine whether the user service search request belongs to a long tail search request; if yes, provide graph data matched with the user service search request to a second graph neural network of the long tail data representation model trained by the method described above, to obtain feature representations corresponding to the user service search request and each to-be-matched service; if not, provide graph data matched with the user service search request to a first graph neural network of the long tail data representation model trained by the method described above, to obtain feature representations corresponding to the user service search request and each to-be-matched service; select a target number of to-be-matched services most similar to the user service search request from each to-be-matched service according to the obtained feature representations corresponding to the user service search request and each to-be-matched service; wherein the graph data matched with the user service search request comprises a node for indicating the user service search request and associated historical user service search request nodes and to-be-matched service nodes.

[0230] It should be understood that the computer executable instructions stored in the memory, when executed, cause the at least one processor 2010 to perform various operations and functions described above in conjunction with ​ 、 ​ the various embodiments of the present specification.

[0231] According to one embodiment, a program product such as a computer readable medium is provided. The computer readable medium can have instructions (i.e., the above-mentioned elements implemented in software) that, when executed by a computer, cause the computer to perform various operations and functions described above in conjunction with ​ the various embodiments of the present specification.

[0232] In particular, a system or apparatus equipped with a readable storage medium on which software program codes implementing the functions of any of the above-mentioned embodiments are stored, and a computer or processor of the system or apparatus are provided to read and execute the instructions stored in the readable storage medium.

[0233] In this case, the program codes read from the readable medium can themselves implement the functions of any of the above-mentioned embodiments, and thus the machine readable codes and the readable storage medium storing the machine readable codes constitute a part of the present application.

[0234] Computer program code for carrying out operations of the present specification can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB, NET, and Python, conventional procedural programming languages, such as the "C" programming language, Visual Basic 2003, Perl, COBOL 2002, PHP, and ABAP, dynamic programming languages, such as Python, Ruby, and Groovy, or other programming languages. The program code can execute entirely on the user's computer, or it can be executed as a separate software package, in part on the user's computer, and in part on a remote computer, or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic program code can be downloaded from a server or from the cloud, or it can be downloaded from another computer or device. In some embodiments, the electronic program code can be downloaded over the air, for example, over a wireless network.

[0235] Embodiments of the readable storage medium include floppy diskettes, hard disks, optical disks such as CD-ROMs, CD-RWs, DVDs, DVD-ROMs, DVD-RWs, DVD-RWs, magnetic tapes, flash memories, and ROMs. The program code can also be downloaded from a server or from the cloud over a network, for example, the Internet.

[0236] The above-described embodiments of the present specification are described in connection with certain specific embodiments. Other embodiments fall within the scope of the claims. In some cases, the actions or steps recited in the claims can be performed in a different order and still achieve desirable results. Additionally, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0237] Not all steps and units in the above-described flowcharts and system block diagrams are required, and some steps or units can be omitted according to actual needs. The execution order of the steps is not fixed and can be determined as needed. The device structures described in the above embodiments can be physical structures or logical structures, i.e., some units can be implemented by the same physical entity, or some units can be implemented by multiple physical entities, or some units can be implemented by some components in multiple independent devices.

[0238] The term "exemplary" is used throughout this specification to mean "serving as an example, instance, or illustration." Nothing herein is intended to be construed as implying that any embodiment described herein is "preferred" or "superior" to, or has preference over any other embodiment described herein. The detailed description includes specific details for the purpose of providing a thorough understanding of the described techniques. However, it will be apparent to those skilled in the art that these techniques can be practiced without these specific details. In some instances, well-known structures and devices are shown in block diagram form in order to avoid obscuring the concepts of the described embodiments.

[0239] The above detailed description of the embodiments of the present specification is described in conjunction with the accompanying drawings, but the embodiments of the present specification are not limited to the specific details described in the above-described embodiments. Various simple modifications can be made to the technical solutions of the embodiments of the present specification within the technical concept scope of the embodiments of the present specification, and all these simple modifications belong to the protection scope of the embodiments of the present specification.

[0240] The above description of the content of the present specification is provided so that any ordinary person skilled in the art can implement or use the content of the present specification. Various modifications to the content of the present specification will be apparent to those skilled in the art, and the general principles defined herein can also be applied to other variations without departing from the protection scope of the content of the present specification. Therefore, the content of the present specification is not limited to the examples and designs described herein, but is consistent with the broadest scope of the principles and novel features disclosed herein.

Claims

1. A method for training a long-tail data representation model, wherein, The long-tail data representation model includes a first graph neural network and a second graph neural network, and the method includes: The following model training process is performed iteratively using the training sample set until the training termination condition is met. The training sample set includes a header subgraph consisting of header historical query data nodes and their corresponding historical associated data nodes, and a tail subgraph consisting of tail historical query data nodes and their corresponding historical associated data nodes. The head subgraph data and tail subgraph data of the current training sample set are respectively provided to the first graph neural network and the second graph neural network of the current long-tail data representation model to obtain the feature representations corresponding to the head historical query data nodes and tail historical query data nodes of the current training sample set. For each tail-end historical query data node, determine the matching head-end historical query data node in the current training sample set. The knowledge transfer contrast loss value is determined based on the positive sample pairs consisting of the tail historical query data nodes and the corresponding matching head historical query data nodes. In response to the failure to meet the training termination condition, the model parameters of the current long-tail data representation model are adjusted based on the knowledge transfer comparison loss value. The long-tail data representation model after the model parameter adjustment serves as the current long-tail data representation model in the next model training process.

2. The method as described in claim 1, wherein, The step of providing the head subgraph data and tail subgraph data of the current training sample set to the first graph neural network and the second graph neural network of the current long-tail data representation model, respectively, to obtain the feature representations corresponding to the head historical query data nodes and tail historical query data nodes of the current training sample set, includes: The head subgraph data of the current training sample set is provided to the first graph neural network of the current long-tail data representation model to obtain the feature representations of the head historical query data nodes and corresponding historical associated data nodes of the current training sample set corresponding to the head historical query data nodes; and The tail subgraph data of the current training sample set is provided to the second graph neural network of the current long-tail data representation model to obtain the tail historical query data nodes and corresponding historical associated data nodes of the current training sample set. The determination of the knowledge transfer contrast loss value based on the positive sample pairs consisting of tail historical query data nodes and corresponding matching head historical query data nodes includes: The first knowledge transfer contrast loss value is determined based on the positive sample pairs consisting of the tail historical query data nodes and the corresponding matching head historical query data nodes. The second knowledge transfer contrast loss value is determined based on positive sample pairs composed of feature representations of the same historical related data node corresponding to the head historical query data node and the tail historical query data node, respectively. The knowledge transfer comparison loss value is determined based on the first knowledge transfer comparison loss value and the second knowledge transfer comparison loss value.

3. The method as described in claim 1, wherein, The first and second graph neural networks are multi-layer graph neural networks. Before adjusting the model parameters of the current long-tail data representation model based on the knowledge transfer comparison loss value in response to the failure to meet the training termination condition, the model training process further includes: For a target node in the current training sample set, a structure enhancement contrastive loss value is determined based on positive sample pairs consisting of the initial node representation of the target node in the multilayer graph neural network and the node feature representations output by other layers. The target node includes at least one of the following: a head historical query data node, a tail historical query data node, a historical associated data node of the head subgraph data, and a historical associated data node of the tail subgraph data. The step of adjusting the model parameters of the current long-tail data representation model based on the knowledge transfer comparison loss value in response to the failure to meet the training termination condition includes: In response to the failure to meet the training termination condition, the model parameters of the current long-tail data representation model are adjusted based on the total loss value obtained from the knowledge transfer contrastive loss value and the structure enhancement contrastive loss value.

4. The method of claim 3, wherein, The node features output by the other layers include the node features output by the even-numbered layers of the multi-layer graph neural network.

5. The method as described in any one of claims 1 to 4, wherein, The training sample set also includes hierarchical intent data corresponding to the head subgraph data and the tail subgraph data, wherein the hierarchical intent data includes graph data composed of intent nodes. Before adjusting the model parameters of the current long-tail data representation model based on the knowledge transfer comparison loss value in response to the failure to meet the training termination condition, the model training process further includes: For the target node in the current training sample set, a hierarchical intent contrast loss value is determined based on the positive sample pair composed of the feature representation corresponding to the target node and the feature representation corresponding to the matching intent node of the target node. The target node includes at least one of the following: head historical query data node, tail historical query data node, historical associated data node of head subgraph data, and historical associated data node of tail subgraph data. The matching intent node includes a peer matching intent node and the parent node of the peer matching intent node. The peer matching intent node is the intent node in the hierarchical intent data that matches the target node. The step of adjusting the model parameters of the current long-tail data representation model based on the knowledge transfer comparison loss value in response to the failure to meet the training termination condition includes: In response to the failure to meet the training termination condition, the model parameters of the current long-tail data representation model are adjusted based on the total loss value obtained from the knowledge transfer comparison loss value and the hierarchical intent comparison loss value.

6. The method of claim 5, wherein, The hierarchical intent data includes graph data composed of multiple intent trees. The step of determining the hierarchical intent contrast loss value for a target node in the current training sample set, based on a positive sample pair consisting of the feature representation corresponding to the target node and the feature representation corresponding to the matching intent node of the target node, includes: For a target node in the current training sample set, a hierarchical intent contrast loss value is determined based on a positive sample pair consisting of the feature representation corresponding to the target node and the feature representation corresponding to the matching intent node of the target node, and a negative sample pair consisting of the feature representation corresponding to the target node and the feature representation corresponding to other peer intent nodes belonging to the same intent tree as the peer matching intent node of the target node.

7. The method of claim 5, wherein, The hierarchical intent data includes graph data composed of multiple intent trees. The step of determining the hierarchical intent contrast loss value for a target node in the current training sample set, based on a positive sample pair consisting of the feature representation corresponding to the target node and the feature representation corresponding to the matching intent node of the target node, includes: For a target node in the current training sample set, a hierarchical intent contrast loss value is determined based on a positive sample pair consisting of the feature representation corresponding to the target node and the feature representation corresponding to the matching intent node of the target node, and a negative sample pair consisting of the feature representation corresponding to the target node and the feature representation corresponding to the same-level intent node of the same-level matching intent node belonging to a different intent tree.

8. The method of claim 5, wherein, The hierarchical intent data includes graph data composed of multiple intent trees, and the feature representation corresponding to the matching intent node is obtained by aggregating the feature representations of the child nodes of the matching intent node.

9. The method of claim 1, wherein, The matching of historical query data nodes in the header is determined based on at least one of the following: semantic relevance, attribute matching degree corresponding to the node, and historical popularity.

10. The method of claim 9, wherein, The historical query data nodes in the header are determined through the following steps: For each tail of historical query data node, From the current training sample set, select a first number of initial candidate head historical query data nodes that have the highest semantic relevance to the tail historical query data node. From the first set of initial candidate header historical query data nodes, select a second set of candidate header historical query data nodes that match the target attribute of the tail historical query data node. Select the historical query data node with the highest historical popularity from the second number of candidate historical query data nodes as the matching historical query data node.

11. The method of claim 1, further comprising: In response to the satisfaction of the training termination condition, the current long-tail data representation model is determined as a pre-trained long-tail data representation model; The search model is fine-tuned using a label sample set that matches the training sample set. The label sample set includes historical query data as features and historical matching data corresponding to the historical query data as labels. The training sample set includes nodes used to represent the historical feature data and the corresponding historical matching data. The search model includes the pre-trained long-tail data representation model and classification model.

12. A method for characterizing query data, comprising: Receive the data to be queried; Determine whether the data to be queried belongs to long-tail data; If it is found, the graph data that matches the data to be queried is provided to the second graph neural network of the long-tail data representation model trained by the method as described in any one of claims 1 to 11, so as to obtain the feature representation corresponding to the data to be queried. If it does not belong to the query data, the graph data that matches the query data is provided to the first graph neural network of the long-tail data representation model trained by the method as described in any one of claims 1 to 11, so as to obtain the feature representation corresponding to the query data. The graph data that matches the data to be queried includes nodes that indicate the data to be queried, associated historical query data nodes, and historical matching data nodes.

13. A service search method, comprising: Receive user service search requests; Determine whether the user service search request belongs to a long-tail search request; If it is, the graph data matching the user service search request is provided to the second graph neural network of the long-tail data representation model trained by the method as described in any one of claims 1 to 11, so as to obtain the feature representation corresponding to the user service search request and each service to be matched. If it does not belong to the user service search request, the graph data that matches the user service search request is provided to the first graph neural network of the long-tail data representation model trained by the method as described in any one of claims 1 to 11, so as to obtain the feature representation corresponding to the user service search request and each service to be matched. Based on the obtained user service search request and the feature representation of each service to be matched, select a target number of services that are most similar to the user service search request from each service to be matched. The graph data matching the user service search request includes nodes indicating the user service search request, associated historical user service search request nodes, and service nodes to be matched.

14. An apparatus for training a long-tail data representation model, wherein, The long-tail data representation model includes a first graph neural network and a second graph neural network. The device is configured to cyclically execute the model training process using a training sample set via a training unit until the training termination condition is met. The training sample set includes head subgraph data consisting of head historical query data nodes and corresponding historical associated data nodes, and tail subgraph data consisting of tail historical query data nodes and corresponding historical associated data nodes. The training unit includes: The node feature extraction module is configured to provide the head subgraph data and tail subgraph data of the current training sample set to the first graph neural network and the second graph neural network of the current long-tail data representation model, respectively, to obtain the feature representations corresponding to the head historical query data nodes and tail historical query data nodes of the current training sample set. The node matching module is configured to determine the matching head historical query data node for each tail historical query data node in the current training sample set. The first contrastive loss value determination module is configured to determine the knowledge transfer contrastive loss value based on positive sample pairs consisting of tail historical query data nodes and corresponding matching head historical query data nodes; and The device further includes: The parameter adjustment unit is configured to adjust the model parameters of the current long-tail data representation model based on the knowledge transfer comparison loss value in response to the failure to meet the training termination condition. The long-tail data representation model after the model parameter adjustment serves as the current long-tail data representation model in the next model training process.

15. An apparatus for characterizing query data, comprising: The data receiving unit is configured to receive data to be queried. The first feature representation unit is configured to determine whether the data to be queried belongs to long-tail data; If the data matches the data to be queried, the graph data matching the data to be queried is provided to the second graph neural network of the long-tail data representation model trained by the method as described in any one of claims 1 to 11, to obtain the feature representation corresponding to the data to be queried; if the data does not match the data to be queried, the graph data matching the data to be queried is provided to the first graph neural network of the long-tail data representation model trained by the method as described in any one of claims 1 to 11, to obtain the feature representation corresponding to the data to be queried, wherein the graph data matching the data to be queried includes nodes for indicating the data to be queried and associated historical query data nodes and historical matching data nodes.

16. A service search device, comprising: The service request receiving unit is configured to receive user service search requests; The second feature characterization unit is configured to determine whether the user service search request belongs to a long-tail search request. If the user service search request is found to be a match, the graph data matching the user service search request is provided to the second graph neural network of the long-tail data representation model trained by the method described in any one of claims 1 to 11 to obtain feature representations corresponding to the user service search request and each service to be matched; if the user service search request is not found to be a match, the graph data matching the user service search request is provided to the first graph neural network of the long-tail data representation model trained by the method described in any one of claims 1 to 11 to obtain feature representations corresponding to the user service search request and each service to be matched, wherein the graph data matching the user service search request includes nodes indicating the user service search request, associated historical user service search request nodes, and service nodes to be matched; The service selection unit is configured to select a target number of services that are most similar to the user service search request from among the services to be matched, based on the obtained user service search request and the feature representations corresponding to each service to be matched.

17. An apparatus for training a long-tail data representation model, comprising: At least one processor, a memory coupled to the at least one processor, and a computer program stored on the memory, wherein the at least one processor executes the computer program to implement the method as claimed in any one of claims 1 to 11.

18. An apparatus for characterizing query data, comprising: At least one processor, a memory coupled to the at least one processor, and a computer program stored on the memory, wherein the at least one processor executes the computer program to implement the method as claimed in claim 12.

19. A service search device, comprising: At least one processor, a memory coupled to the at least one processor, and a computer program stored on the memory, wherein the at least one processor executes the computer program to implement the method as claimed in claim 13.

20. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method for training a long-tail data representation model as described in any one of claims 1 to 11, the method for representing query data as described in claim 12, or the service search method as described in claim 13.

21. A computer program product comprising a computer program executed by a processor to implement the method for training a long-tail data representation model as described in any one of claims 1 to 11, the method for representing query data as described in claim 12, or the service search method as described in claim 13.

Citation Information

Patent Citations

  • Neural network training method and device suitable for long-tail distribution data set

    CN112101544A

  • Semantic representation graph model training method and device, equipment and storage medium

    CN113033194A