Document recommendation method and device and storage medium
By determining the historical information sequence in the personalized search model to represent the correlation relationship between user history query results, the problem of low personalized search performance in the prior art is solved, and a more accurate and personalized document recommendation effect is achieved.
Patent Information
- Application Number
- CN202411397133.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-07
AI Technical Summary
When existing personalized search models integrate semantic contexts using user historical search records, personalized search performance is low and fail to fully capture the associations between different types of information in user historical information.
By obtaining the user's current query information and multiple historical query results, a sequence of historical information is determined to represent the association relationship between multiple historical query results, and the order in which candidate documents are recommended to the user is determined based on the historical information sequence.
Improve the performance of personalized search and can more effectively capture the correlation between different types of information in user history information, thereby providing more accurate and personalized document recommendations.
Smart Images

Figure CN119397003A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of natural language processing technology, and in particular to a document recommendation method, device and storage medium. Background Art
[0002] Search engines are an important tool for users to obtain information, but they return the same results for the same query and cannot meet the personalized needs of different users, which led to the emergence of personalized search. Personalized search simulates user preferences through user historical behavior and returns customized ranking results, which can provide better re-ranked document lists and thus improve user satisfaction.
[0003] Currently, some personalized search models extract user details by integrating semantic context from user historical search records, and then predict user intentions and interests. However, using the above methods, the performance of personalized search is low. Summary of the invention
[0004] The present application provides a document recommendation method, device and storage medium, which can improve the performance of personalized search.
[0005] In order to achieve the above objectives, this application adopts the following technical solutions:
[0006] In a first aspect, the present application provides a document recommendation method, the method comprising: obtaining a user's current query information and determining a candidate document that matches the current query information; obtaining multiple historical query results of the user, the historical query results including historical documents that match the user's historical query information and are used by the user; determining a historical information sequence based on the historical query information and information of the historical documents, the historical information sequence being used to represent an association relationship between multiple historical query results; and determining an order in which candidate documents are recommended to the user based on the historical information sequence.
[0007] In one possible implementation, the order of recommending candidate documents to the user is determined based on the historical information sequence, including: determining the degree of match between current query information and the candidate documents based on the historical information sequence; determining the order of recommending candidate documents to the user based on the degree of match; wherein the degree of match is proportional to the order of the candidate documents.
[0008] In one possible implementation, the degree of match between current query information and candidate documents is determined based on a historical information sequence, including: inputting the current query information and the historical information sequence into a search model to determine a current query vector corresponding to the current query information; inputting the candidate documents and the historical information sequence into a search model to determine a candidate document vector corresponding to the candidate document; and determining the degree of match between the current query information and the candidate document based on the current query information, the candidate documents, the current query vector, and the candidate document vector.
[0009] In one possible implementation, the degree of match between the current query information and the candidate document is determined based on the current query information, the candidate document, the current query vector, and the candidate document vector, including: determining a first relevance score of the candidate document based on the similarity between the current query information and the candidate document; determining a second relevance score of the candidate document based on the similarity between the current query vector and the candidate document vector; and determining the degree of match between the current query information and the candidate document based on the first relevance score and the second relevance score.
[0010] In one possible implementation, based on the similarity between the current query information and the candidate document, determining a first relevance score of the candidate document includes: determining the first relevance score of the candidate document based on the cosine similarity between the current query information and the candidate document and the cosine similarity between the word vector of the current query information and the word vector of the candidate document.
[0011] In a possible implementation, determining a historical information sequence based on historical query information and historical document information includes: inputting the historical query information and historical document information into a search model to determine the historical information sequence.
[0012] In one possible implementation, the method also includes: determining historical query prediction loss, historical document prediction loss, and current query prediction loss based on historical information sequence and preset loss algorithm; updating the search model based on minimizing historical query prediction loss, historical document prediction loss, and current query prediction loss.
[0013] In one possible implementation, the search model includes a word-level context encoder and a sequence-level context encoder.
[0014] In a second aspect, the present application provides a document recommendation device, which includes: a communication unit and a processing unit; the communication unit is used to obtain a user's current query information; the communication unit is also used to obtain multiple historical query results of the user, the historical query results include historical documents that match the user's historical query information and are used by the user; the processing unit is used to determine candidate documents that match the current query information; the processing unit is also used to determine a historical information sequence based on the historical query information and information of the historical documents, the historical information sequence is used to represent the association relationship between multiple historical query results; the processing unit is also used to determine the order of recommending candidate documents to the user based on the historical information sequence.
[0015] In a possible implementation, the processing unit is further used to determine the matching degree between the current query information and the candidate documents based on the historical information sequence; the processing unit is further used to determine the order of recommending the candidate documents to the user based on the matching degree; wherein the matching degree is proportional to the order of the candidate documents.
[0016] In one possible implementation, the processing unit is further used to input the current query information and the historical information sequence into the search model to determine the current query vector corresponding to the current query information; the processing unit is further used to input the candidate document and the historical information sequence into the search model to determine the candidate document vector corresponding to the candidate document; the processing unit is further used to determine the degree of match between the current query information and the candidate document based on the current query information, the candidate document, the current query vector, and the candidate document vector.
[0017] In one possible implementation, the processing unit is further used to determine a first relevance score of the candidate document based on the similarity between the current query information and the candidate document; the processing unit is further used to determine a second relevance score of the candidate document based on the similarity between the current query vector and the candidate document vector; the processing unit is further used to determine a degree of match between the current query information and the candidate document based on the first relevance score and the second relevance score.
[0018] In a possible implementation, the processing unit is further configured to determine a first relevance score of the candidate document based on a cosine similarity between the current query information and the candidate document and a cosine similarity between a word vector of the current query information and a word vector of the candidate document.
[0019] In a possible implementation, the processing unit is further configured to input the historical query information and the historical document information into the search model to determine the historical information sequence.
[0020] In one possible implementation, the processing unit is also used to determine the historical query prediction loss, the historical document prediction loss, and the current query prediction loss based on the historical information sequence and the preset loss algorithm; the processing unit is also used to update the search model based on minimizing the historical query prediction loss, the historical document prediction loss, and the current query prediction loss.
[0021] In one possible implementation, the search model includes a word-level context encoder and a sequence-level context encoder.
[0022] In a third aspect, the present application provides a document recommendation device, comprising: a processor and a communication interface; the communication interface and the processor are coupled, and the processor is used to run a computer program or instructions to implement the document recommendation method described in the first aspect and any possible implementation method of the first aspect.
[0023] In a fourth aspect, the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a terminal, the terminal executes the document recommendation method described in the first aspect and any possible implementation of the first aspect.
[0024] In a fifth aspect, the present application provides a computer program product comprising instructions, which, when the computer program product is run on a document recommendation device, enables the document recommendation device to perform the document recommendation method as described in the first aspect and any possible implementation manner of the first aspect.
[0025] In a sixth aspect, the present application provides a chip, the chip comprising a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run a computer program or instructions to implement the document recommendation method as described in the first aspect and any possible implementation method of the first aspect.
[0026] Specifically, the chip provided in the present application also includes a memory for storing computer programs or instructions.
[0027] The above technical solution brings at least the following beneficial effects: based on the historical query information and the information of the historical documents, the historical information sequence is determined, and the order of recommending candidate documents to the user is determined based on the historical information sequence. Since the historical information sequence can represent the association between multiple historical query results, the document recommendation method provided in the embodiment of the present application can capture the association between different types of information in the user's historical information, compared with the general technology of simply splicing historical queries and historical documents, thereby improving the performance of personalized search. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A schematic diagram of the structure of a document recommendation system provided in an embodiment of the present application;
[0029] Figure 2 A schematic diagram of the composition of a document recommendation device provided in an embodiment of the present application;
[0030] Figure 3 A flowchart of a document recommendation method provided in an embodiment of the present application;
[0031] Figure 4 A schematic diagram of a search model provided in an embodiment of the present application;
[0032] Figure 5 A flowchart of another document recommendation method provided in an embodiment of the present application;
[0033] Figure 6 A flowchart of another document recommendation method provided in an embodiment of the present application;
[0034] Figure 7 A flowchart of another document recommendation method provided in an embodiment of the present application;
[0035] Figure 8A flowchart of another document recommendation method provided in an embodiment of the present application;
[0036] Fig. 9 A schematic diagram of a model for historical query prediction, historical document prediction, and current query prediction provided in an embodiment of the present application;
[0037] Fig.10 A schematic diagram of the structure of a document recommendation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0038] The document recommendation method, device and storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0039] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0040] The terms "first" and "second" and the like in the specification and drawings of this application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.
[0041] In addition, the terms "including" and "having" and any variations thereof mentioned in the description of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0042] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0043] In the description of the present application, unless otherwise specified, “plurality” means two or more.
[0044] Search engines have become a key tool for users to access information. However, search engines usually produce the same results in response to the same query, without paying attention to the different information needs of different users. For example, some users use the word "MAC" to mean "MAC computer", while others use the word "MAC" to mean "MAC lipstick". To solve the above problems, personalized search has become an effective strategy. Personalized search simulates user preferences through user historical behavior and returns customized ranked results. Personalized search has been proven to provide better re-ranked document lists and improve user satisfaction.
[0045] Currently, personalized search models combine semantic context in user history with current queries and documents. For example, some personalized search models extract user details through click behaviors in user history and topic attributes of documents to predict user preferences, but they suffer from problems such as high computational cost and incomplete classification.
[0046] Furthermore, deep learning models such as hierarchical recurrent networks with query-aware attention and graph enhancement methods have been widely used in personalized search, promoting the development of this field. For example, the hierarchical recurrent neural network (HRNN) model uses hierarchical recurrent neural networks and attention mechanisms to model historical information related to the current query and build user profiles. The Pstie model considers using time interval information in history to enhance the performance of personalized search. The Htps model divides user history into long-term history and short-term history to eliminate the ambiguity of the current query, and designs personalized language model tasks to improve the model effect. Although the above models have improved personalized search to a certain extent and can reveal users' subtle preferences, they do not fully consider the association between different types of information in user historical information and lack robustness in extracting user-specific details.
[0047] In view of this, an embodiment of the present application provides a document recommendation method, in which an electronic device determines a historical information sequence based on historical query information and historical document information, and determines the order of recommending candidate documents to a user based on the historical information sequence. Since the historical information sequence can represent the association relationship between multiple historical query results, the document recommendation method provided by the embodiment of the present application can capture the association between different types of information in the user's historical information, compared to the general technology of simply splicing historical queries and historical documents, thereby improving the performance of personalized search.
[0048] For example, Figure 1 A schematic diagram of the structure of a document recommendation system 10 provided in an embodiment of the present application is shown in FIG. The document recommendation system 10 may include at least one electronic device 101 . Figure 1 Only one electronic device 101 is shown. The embodiment of the present application does not impose any limitation on the number of electronic devices 101.
[0049] Electronic device 101 is used to obtain the user's current query information and determine the candidate documents matching the current query information; obtain multiple historical query results of the user; determine the historical information sequence based on the historical query information and the information of the historical documents; and determine the order of recommending candidate documents to the user based on the historical information sequence.
[0050] Optionally, the electronic device 101 may be an intelligent electronic computer, an intelligent terminal, or an intelligent processing device. Of course, the above is only an exemplary description of the electronic device 101, and the electronic device 101 may also be other devices, and the present application embodiment does not impose any limitation on this.
[0051] It should be noted that Figure 1 This is just an exemplary framework diagram. Figure 1 The number of nodes included in the Figure 1 In addition to the functional nodes shown, the document recommendation system 10 may also include other nodes, and this application does not impose any limitation on this.
[0052] The application scenarios of the embodiments of the present application are not limited. The system architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. It is known to those skilled in the art that with the evolution of the network architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0053] When implementing it specifically, Figure 1 The equipment in Figure 2 The structure shown, or including Figure 2 Parts shown. Figure 2 Schematic diagram of the composition of a document recommendation device 20 provided in an embodiment of the present application. The document recommendation device 20 may be an electronic device 101 or a chip or a system on a chip in the electronic device 101. Figure 2 As shown, the document recommendation device 20 may include a processor 201 and a bus 202 .
[0054] Furthermore, the document recommendation device 20 may also include a communication interface 203 and a memory 204 . The processor 201 , the memory 204 and the communication interface 203 may be connected via a bus 202 .
[0055] The processor 201 is a central processing unit (CPU), a general processor, a network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The processor 201 may also be other devices with processing functions, such as circuits, devices, or software modules, without limitation.
[0056] The bus 202 is used to transmit information between the components included in the document recommendation device 20 .
[0057] The communication interface 203 is used to communicate with other devices or other communication networks. The other communication networks may be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc. The communication interface 203 may be a module, a circuit, a communication interface or any device capable of achieving communication.
[0058] The memory 204 is used to store instructions, where the instructions may be computer programs.
[0059] The memory 204 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, etc., without limitation.
[0060] It should be noted that the memory 204 can exist independently of the processor 201, or can be integrated with the processor 201. The memory 204 can be used to store instructions or program codes or some data, etc. The memory 204 can be located in the document recommendation device 20, or can be located outside the document recommendation device 20, without limitation. The processor 201 is used to execute the instructions stored in the memory 204 to implement the document recommendation method provided in the following embodiments of the present application.
[0061] In an example, the processor 201 may include one or more CPUs, for example, CPU0 and CPU1 (not shown in the figure).
[0062] As an optional implementation, the document recommendation device 20 includes multiple processors.
[0063] As an optional implementation, the document recommendation device 20 further includes an output device and an input device. For example, the input device is a keyboard, a mouse, a microphone, a joystick, and the like, and the output device is a display screen, a speaker, and the like.
[0064] It should be noted that the document recommendation device 20 can be a desktop computer, a portable computer, a network server, a mobile phone, a tablet computer, a wireless terminal, an embedded device, a chip system or a computer with Figure 2 In addition, Figure 2 The composition shown in the Figure 1 as well as Figure 2 The limitations of each device in Figure 2 In addition to the parts shown, Figure 1 as well as Figure 2 The various devices in the drawings may include more or fewer components than shown, or combine certain components, or arrange the components differently.
[0065] In the embodiment of the present application, the chip system may be composed of a chip, or may include a chip and other discrete devices.
[0066] In addition, the actions, terms, etc. involved in the various embodiments of the present application can refer to each other without limitation. The message name or parameter name in the message exchanged between the various devices in the embodiments of the present application is only an example, and other names can also be used in the specific implementation without limitation.
[0067] The document recommendation method provided by the embodiment of the present application is described below in conjunction with the accompanying drawings. Among them, the actions, terms, etc. involved in the various embodiments of the present application can refer to each other without limitation. The message name or parameter name in the message exchanged between the various devices in the embodiment of the present application is only an example, and other names can also be used in the specific implementation without limitation. The actions involved in the various embodiments of the present application are only an example, and other names can also be used in the specific implementation, such as: "included in" in the embodiment of the present application can also be replaced by "carried on" or "carried in", etc.
[0068] like Figure 3 As shown, the embodiment of the present application proposes a document recommendation method, which includes:
[0069] S301: The electronic device obtains the user's current query information and determines candidate documents matching the current query information.
[0070] In a possible implementation, the electronic device obtains the user's current query information according to the user's operation, parses and processes the current query information, searches for documents matching the current query information, and generates candidate documents.
[0071] Exemplarily, the candidate documents may be in various formats such as text files, web pages, images, videos, and audios.
[0072] S302: The electronic device obtains multiple historical query results of the user.
[0073] The historical query results include historical documents that match the historical query information of the user and are used by the user.
[0074] Exemplarily, the document used by the user may be a document clicked by the user.
[0075] In a possible implementation, the electronic device retrieves historical records related to the current query information from the user's historical records stored in the database, and processes the historical records related to the current query information to obtain multiple historical query information and corresponding historical documents used by the user.
[0076] S303: The electronic device determines a historical information sequence based on the historical query information and the information of the historical documents.
[0077] The historical information sequence is used to represent the association relationship between multiple historical query results.
[0078] In one example, the above association relationship may be a content association. For example, the user first searches for "the definition of artificial intelligence" and then searches for "the application field of artificial intelligence". Both query information includes "artificial intelligence", that is, there is a content association.
[0079] In another example, the above association relationship may be a reference association. For example, a historical document may reference information in another historical document, and this reference relationship constitutes an association between historical query results. For example, if historical document A mentions "reference document B", if document B is also a historical document, then historical document A and historical document B have a reference association.
[0080] In a possible implementation, the electronic device inputs historical query information and historical document information into a search model to determine a historical information sequence.
[0081] Among them, the search model can be used to determine the historical information sequence based on the historical query information and the historical documents. The search model can also be used to determine the current query vector based on the current query information and the historical information sequence. The search model can also be used to determine the candidate document vector based on the candidate document and the historical information sequence. The search model is obtained by training multiple historical query results based on a preset deep model (for example, a transformer model). The specific training process and transformer model can refer to the prior art and will not be described here.
[0082] In one example, the search model includes a word-level context encoder and a sequence-level context encoder.
[0083] In combination with the above example, for any one of the multiple historical query information, the electronic device inputs the historical query information into the word-level context encoder, and the word-level context encoder calculates the attention score of each word in the historical query information and other words, and adjusts the vector representation of the word according to the attention score to obtain the vector representation of each word. The word-level context encoder performs sum pooling on the vector representations of all words to obtain the word vector of the historical query information.
[0084] Similarly, for any historical document among the multiple historical query information, the electronic device inputs the information of the historical document (for example, the document title) into a word-level context encoder to obtain a word vector for the historical document.
[0085] The electronic device inputs the word vectors of all historical query information and the word vectors of historical documents into the sequence-level context encoder to obtain the historical information sequence H = {q 1 ,d 1 ,…,q t ,d t ,…,q n ,d n}.
[0086] It should be noted that the word-level context encoder is a transformer. The word-level context encoder receives words from historical query information or historical documents and encodes them into query embedding vectors or document embedding vectors to prepare for the sequence-level context encoder. The goal of the word-level context encoder is to learn a better representation of historical query information or historical documents based on all words in the text. The sequence-level context encoder is also a transformer. The sequence-level context encoder receives word-level embedding vectors from query embedding vectors or document embedding vectors and encodes them into a sequence of user historical information. The goal of the sequence-level context encoder is to learn a better representation for the user's historical information.
[0087] Figure 4 A schematic diagram of a search model provided in an embodiment of the present application. Figure 4 As shown, user history information includes historical query information q n and historical documents n ,q n and d n After word embedding, the query embedding vector and document embedding vector are output, and are input into the word-level transformer model together with the word position encoding, and the word vectors of the historical query information and the word vectors of the historical documents are output respectively. The word vectors of the historical query information and the word vectors of the historical documents are input into the sequence-level transformer model together with the sequence position encoding, and each sequence is separated by a separator (SEP), and the historical information sequence is output. Similarly, the processing of the current query and candidate document is consistent with that of the historical query information and historical documents, and will not be repeated here.
[0088] Combination Figure 4 , for example, using historical query information q 1 For example, suppose q 1 It consists of m words, expressed as q=w 1 , w 2 ,…,w m . Each word is converted into a vector representation of a preset dimension (for example, 100 dimensions), and combined with the position encoding of the word, it enters the word-level context encoder. In the word-level context encoder, q 1 The word vector representation list w′ 1 , w′2 , ..., w′ m , and make adjustments to obtain historical query information q 1 For example, w 1 The corresponding vector represents w′ 1 It can be [0.1, -0.2, 0.3, ..., 0.05, -0.15].
[0089] It can be understood that the historical query information and the information of the historical documents reflect the user's intentions and interests, and the historical information sequence determined by the electronic device effectively encodes the nuances of context and order in the user's historical data.
[0090] S304: The electronic device determines the order of recommending candidate documents to the user based on the historical information sequence.
[0091] In a possible implementation, the electronic device determines a score for each candidate document based on the historical information sequence, and determines an order for recommending the candidate documents to the user according to the scores of the candidate documents.
[0092] It should be noted that the above determination of the score of each candidate document can be defined as a personalized search task. Specifically, consider the user's historical information sequence H = {P 1 , P 2 ,...}. Among them, each P i It includes a query information, a set of documents and a click document with a timestamp. Since the query information and its corresponding click document information can better represent the user's intention, these two key types of historical information are studied to determine the historical information sequence. In the embodiment of the present application, the user's historical information sequence is represented as H = (q 1 , d 1 ),...,(q n , d n ), where n represents the total number of historical query results. That is, given the current query q c and a set of candidate documents The personalized search task is to c and the user's historical information sequence H, determine D c The score of each candidate document in .
[0093] In the document recommendation method provided by the present application, the electronic device determines a historical information sequence based on historical query information and historical document information, and determines the order of recommending candidate documents to the user based on the historical information sequence. Since the historical information sequence can represent the association relationship between multiple historical query results, the document recommendation method provided by the embodiment of the present application can capture the association between different types of information in the user's historical information, compared to the general technology of simply splicing historical queries and historical documents, thereby improving the performance of personalized search.
[0094] In one embodiment, Figure 5 As shown, the above S304 can be specifically determined through the following S501 to S502.
[0095] S501: The electronic device determines the matching degree between the current query information and the candidate document based on the historical information sequence.
[0096] The matching degree indicates the closeness between the current query information and the candidate document.
[0097] In a possible implementation, the electronic device determines a current query vector based on the historical information sequence and the current query information, determines a candidate document vector based on the historical information sequence and the candidate document, and determines a matching degree between the current query information and the candidate document based on the current query information, the candidate document, the current query vector, and the candidate document vector. Figure 5 The described embodiments are not described in detail here.
[0098] S502: The electronic device determines the order of recommending candidate documents to the user based on the matching degree.
[0099] The matching degree is proportional to the order of the candidate documents. For example, the matching degree of candidate document A is m. 1 , the matching degree of candidate document B is m 2 , the matching degree of candidate document C is m 3 If m 1 >m 2 >m 3 , then the order of candidate document A, candidate document B and candidate document C is candidate document A first, then candidate document B, and then candidate document C.
[0100] In a possible implementation, the electronic device determines the order of recommending candidate documents to the user in descending order of matching degree.
[0101] It is understandable that the electronic device recommends candidate documents to the user in order of the matching degree from large to small, and can put the document that best meets the user's needs at the front, thereby improving the user's satisfaction.
[0102] In one embodiment, Figure 6 As shown, the above S501 can be specifically determined through the following S601 to S603.
[0103] S601: The electronic device inputs current query information and a historical information sequence into a search model to determine a current query vector corresponding to the current query information.
[0104] In one possible implementation, similar to the aforementioned determination of the word vector of the historical query information, the electronic device inputs the current query information into a word-level context encoder to obtain the word vector of the current query information. The electronic device inputs the word vector of the current query information and the historical information sequence into a sequence-level context encoder to obtain the current query vector.
[0105] It should be noted that when the electronic device inputs the word vector of the current query information and the historical information sequence into the sequence-level context encoder, it is not necessary to input the candidate document into the sequence-level context encoder.
[0106] It can be understood that after the word vector of the current query information and the historical information sequence pass through the sequence-level context encoder, the current query vector is obtained. In other words, the current query vector is added with information about the user's historical intentions and interests from the historical information sequence, which facilitates the subsequent determination of candidate documents that meet the user's needs based on the current query vector.
[0107] S602: The electronic device inputs the candidate document and the historical information sequence into the search model to determine the candidate document vector corresponding to the candidate document.
[0108] In a possible implementation, similar to the above determination of the current query vector, the electronic device inputs the candidate document into a word-level context encoder to obtain a word vector of the candidate document. The electronic device inputs the word vector and the historical information sequence of the candidate document into a sequence-level context encoder to obtain a candidate document vector.
[0109] It should be noted that when the electronic device inputs the word vector and historical information sequence of the candidate document into the sequence-level context encoder, it does not need to input the current query information into the sequence-level context encoder.
[0110] It can be understood that after the word vector and historical information sequence of the candidate document are passed through the sequence-level context encoder, the candidate document vector is obtained. In other words, the candidate document vector is added with information about the user's historical intentions and interests from the historical information sequence, which facilitates the subsequent determination of candidate documents that meet the user's needs based on the candidate document vector.
[0111] S603: The electronic device determines a matching degree between the current query information and the candidate document based on the current query information, the candidate document, the current query vector, and the candidate document vector.
[0112] In a possible implementation, the electronic device determines a first relevance score and a second relevance score of the candidate document based on the current query information, the candidate document, the current query vector, and the candidate document vector, and determines the degree of match between the current query information and the candidate document based on the first relevance score and the second relevance score of the candidate document. Figure 6 The described embodiments are not described in detail here.
[0113] In one embodiment, Figure 7 As shown, the above S603 can be specifically determined through the following S701 to S703.
[0114] S701: The electronic device determines a first relevance score of the candidate document based on the similarity between current query information and the candidate document.
[0115] In a possible implementation, the electronic device determines a first relevance score of the candidate document based on a cosine similarity between the current query information and the candidate document and a cosine similarity between a word vector of the current query information and a word vector of the candidate document.
[0116] Optionally, the first relevance score of the candidate document may satisfy the following Formula 1.
[0117] p 1 (d,q)=Φ(I(a,d),I(q W ,d W ),φ(F(q,d))) Formula 1 Where, p 1 (d, q) represents the first relevance score of the candidate document, I(q, d) represents the similarity between the current query information and the candidate document, and q W The word vector representing the current query information, d W Represents the word vector of the candidate document, I(q W , d W ) represents the similarity between the word vector of the current query information and the word vector of the candidate document, φ(F(q, d) represents the artificial features of the candidate document (for example, the click-through rate of the candidate document by all users and the topic of the candidate document), I(·) represents the kernel-based neural ranking model (KNRM) method to determine the similarity, and φ is a neural network model (for example, a multilayer perceptron (MLP) with one hidden layer).
[0118] The following is a detailed introduction to the above-mentioned KNRM method for determining similarity.
[0119] Taking the similarity between the current query information and the candidate documents as an example, the cosine similarity between each word in the current query information and each word in the candidate documents is calculated, and the similarity values are used to form an interaction matrix M. For the interaction matrix M, multiple Gaussian kernel functions are used to capture different levels of similarity and obtain multiple scores. Finally, MLP is used to aggregate the scores from different Gaussian kernels and output the final similarity score.
[0120] The above Gaussian kernel function can be expressed by the following formula 2.
[0121]
[0122] Among them, K k (M) represents the Gaussian kernel function, M ij represents the corresponding parameter in the above interaction matrix M, μ k According to the number of Gaussian kernels distributed between -1 and 1, σ k Set to 0.1.
[0123] The final similarity score can be expressed as follows:
[0124] KNRM k (M) = φ(K 1 (M), K 2 (M), ..., K k (M)) Formula 3
[0125] Among them, KNRM k (M) represents the final similarity score, K k (M) represents the score obtained according to the above Gaussian kernel function, and φ is an MLP with one hidden layer.
[0126] S702: The electronic device determines a second relevance score of the candidate document based on the similarity between the current query vector and the candidate document vector.
[0127] In a possible implementation, the electronic device determines the second relevance score of the candidate document based on the cosine similarity between the current query vector and the candidate document vector and the cosine similarity between the current query vector and the aggregated word vector of the candidate document.
[0128] Optionally, the second relevance score of the candidate document may satisfy Formula 4 below.
[0129]
[0130] Among them, p 2 (dH ,q H ) represents the second relevance score of the candidate document, q H represents the current query vector, d H represents the candidate document vector, S(q H , d H ) represents the cosine similarity between the current query vector and the candidate document vector, represents the aggregated word vector of the candidate document (that is, the word vectors of all candidate documents are summed and pooled), represents the cosine similarity between the current query vector and the aggregated word vector of the candidate document, and φ is an MLP with one hidden layer.
[0131] S703: The electronic device determines a matching degree between the current query information and the candidate document based on the first relevance score and the second relevance score.
[0132] Optionally, the degree of match between the current query information and the candidate document may be an average of the first relevance score and the second relevance score.
[0133] Also optionally, the matching degree between the current query information and the candidate document may be the sum of the first relevance score and the second relevance score.
[0134] Optionally, in order to update the search model to obtain more accurate output results. Figure 8 As shown, the document recommendation method described in the embodiment of the present application may also include the following steps.
[0135] S801. The electronic device determines a historical query prediction loss, a historical document prediction loss, and a current query prediction loss based on a historical information sequence and a preset loss algorithm.
[0136] In one possible implementation, the electronic device uses mutual information maximization (MIM) to model the relationship between different information in the historical information sequence, and obtains three auxiliary tasks, namely historical query prediction, historical document prediction, and current query prediction, and determines the historical query prediction loss, historical document prediction loss, and current query prediction loss according to a preset loss algorithm.
[0137] It should be noted that MIM, as a form of self-supervised learning, can use the inherent correlations in the user's historical information sequence to form interrelated representations of different types of data. This learning paradigm enables the model to learn from the underlying structure of the original data, construct self-derived training signals, and optimize model parameters through specially designed optimization objectives.
[0138] Fig. 9 A schematic diagram of a model for historical query prediction, historical document prediction, and current query prediction provided in an embodiment of the present application. Fig. 9 As shown, taking historical query prediction as an example, the historical query information q in the historical information sequence H is shielded. 2 , and the rest of the sequences are represented as Input the masked historical query into the Word-level transformer to get the predicted historical query vector. Input the base model and maximize The mutual information with the predicted historical query vector (i.e., minimizing the historical query prediction loss). Similarly, the processing of historical document prediction and current query prediction is consistent with that of historical query prediction, and will not be described here.
[0139] The historical query prediction loss, historical document prediction loss, and current query prediction loss are described in detail below.
[0140] 1-1. Historical query prediction loss
[0141] For a specified historical information sequence H, the electronic device shields the tth historical query information q t , and the remaining sequence is taken as q t The surrounding context can be expressed as: Electronic devices will context and mask q t As different views of learning data representation, the historical query prediction loss is obtained according to the preset loss algorithm.
[0142] The historical query prediction loss can be expressed as the following formula 5.
[0143]
[0144] in, represents the historical query prediction loss, f(·) represents the scoring function, Q represents the set of all historical query information, express belongs to set Q but not q t (Right now represents negative sampling history query).
[0145] The above scoring function can be expressed by the following formula 6.
[0146]
[0147] in, represents the sequence-level representation of the historical query information predicted by the t-th historical query information position in the historical information sequence, W HQP ∈R * represents the parameter matrix to be learned, Indicates historical query information q t The word vector of , σ represents the Softmax activation function.
[0148] 1-2. Historical Document Prediction Loss
[0149] For a specified historical information sequence H, the electronic device screens the tth candidate document d t , and the remaining sequence is taken as d t The surrounding context can be expressed as Electronic devices will context and mask d t As two different views, the historical document prediction loss is obtained according to the preset loss algorithm.
[0150] The historical document prediction loss can be expressed as the following formula 7.
[0151]
[0152] in, represents the historical document prediction loss, f(·) represents the scoring function, D represents the set of all historical documents, express Belongs to set D but not d t (Right now represents negative sampling history document).
[0153] The above scoring function can be expressed by the following formula 8.
[0154]
[0155] in, represents the sequence-level representation of the historical document predicted by the t-th historical document position in the historical information sequence, W HDP ∈R d*d represents the parameter matrix to be learned, represents the word vector of the historical document dt, and σ represents the Softmax activation function.
[0156] 1-3. Current query prediction loss
[0157] The electronic device uses the historical information sequence H as the current query information qc The surrounding context And add mask q c , which can be expressed as Electronic devices will contextualize and mask q c As two different views, the current query prediction loss is obtained according to the preset loss algorithm.
[0158] The current query prediction loss can be expressed as the following formula 9.
[0159]
[0160] in, represents the current query prediction loss, f(·) represents the scoring function, Q H Represents a set of randomly selected query information (i.e., negative query samples).
[0161] The above scoring function can be expressed by the following formula 10.
[0162]
[0163] in, The sequence-level representation of the current query information to be predicted, W CQP ∈R d*d represents the parameter matrix to be learned, Indicates the current query information q c The word vector of , σ represents the Softmax activation function.
[0164] It is understandable that existing personalized search models usually directly connect historical queries and documents, and then reclassify user historical information into a sequence from left to right, thus ignoring the association between historical queries and the entire sequence. During the training process, the search model of the embodiment of the present application can observe the entire sequence of user historical information, and is inspired by the transformer-based bidirectional encoder representations from transformers (BERT) model, and uses the bidirectional information in the historical information sequence through the cloze task to enhance the representation of information.
[0165] S 802. The electronic device updates the search model based on minimizing the historical query prediction loss, the historical document prediction loss, and the current query prediction loss.
[0166] In a possible implementation, the electronic device minimizes the sum of the ranking loss and the historical query prediction loss, the historical document prediction loss, and the current query prediction loss (i.e., minimizes L total =Lrank +αL aux ), update the search model.
[0167] The above L rank represents the ranking loss, which can be expressed by the following formula 11.
[0168]
[0169] Among them, λ ij is the weight factor, indicating that candidate document d i and candidate document d j The degree of impact on sorting quality when exchanging positions, represents the true label, p ij represents the predicted probability (i.e., p(d i |,H)-p(d j |, H)).
[0170] It should be noted that the search model is trained using pairwise ranking loss. i and candidate document d j Among them, the candidate document d i is a set of candidate documents used by the user. Candidate document d j is a document that has not been used by the user, and the candidate document d i Than candidate document d j More in line with user interests.
[0171] The above L aux is the total loss of the aforementioned three auxiliary tasks (i.e., historical query prediction, historical document prediction, and current query prediction), which can be expressed by the following formula 12.
[0172] L aux =z 1 L HQP +z 2 L HDP +z 3 L CQP Formula 12
[0173] Among them, z 1 、z 2 , and z 3 represents the hyperparameters that control the weights.
[0174] It can be understood that by minimizing the sum of the ranking loss and the historical query prediction loss, the historical document prediction loss, and the current query prediction loss, updating the parameters of the search model can improve the accuracy of the model, and thus the order of recommending candidate documents to users is more accurate.
[0175] It is understandable that the above-mentioned document recommendation method can be implemented by a document recommendation device. In order to realize the above-mentioned functions, the document recommendation device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the modules and algorithm steps of each example described in the embodiments disclosed herein, the embodiments disclosed in the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments disclosed in this application.
[0176] The embodiment disclosed in the present application can divide the functional modules of the document recommendation device generated by the above method example. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment disclosed in the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0177] Fig.10 A schematic diagram of the structure of a document recommendation device provided in an embodiment of the present application. Fig.10 As shown, the document recommendation device 100 can be used to perform Figure 3-Figure 9 The document recommendation method shown in the figure. The document recommendation device 100 includes: a communication unit 1001 and a processing unit 1002.
[0178] Communication unit 1001 is used to obtain the user's current query information; communication unit 1001 is also used to obtain multiple historical query results of the user, and the historical query results include historical documents that match the user's historical query information and are used by the user; processing unit 1002 is used to determine candidate documents that match the current query information; processing unit 1002 is also used to determine a historical information sequence based on the historical query information and information of the historical documents, and the historical information sequence is used to represent the association relationship between multiple historical query results; processing unit 1002 is also used to determine the order of recommending candidate documents to the user based on the historical information sequence.
[0179] In one possible implementation, processing unit 1002 is further used to determine the degree of match between current query information and candidate documents based on a historical information sequence; processing unit 1002 is further used to determine the order of recommending candidate documents to the user based on the degree of match; wherein the degree of match is proportional to the order of the candidate documents.
[0180] In one possible implementation, processing unit 1002 is further used to input current query information and a historical information sequence into a search model to determine a current query vector corresponding to the current query information; processing unit 1002 is further used to input candidate documents and a historical information sequence into a search model to determine a candidate document vector corresponding to the candidate document; processing unit 1002 is further used to determine the degree of match between the current query information and the candidate document based on the current query information, the candidate document, the current query vector, and the candidate document vector.
[0181] In one possible implementation, processing unit 1002 is further used to determine a first relevance score of the candidate document based on the similarity between the current query information and the candidate document; processing unit 1002 is further used to determine a second relevance score of the candidate document based on the similarity between the current query vector and the candidate document vector; processing unit 1002 is further used to determine a degree of match between the current query information and the candidate document based on the first relevance score and the second relevance score.
[0182] In a possible implementation, the processing unit 1002 is further configured to determine a first relevance score of the candidate document based on a cosine similarity between the current query information and the candidate document and a cosine similarity between a word vector of the current query information and a word vector of the candidate document.
[0183] In a possible implementation, the processing unit 1002 is further configured to input the historical query information and the historical document information into the search model to determine the historical information sequence.
[0184] In one possible implementation, processing unit 1002 is also used to determine historical query prediction loss, historical document prediction loss, and current query prediction loss based on historical information sequence and preset loss algorithm; processing unit 1002 is also used to update the search model based on minimizing historical query prediction loss, historical document prediction loss, and current query prediction loss.
[0185] In one possible implementation, the search model includes a word-level context encoder and a sequence-level context encoder.
[0186] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0187] The present disclosure also provides a computer-readable storage medium having instructions stored thereon. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the document recommendation method provided by the above-mentioned embodiment of the present disclosure.
[0188] The embodiments of the present disclosure also provide a computer program product including instructions, which, when executed on an electronic device, enables the electronic device to execute the document recommendation method provided by the embodiments of the present disclosure.
[0189] Among them, the computer readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a register, a hard disk, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above, or any other form of computer readable storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application-specific integrated circuit (ASIC). In the embodiments of the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program, which may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0190] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A document recommendation method, characterized in that: The method comprises: Obtaining the user's current query information and determining candidate documents matching the current query information; Acquire multiple historical query results of the user, wherein the historical query results include historical documents that match the historical query information of the user and are used by the user; Determine a historical information sequence based on the historical query information and the information of the historical document, wherein the historical information sequence is used to represent the association relationship between the multiple historical query results; Based on the historical information sequence, an order of recommending the candidate documents to the user is determined.
2. The method according to claim 1, characterized in that The determining, based on the historical information sequence, the order of recommending the candidate documents to the user comprises: Based on the historical information sequence, determining a matching degree between the current query information and the candidate document; Based on the matching degree, the order of recommending the candidate documents to the user is determined; wherein the matching degree is proportional to the order of the candidate documents.
3. The method according to claim 2, characterized in that The determining, based on the historical information sequence, the degree of match between the current query information and the candidate document comprises: Inputting the current query information and the historical information sequence into a search model to determine a current query vector corresponding to the current query information; Inputting the candidate document and the historical information sequence into the search model to determine a candidate document vector corresponding to the candidate document; A matching degree between the current query information and the candidate document is determined based on the current query information, the candidate document, the current query vector, and the candidate document vector.
4. The method according to claim 3, characterized in that The determining, based on the current query information, the candidate document, the current query vector, and the candidate document vector, a matching degree between the current query information and the candidate document includes: Determining a first relevance score of the candidate document based on a similarity between the current query information and the candidate document; Determining a second relevance score for the candidate document based on a similarity between the current query vector and the candidate document vector; Based on the first relevance score and the second relevance score, a matching degree between the current query information and the candidate document is determined.
5. The method according to claim 4, characterized in that The determining, based on the similarity between the current query information and the candidate document, a first relevance score of the candidate document comprises: Based on the cosine similarity between the current query information and the candidate document and the cosine similarity between the word vector of the current query information and the word vector of the candidate document, a first relevance score of the candidate document is determined.
6. The method according to claim 1, characterized in that The determining of the historical information sequence based on the historical query information and the information of the historical document includes: The historical query information and the historical document information are input into a search model to determine the historical information sequence.
7. The method according to claim 1, characterized in that The method further comprises: Based on the historical information sequence and a preset loss algorithm, determine a historical query prediction loss, a historical document prediction loss, and a current query prediction loss; The search model is updated based on minimizing the historical query prediction loss, the historical document prediction loss, and the current query prediction loss.
8. The method according to claim 3, 6 or 7, characterized in that: The search model includes a word-level context encoder and a sequence-level context encoder.
9. A document recommendation device, characterized in that: The device comprises: a communication unit and a processing unit; The communication unit is used to obtain the user's current query information; The communication unit is further used to obtain a plurality of historical query results of the user, wherein the historical query results include historical documents that match the historical query information of the user and are used by the user; The processing unit is used to determine candidate documents matching the current query information; The processing unit is further used to determine a historical information sequence based on the historical query information and the information of the historical documents, wherein the historical information sequence is used to represent the association relationship between the multiple historical query results; The processing unit is further configured to determine an order of recommending the candidate documents to the user based on the historical information sequence.
10. A document recommendation device, characterized in that: include: Memory and processor; The memory is coupled to the processor; The memory is used to store instructions executable by the processor; When the processor executes the instructions, the document recommendation method as described in any one of claims 1-8 is performed.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is enabled to execute the document recommendation method as described in any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises computer program instructions, and when the computer program instructions are executed by a processor, the document recommendation method as claimed in any one of claims 1 to 8 is implemented.