Semantic recall model training method and device and storage medium thereof
By introducing loss functions and event extraction tasks into the semantic recall model, the semantic drift problem is solved, and the accuracy and efficiency of time-sensitive semantic recall is improved, ensuring that the model focuses on key information of events.
Patent Information
- Application Number
- CN202410199248.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-21
- Publication Date
- 2025-08-26
AI Technical Summary
The existing semantic recall methods have semantic drift problems in time-efficient scenarios, and cannot effectively pay attention to the key information of the event, resulting in poor recall results.
By introducing a semantic recall model, the loss function is used to strengthen the encoder's attention to events, combined with event extraction tasks and generation tasks, the training process of semantic encoder and decoder is optimized, and the model's attention to events is improved.
It improves the accuracy and efficiency of time-sensitive semantic recall, can better focus on key information of the event, and improves the recall effect.
Smart Images

Figure CN120541196A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a training method and device for a semantic recall model and a computer storage medium thereof. Background Art
[0002] Semantic recall aims to address the problem of document recall failure due to text mismatches by semantically calculating the correlation between the query text and the title text of the recalled document. Existing methods primarily involve a twin-tower encoder, which encodes the query text and the title text of the recalled document into two vectors and then calculates similarity.
[0003] However, existing methods still face a serious "semantic drift" problem in practical applications. This means that the semantics encoded by the model deviate from the given context and lack attention to key information. In scenarios where timely semantic recall is critical, users tend to input shorter query text, typically keywords or phrases about the event, to quickly retrieve event information. On the other hand, the same event is often expressed in multiple ways online, including from various media outlets and self-media. This information asymmetry complicates the real-time recall of event documents. Summary of the Invention
[0004] In view of this, the embodiments of the present application provide a training method, device and storage medium for a semantic recall model, which can improve the generation task of title events, strengthen the encoder's attention to events through the loss function, and improve the timeliness of recall effects.
[0005] According to a first aspect of the present application, a method for training a semantic recall model is provided, the method comprising: obtaining a training sample set, the training sample set comprising a plurality of sample pairs and their sample labels, each sample pair comprising a query text and a title text of a document to be recalled corresponding to the query text, the sample label of each sample pair indicating the relevance between the query text and the title text in the sample pair; for each sample pair in the training sample set, inputting the query text and the title text into a first semantic encoder and a second semantic encoder of the semantic recall model, respectively, to obtain a first semantic vector corresponding to the query text and a second semantic vector corresponding to the title text; for each sample pair in the training sample set, A method for extracting a predicted event text of a document to be recalled corresponding to the query text is proposed. The method comprises the following steps: extracting a third semantic vector of the predicted event text of the document to be recalled corresponding to the query text for each sample pair in the training sample set; determining a first loss based on the first semantic vector and the third semantic vector corresponding to each sample pair in the training sample set and the sample label, the first loss including the first contrast loss; determining a target loss of the semantic recall model based on at least the first loss; and iteratively updating the parameters of the semantic recall model based on the target loss until a preset condition is met.
[0006] In some embodiments, the step of inputting at least the second semantic vector corresponding to the title text into the semantic decoder of the semantic recall model to obtain the predicted event text of the document to be recalled corresponding to the query text includes: generating a prompt information text corresponding to the title text of the document to be recalled; extracting a fourth semantic vector from the prompt information text; and inputting the second semantic vector and the fourth semantic vector into the semantic decoder of the semantic recall model to obtain the predicted event text of the document to be recalled corresponding to the query text.
[0007] In some embodiments, generating prompt information text corresponding to the title text of the document to be recalled from the title text of the document to be recalled includes: extracting event elements from the title text of the document to be recalled, the event elements including actions, people, time and categories involved in the document to be recalled; and determining the prompt information text based on the event elements.
[0008] In some embodiments, determining the target loss of the semantic recall model based at least on the first loss includes: extracting the event label corresponding to the document to be recalled from the title text for each sample pair in the training sample set; calculating the second loss based on the predicted event text and event label corresponding to each sample pair in the training sample set; and determining the target loss of the semantic recall model based on the first loss and the second loss.
[0009] In some embodiments, determining the target loss of the semantic recall model based at least on the first loss includes: calculating a third loss based on the first semantic vector, the second semantic vector, and the sample label corresponding to each sample pair in the training sample set; and determining the target loss of the semantic recall model based on the first loss and the third loss.
[0010] In some embodiments, determining the target loss of the semantic recall model based at least on the first loss includes: extracting the event label corresponding to the document to be recalled from the title text for each sample pair in the training sample set; calculating the second loss based on the predicted event text and event label corresponding to each sample pair in the training sample set; calculating the third loss based on the first semantic vector, second semantic vector and sample label corresponding to each sample pair in the training sample set; and determining the target loss of the semantic recall model based on the first loss, the second loss and the third loss.
[0011] In some embodiments, obtaining a training sample set includes: obtaining a positive sample pair, wherein the sample label of the positive sample pair indicates that the query text in the sample pair is related to the title text; and obtaining a negative sample pair, wherein the sample label of the negative sample pair indicates that the query text in the sample pair is not related to the title text.
[0012] In some embodiments, the third loss includes: a second contrastive loss for narrowing the distance between the query text and the title text in the positive sample pair and for widening the distance between the query text and the title text in the negative sample pair, and a pairing loss for learning the sequential relationship between the positive and negative sample pairs.
[0013] In some embodiments, obtaining negative sample pairs includes: performing data expansion on the training sample set through data enhancement to mine negative sample pairs, wherein the expansion includes one or more of entity replacement, random deletion, duplication, and token reordering.
[0014] According to the second aspect of the present application, a semantic recall method is provided, which includes: obtaining a first text and multiple second texts, the first text representing a query text, and the second text representing a title text of a document to be recalled; encoding the first text using a semantic recall model trained according to the method of the first aspect to obtain a first semantic vector; encoding the multiple second texts using the semantic recall model to obtain multiple second semantic vectors corresponding to the multiple second texts respectively; for each of the multiple second semantic vectors, calculating the similarity between the first semantic vector and the second semantic vector, and determining a recalled document from the multiple second texts based on the similarity between the first semantic vector and each second semantic vector.
[0015] According to a third aspect of the present application, a training device for a semantic recall model is provided, comprising: an acquisition module, configured so that the training sample set includes a plurality of sample pairs and their sample labels, each sample pair includes a query text and a title text of a document to be recalled corresponding to the query text, and the sample label of each sample pair indicates the relevance between the query text and the title text in the sample pair; a semantic encoding module, configured to input the query text and the title text into a first semantic encoder and a second semantic encoder of the semantic recall model for each sample pair in the training sample set, respectively, to obtain a first semantic vector corresponding to the query text and a second semantic vector corresponding to the title text; an event extraction module, configured to at least input the query text corresponding to the title text for each sample pair in the training sample set; The second semantic vector is input into the semantic decoder of the semantic recall model to obtain the predicted event text of the document to be recalled corresponding to the query text; the semantic vector extraction module is configured to extract the third semantic vector of the predicted event text of the document to be recalled corresponding to the query text for each sample pair in the training sample set; the first loss determination module is configured to determine the first loss based on the first semantic vector and the third semantic vector corresponding to each sample pair in the training sample set and the sample label, and the first loss includes the first contrast loss; the target loss determination module is configured to determine the target loss of the semantic recall model based on at least the first loss; the iteration module is configured to iteratively update the parameters of the semantic recall model based on the target loss until the preset conditions are met.
[0016] According to the fourth aspect of the present application, a semantic recall device is provided, comprising: an acquisition module configured to acquire a first text and multiple second texts, the first text representing a query text, and the second text representing a title text of a document to be recalled; a first encoding module configured to encode the first text using a semantic recall model trained according to the method described in the first aspect to obtain a first semantic vector; a second encoding module configured to encode the multiple second texts using the semantic recall model to obtain multiple second semantic vectors corresponding to the multiple second texts respectively; a similarity calculation module configured to calculate the similarity between the first semantic vector and the second semantic vector for each of the multiple second semantic vectors; and a recall module configured to determine a recalled document from the multiple second texts based on the similarity between the first semantic vector and each second semantic vector.
[0017] According to the fifth aspect of the present application, a computing device is proposed, comprising: a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, it prompts the processor to execute a training method for a semantic recall model according to some embodiments of the present application.
[0018] According to a sixth aspect of the present application, a computer-readable storage medium is proposed, on which computer-readable instructions are stored. When the computer-readable instructions are executed, the training method of the semantic recall model according to some embodiments of the present application is implemented.
[0019] According to a seventh aspect of the present application, a computer program product is proposed, comprising a computer program, which, when executed by a processor, implements a training method for a semantic recall model according to some embodiments of the present application.
[0020] The training method, device and storage medium of the semantic recall model provided in the embodiments of the present application include at least the following beneficial effects: the event extraction task is integrated into the semantic recall task, which solves the problem of "semantic drift" in timeliness scenarios; based on the double-tower model, a generation task for title text events is introduced, and at the same time, by calculating the contrast loss between the semantic vector of the query text and the semantic vector of the predicted event text, the model is prompted to focus on the key information of the event, effectively improving the timeliness semantic recall effect.
[0021] These and other aspects of the application will be apparent from and elucidated with reference to the embodiments described hereinafter. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Further details, features and advantages of the present application are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0023] Figure 1 is a schematic diagram of an exemplary implementation environment provided by an exemplary embodiment of the present application;
[0024] Figure 2 is a schematic diagram of the first scheme for semantic recall in the related art;
[0025] Figure 3a -b is a schematic diagram of the second scheme for semantic recall in the related art;
[0026] Figure 4 This is a schematic diagram of the user query interface in a time-sensitive scenario;
[0027] Figure 5 This is a schematic diagram of the orchestration architecture of an embodiment of the present application during the training phase;
[0028] Figure 6 This is a schematic diagram of the orchestration architecture of the embodiment of the present application in the reasoning stage;
[0029] Figure 7 2 is a schematic diagram of calculating the first loss based on the <query, event> vector in the embodiment of the present application during the training phase;
[0030] Figure 8 2 is a schematic diagram of calculating the second loss based on the <title, event> vector in an embodiment of the present application during the training phase;
[0031] Figure 9 2 is a schematic diagram of calculating the third loss based on the <query, title> vector in an embodiment of the present application during the training phase;
[0032] Figure 10 This is a flow chart of a method for training a semantic recall model according to an embodiment of the present application;
[0033] Figure 11 is a flowchart of a semantic recall method according to an embodiment of the present application;
[0034] Figure 12 This is a block diagram of a training device for a semantic recall model provided by one embodiment of the present application;
[0035] Figure 13 is a block diagram of a semantic recall device provided by one embodiment of the present application;
[0036] Figure 14 is an example block diagram of a computing device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0037] The following will provide a clear and complete description of the technical solutions in this application in conjunction with the accompanying drawings. The embodiments described are only some of the embodiments of this application, not all of them. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.
[0038] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, as well as machine learning / deep learning, autonomous driving, smart transportation, and automated control.
[0039] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and active learning.
[0040] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, Internet of Vehicles, automatic driving, smart transportation, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0041] Before introducing the embodiments of the present application in detail, some related concepts are first explained.
[0042] 1. Semantic recall: This method uses semantic calculations to determine the relevance between query text and documents, solving the problem of document recall failure due to text mismatches.
[0043] 2. Time-sensitive search: Time-sensitive search refers to finding content available online within a predefined timeframe. This predefined timeframe could be, for example, the last five seconds. Available content could be, for example, a blog post that took an author five hours to write and was published within the last five seconds. In a sense, time-sensitive search finds the correct answer to a query based on currently available information. Time-sensitive search finds the correct answer immediately.
[0044] 3. Event Enhancement: This method builds on the traditional dual-decoder model based on embedding search, which utilizes query and title pairs. To address information asymmetry between query and title pairs and redundant noise in titles, a decoder structure is introduced outside the title encoder. The decoder encodes title information, allowing the title encoder to focus more on event information.
[0045] This application can be applied to scenarios such as search engines. For example, in search systems for time-sensitive scenarios such as news and self-media information, the solution of this application can help the search system recall more relevant documents to enhance the user's search experience. This application can also be applied to the organization of hot data. In a system that summarizes and organizes news topics, this solution can be used to find documents related to news topics more quickly through keyword queries, reducing the cost of manual searches.
[0046] Figure 1 A schematic diagram of an exemplary scenario 100 provided according to an exemplary embodiment of the present application is schematically shown.
[0047] like Figure 1 As shown in , scenario 100 includes a computing device 101. The semantic recall model provided by the embodiments of the present disclosure can be deployed on computing device 101. The semantic recall model includes at least a deep learning model trained using training samples. Computing device 101 may include, but is not limited to, a mobile phone, a computer, an intelligent voice interaction device, a smart home appliance, an in-vehicle terminal, an aircraft, and the like. The embodiments of the present disclosure can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, and the like.
[0048] For example, user 102 may use a document recall service for a document and / or a document title through computing device 101. For example, user 102 may input an instruction through a user interface provided by computing device 101, such as through a related physical or virtual key, through text, voice, or gesture instruction, so as to start a document recall service deployed on computing device 101 and / or server 103.
[0049] Scenario 100 may further include a server 103. Optionally, the recall model training method provided in the embodiments of the present disclosure may also be deployed on the server 103. Alternatively, the recall model training method provided in the embodiments of the present disclosure may also be deployed on a combination of the computing device 101 and the server 103. The present disclosure is not specifically limited in this regard. For example, user 102 may access server 103 via network 105 through computing device 101 to obtain the services provided by server 103.
[0050] Server 103 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Furthermore, it should be understood that server 103 is shown only as an example, and in practice, other devices or combinations of devices with computing and storage capabilities may be used instead or in addition to provide the corresponding services.
[0051] Optionally, the computing device 101 and / or the server 103 can be linked to the database 104 via the network 105, so as to obtain, for example, relevant data of the training samples from the database 104. Exemplarily, the database 104 can be an independent data storage device or device group, or it can also be a back-end data storage device or device group related to other online services. The method for completing the knowledge graph proposed in this article can be applied to applications such as vector graphics editing software, vector drawing applications, image processing software, etc. The semantic recall model is a deep learning model that runs in the above-mentioned applications in the form of a plug-in. When using the above-mentioned applications such as vector graphics editing software, vector drawing applications, image processing software, etc., the user can call the deep learning model through the user interface of the application. For example, the user enters the requirement description information in the requirement input box of the above-mentioned application, and calls the text generation model plug-in in the application based on the requirement description information; obtains the document and / or document title generated by the text generation model plug-in based on the requirement description information.
[0052] In addition, in the present disclosure, the network 105 can be a wired network connected via cables, optical fibers, etc., or a wireless network such as 2G, 3G, 4G, 5G, Wi-Fi, Bluetooth, ZigBee, Li-Fi, etc., or an internal connection line of one or several devices, etc.
[0053] Semantic recall aims to solve the problem of document recall failure due to text mismatches by calculating the relevance between the query text and the document. Existing algorithms for time-sensitive semantic recall primarily include the twin-tower encoder. In this encoder, the query text and document are encoded into two vectors, and similarity is calculated. Two main existing approaches include:
[0054] Figure 2This is a schematic diagram of DSSM (Deep Structured Semantic Models), the first solution for semantic recall in related technologies. DSSM typically uses a bag-of-words model or an N-gram model to convert preprocessed text into a high-dimensional sparse vector. Subsequently, the high-dimensional sparse vector is mapped to a low-dimensional dense vector through one or more deep neural network layers DNN (Deep Neural Network), and the similarity between the query text and the semantic vector is calculated using a similarity measurement method. One of the key features of DSSM is its training process. The DSSM model is typically trained using a large number of query text-title text pairs. These query text-title text pairs contain positive samples (the query text in the sample pair is related to the title text) and negative samples (the query text in the sample pair is unrelated to the title text). In this way, DSSM learns how to distinguish between relevant and irrelevant sample pairs, thereby improving the model's distinguishing ability.
[0055] Figure 3a -b are schematic diagrams of the training and reasoning of SBERT, the second solution for semantic recall in related technologies. The core idea of SBERT (Sentence-BERT) is to generate sentence vectors with high semantic information by making specific adjustments to the pre-trained BERT (Bidirectional Encoder Representations from Transformers). Its structure includes two parallel BERT encoders, which encode the input sentences respectively. The semantic similarity of these two vector representations is then calculated. In order to train the model to better capture the semantic similarity between sentences, SBERT adopts a training strategy of a twin Siamese network structure. The advantage of SBERT is that it uses the BERT pre-training model. Compared with the DSSM model, it has a strong semantic representation ability and better semantic recall effect.
[0056] While SBERT, a solution based on pre-trained models, offers advantages, it has been found in practical applications to still suffer from a serious "semantic drift" problem. This is because the semantics encoded by the model deviate from the given context and lack focus on key information.
[0057] Figure 4This is a schematic diagram of the user query interface in a time-sensitive scenario. Events often correspond to multiple queries and documents. Most queries are precise, focusing on key information about the event and often containing abbreviations, omissions, and grammatical irregularities. For example, queries omit brand names and are case-insensitive. The titles of the documents being retrieved are longer than the query text, contain redundant information, and employ a variety of expression styles. Furthermore, document titles may exhibit unconventional grammar, such as missing a subject or including punctuation. In time-sensitive scenarios, users tend to enter shorter queries, typically keywords or phrases about the event, to quickly retrieve information about the event. On the other hand, documents on the internet that describe the same event often have multiple expression styles. This is especially true when considering documents from different media sources, even self-media. Furthermore, compared to the query text, the document text is longer and, even when considering only the title text, still contains a lot of unimportant information.
[0058] Figure 5 Schematic diagram of the arrangement architecture of the embodiment of the present application during the training phase. The training portion inputs query text 501 and title text 502. The query text 501 is passed through a first semantic encoder 503 to obtain a first semantic vector 504, the title 502 is passed through a second semantic encoder 505 to obtain a second semantic vector 506, and a decoder 507 to obtain a third semantic vector 508. The <query, event> vector, the <title, event> vector, and the <query, title> vector are optimized using a first loss 509, a second loss 510, and a third loss 511, respectively. The first loss may include a contrast loss, the second loss may include a sequence-to-sequence loss, and the third loss may include a contrast loss and a ternary loss.
[0059] Figure 6 In the inference stage, the query text 601 and the title text 602 are input, and after encoding, two vectors are obtained to represent the first semantic vector 603 and the second semantic vector 604, and similarity 605 is calculated.
[0060] Figure 7 This is a schematic diagram of calculating the first loss based on the <query, event> vector in an embodiment of the present application during the training phase. Figure 7 This method embodies interactive learning between query text and events. During the training phase, a training sample set is obtained, comprising multiple sample pairs and their sample labels. Each sample label indicates the relevance between the query text and the title text in that sample pair. Specifically, positive sample pairs are obtained, whose sample labels indicate that the query text in that sample pair is relevant to the title text; and negative sample pairs are obtained, whose sample labels indicate that the query text in that sample pair is irrelevant to the title text.
[0061] For each sample pair in the training sample set, the query text and the title text are input into the first semantic encoder and the second semantic encoder of the semantic recall model respectively to obtain the first semantic vector corresponding to the query text and the second semantic vector corresponding to the title text. For each sample pair in the training sample set, at least the second semantic vector corresponding to the title text is input into the semantic decoder of the semantic recall model to extract the predicted event text to be recalled corresponding to the query text. Next, the third semantic vector of the predicted event text of the document to be recalled corresponding to the query text is extracted. The first loss is determined based on the first semantic vector and the third semantic vector corresponding to each sample pair in the training sample set and the sample label. As Figure 7 As shown in the dashed box, the third semantic vector decoded by the decoder is used as the vector representation of the generated event. A supervised contrast loss is calculated with the first semantic vector of the query text as the first loss. This strengthens the query text's focus on the event.
[0062] Figure 8 This is a schematic diagram of calculating the second loss based on the <title, event> vector in an embodiment of the present application during the training phase. Figure 8 This reflects the interactive learning between the title and the event. The part in the dotted box reflects the training process of the <title, event> pair. Here, a decoder structure is added to generate event information. In one embodiment, the event in the title text is extracted as the standard answer of the event through the seq2seq_mrc model, that is, Figure 8 The golden event in the query text is subjected to a second loss learning on the golden event and the predicted event text to be recalled corresponding to the query text extracted by the decoder. In a preferred embodiment, the second loss includes a sequence-to-sequence loss (seq2seq loss).
[0063] In another embodiment, when using the decoder to extract the predicted event text to be recalled corresponding to the query text, a prompt guidance learning technology can also be added. Figure 8The event extractor in is extracted. Specifically, a prompt information text corresponding to the title text of the document to be recalled is generated from the title text of the document to be recalled; and a fourth semantic vector is extracted based on the prompt information text. The second semantic vector and the fourth semantic vector are jointly input into the semantic decoder of the semantic recall model to generate the predicted event text of the document to be recalled corresponding to the query text. In another example, the prompt information is generated in the following manner: the event elements of the event text of the document to be recalled are extracted from the title text of the document to be recalled, and the event elements include the actions, characters, time and categories involved in the event. Then, the prompt information text is determined based on the event elements and the predetermined prompt information template. An example of a predetermined prompt information template may be: "In [X], the trigger is [MASK1], and the topic is [MASK2].", where [X] is the text of the title, MASK1 may be a verb, and MASK2 is a topic category. Thus, by utilizing the prompt information text to assist in event extraction, it is ensured that important information will not be overlooked.
[0064] Figure 9 This is a schematic diagram of calculating the third loss based on the <query, title> vector in an embodiment of the present application during the training phase. Figure 9 It embodies the interactive learning between the query text and the title text. For each sample pair in the training sample set, the query text and the title text are respectively input into the first semantic encoder and the second semantic encoder of the semantic recall model to obtain the first semantic vector corresponding to the query text and the second semantic vector corresponding to the title text. For each sample pair in the training sample set, the third loss is calculated based on the first semantic vector, the second semantic vector and the sample label. In one embodiment, the third loss includes a second contrast loss and a pairing loss. The second contrast loss is used to narrow the distance between the query text and the title text in the positive sample pair and to push the distance between the query text and the title text in the negative sample pair away; the pairing loss is used to learn the sequential relationship between the positive and negative sample pairs.
[0065] In one embodiment, before calculating the third loss for each sample pair in the training sample set, hard negative sample mining is first performed. The training sample set is augmented by data enhancement to mine negative sample pairs, wherein the augmentation includes one or more of entity replacement, random deletion, duplication, and token reordering.
[0066] Figure 10It is a flowchart of a training method 1000 for a semantic recall model according to an embodiment of the present application. In step S1010, a training sample set is obtained, wherein the training sample set includes a plurality of sample pairs and their sample labels, each sample pair includes a query text and a title text of a document to be recalled corresponding to the query text, and the sample label of each sample pair indicates the correlation between the query text and the title text in the sample pair. In one embodiment, obtaining a training sample set includes: obtaining a positive sample pair, wherein the sample label of the positive sample pair indicates that the query text in the sample pair is correlated with the title text; and obtaining a negative sample pair, wherein the sample label of the negative sample pair indicates that the query text in the sample pair is not correlated with the title text. In order to enhance the recall capability of the semantic recall model, in one embodiment, difficult sample mining is first performed. For example, the training sample set is augmented with data using EDA (Easy Data Augmentation) data augmentation technology to mine negative sample pairs. Augmentation includes one or more of entity replacement, random deletion, duplication, and token reordering.
[0067] In step S1020, for each sample pair in the training sample set, the query text and the title text are respectively input into the first semantic encoder and the second semantic encoder of the semantic recall model to obtain a first semantic vector corresponding to the query text and a second semantic vector corresponding to the title text.
[0068] In step S1030, for each sample pair in the training sample set, at least the second semantic vector corresponding to the title text is input into the semantic decoder of the semantic recall model to obtain the predicted event text of the document to be recalled corresponding to the query text.
[0069] In one embodiment, a prompt information text corresponding to the title text of the document to be recalled is generated; a fourth semantic vector is extracted from the prompt information text; and the second semantic vector and the fourth semantic vector are input into a semantic decoder of a semantic recall model to obtain a predicted event text of the document to be recalled corresponding to the query text.
[0070] In another embodiment, when using a decoder to extract the predicted event text corresponding to the query text, a prompt guidance learning technique may also be incorporated. This prompt guidance is extracted using an event extractor. Specifically, a prompt information text corresponding to the title text of the document to be recalled is generated from the title text of the document to be recalled; a fourth semantic vector is extracted based on the prompt information text. The second and fourth semantic vectors are input into a semantic decoder of a semantic recall model to generate the predicted event text of the document to be recalled corresponding to the query text. In another example, the prompt information text is generated by extracting event elements from the title text of the document to be recalled, wherein the event elements include the action, person, time, and category involved in the document to be recalled; and determining the prompt information text based on the event elements. The prompt information text is then determined based on the event elements and a predetermined prompt information template. An example of a predetermined prompt information template may be: "In [X], the trigger is [MASK1], and the topic is [MASK2]," where [X] is the text of the title, MASK1 can be a verb, and MASK2 is the topic category. Therefore, by using prompt information text to assist event extraction, it is ensured that important information will not be overlooked.
[0071] In step S1040, for each sample pair in the training sample set, a third semantic vector of the predicted event text of the to-be-recalled document corresponding to the query text is extracted. To facilitate interactive learning between the query text and the predicted event text, the predicted event text must first be converted into a semantic vector form that is consistent with the first semantic vector form. Here, the third semantic vector of the predicted event text of the to-be-recalled document corresponding to the query text is extracted using an embedding layer.
[0072] In step S1050, a first loss is determined based on the first semantic vector and the third semantic vector corresponding to each sample pair in the training sample set and the sample label. The first loss includes a first contrastive loss. The first loss is used for interactive learning between the query text and the event text.
[0073] In step S1060 , a target loss of the semantic recall model is determined based on at least the first loss.
[0074] In one embodiment, the target loss also includes a second loss. Specifically, for each sample pair in the training sample set, the event label corresponding to the document to be recalled is extracted from the title text; the second loss is calculated based on the predicted event text and event label corresponding to each sample pair in the training sample set; and the target loss of the semantic recall model is determined based on the first loss and the second loss.
[0075] In another embodiment, the target loss further includes a third loss. Specifically, determining the target loss of the semantic recall model based at least on the first loss includes: calculating the third loss based on the first semantic vector, the second semantic vector, and the sample label corresponding to each sample pair in the training sample set; and determining the target loss of the semantic recall model based on the first loss and the third loss.
[0076] In a preferred embodiment, the third loss includes a second contrastive loss and / or a pairing loss. The second contrastive loss is used to reduce the distance between the query text and the title text in the positive sample pair and to increase the distance between the query text and the title text in the negative sample pair. The pairing loss is used to learn the order relationship between the positive and negative sample pairs.
[0077] In another embodiment, the target loss includes a second loss and a third loss. Determining the target loss of the semantic recall model based at least on the first loss includes: extracting the event label corresponding to the document to be recalled from the title text for each sample pair in the training sample set; calculating the second loss based on the predicted event text and event label corresponding to each sample pair in the training sample set; calculating the third loss based on the first semantic vector, the second semantic vector and the sample label corresponding to each sample pair in the training sample set; determining the target loss of the semantic recall model based on the first loss, the second loss and the third loss
[0078] In step S1070, the parameters of the semantic recall model are iteratively updated based on the target loss until a preset condition is satisfied. Specifically, iteration is stopped when the target loss satisfies a predetermined condition, which may be when the target loss is less than a predetermined threshold or when the number of training iterations reaches a predetermined number.
[0079] In another embodiment, the target loss also includes a second loss and a third loss. Specifically, for each sample pair in the training sample set, the event label corresponding to the document to be recalled is extracted from the title text; the second loss is calculated based on the event text and the event label; the third loss is calculated based on the first semantic vector, the second semantic vector, and the sample label; and the target loss of the semantic recall model is determined based on at least the first loss, the second loss, and the third loss.
[0080] The training method, device and storage medium of the semantic recall model provided in the embodiments of the present application include at least the following beneficial effects: the event extraction task is integrated into the semantic recall task, which solves the problem of "semantic drift" in timeliness scenarios; based on the double-tower model, a generation task for title text events is introduced, and at the same time, by calculating the contrast loss between the semantic vector of the query text and the semantic vector of the predicted event text, the model is prompted to focus on the key information of the event, effectively improving the timeliness semantic recall effect.
[0081] Figure 11This is a flowchart of a semantic recall method 1100 of an embodiment of the present application. The present application can be applied to scenarios such as search engines. For example, in a search system for time-sensitive scenarios such as news and self-media information, the solution of the present application can promote the search system to recall more relevant documents to enhance the user's search experience. The present application can be applied to the collation of hot data. In a system for summarizing and collating news topics, the solution can be used to find documents related to news topics more quickly through keyword queries, reducing the cost of manual search.
[0082] In step S1110 , a first text and a plurality of second texts are obtained, where the first text represents the query text and the second text represents the title texts of the documents to be recalled.
[0083] In step S1120 , the first text is encoded using a semantic recall model to obtain a first semantic vector, wherein the semantic recall model is trained using method 1000 .
[0084] In step S1130 , the plurality of second texts are encoded using a semantic recall model to obtain a plurality of second semantic vectors respectively corresponding to the plurality of second texts.
[0085] In step S1140, for each of the plurality of second semantic vectors, the similarity between the first semantic vector and the second semantic vector is calculated, and in step S1150, based on the similarity between the first semantic vector and each of the second semantic vectors, a recalled document is determined from the plurality of second texts.
[0086] The semantic recall method, device and storage medium provided by the embodiments of the present application include at least the following beneficial effects: the event extraction task is integrated into the semantic recall task, which solves the problem of "semantic drift" in timeliness scenarios; based on the double-tower model, a generation task for title text events is introduced, and at the same time, by calculating the contrast loss between the semantic vector of the query text and the semantic vector of the predicted event text, the model is prompted to focus on the key information of the event, effectively improving the timeliness semantic recall effect.
[0087] Figure 12A block diagram of a training device 1200 for a semantic recall model provided by an embodiment of the present application is shown. A training device for a semantic recall model includes: an acquisition module 1210, configured to train a sample set including a plurality of sample pairs and their sample labels, each sample pair including a query text and a title text of a document to be recalled corresponding to the query text, and the sample label of each sample pair indicating the relevance between the query text and the title text in the sample pair; a semantic encoding module 1220, configured to input the query text and the title text into the first semantic encoder and the second semantic encoder of the semantic recall model for each sample pair in the training sample set, respectively, to obtain a first semantic vector corresponding to the query text and a second semantic vector corresponding to the title text; an event extraction module 1230, configured to input at least the second semantic vector corresponding to the title text into the first semantic encoder of the semantic recall model for each sample pair in the training sample set. to the semantic decoder of the semantic recall model to obtain the predicted event text of the document to be recalled corresponding to the query text; the semantic vector extraction module 1240 is configured to extract the third semantic vector of the predicted event text of the document to be recalled corresponding to the query text for each sample pair in the training sample set; the first loss determination module 1250 is configured to determine the first loss based on the first semantic vector and the third semantic vector corresponding to each sample pair in the training sample set and the sample label, the first loss including the first contrast loss; the target loss determination module 1260 is configured to determine the target loss of the semantic recall model based on at least the first loss; the iteration module 1270 is configured to iteratively update the parameters of the semantic recall model based on the target loss until the preset conditions are met.
[0088] It should be understood that the training device 1200 for the semantic recall model can be implemented in software, hardware, or a combination of software and hardware. Multiple different modules in the device can be implemented in the same software or hardware structure, or one module can be implemented by multiple different software or hardware structures.
[0089] Furthermore, the semantic recall model training apparatus 1200 can be used to implement the semantic recall model training method 1000 described above, the relevant details of which have been described in detail above and are not repeated here for the sake of brevity. Furthermore, these apparatuses can have the same features and advantages as those described for the corresponding methods.
[0090] Figure 13A block diagram of a semantic recall device 1300 provided by an embodiment of the present application is shown. An acquisition module 1310 is configured to acquire a first text and multiple second texts, where the first text represents a query text and the second text represents a title text of a document to be recalled; a first encoding module 1320 is configured to encode the first text using a semantic recall model trained according to method 1000 to obtain a first semantic vector; a second encoding module 1330 is configured to encode the multiple second texts using the semantic recall model to obtain multiple second semantic vectors corresponding to the multiple second texts; a similarity calculation module 1340 is configured to calculate the similarity between the first semantic vector and the second semantic vector for each of the multiple second semantic vectors; and a recall module 1350 is configured to determine a recalled document from the multiple second texts based on the similarity between the first semantic vector and each second semantic vector.
[0091] It should be understood that the semantic recall device 1300 can be implemented in software, hardware, or a combination of software and hardware. Multiple different modules in the device can be implemented in the same software or hardware structure, or one module can be implemented by multiple different software or hardware structures.
[0092] In addition, the semantic recall device 1300 can be used to implement the semantic recall model training method 1100 described above, the relevant details of which have been described in detail above and will not be repeated here for the sake of brevity. In addition, these devices can have the same features and advantages as those described for the corresponding methods.
[0093] Figure 14 An example system 1400 is illustrated, which includes an example computing device 1410 that represents one or more systems and / or devices that can implement the various methods described herein. The computing device 1410 can be, for example, a server of a service provider, a device associated with a server, a system on a chip, and / or any other suitable computing device or computing system. Figure 12-13 The described semantic recall model training apparatus 1200 and semantic recall apparatus 1300 may take the form of a computing device 1410. Alternatively, Figure 12-13 The described semantic recall model training apparatus 1200 and semantic recall apparatus 1300 may be implemented as a computer program in the form of an application 1416 .
[0094] The example computing device 1410 as shown includes a processing system 1411, one or more computer-readable media 1412, and one or more I / O interfaces 1413 that are communicatively coupled to each other. Although not shown, computing device 1410 may also include a system bus or other data and command transmission system that couples various components to each other. The system bus may include any one or a combination of different bus structures, such as a memory bus or memory controller, a peripheral bus, a universal serial bus, and / or a processor or local bus utilizing any one of a variety of bus architectures. Various other examples are also contemplated, such as control and data lines.
[0095] Processing system 1411 represents a function that performs one or more operations using hardware. Therefore, processing system 1411 is illustrated as including hardware elements 1414 that can be configured as processors, functional blocks, etc. This can include other logic devices implemented in hardware as application-specific integrated circuits or formed using one or more semiconductors. Hardware elements 1414 are not limited by the materials from which they are formed or the processing mechanisms employed therein. For example, a processor can be composed of (multiple) semiconductors and / or transistors (e.g., electronic integrated circuits (ICs)). In such a context, processor-executable instructions can be electronically executable instructions.
[0096] Computer-readable media 1412 is illustrated as including memory / storage 1415. Memory / storage 1415 represents memory / storage capacity associated with one or more computer-readable media. Memory / storage 1415 may include volatile media (such as random access memory (RAM)) and / or non-volatile media (such as read-only memory (ROM), flash memory, optical disks, magnetic disks, etc.). Memory / storage 1415 may include fixed media (e.g., RAM, ROM, fixed hard drives, etc.) and removable media (e.g., flash memory, removable hard drives, optical disks, etc.). Computer-readable media 1412 may be configured in various other ways, as further described below.
[0097] One or more I / O interfaces 1413 represent functionality that allows a user to input commands and information to the computing device 1410 using various input devices, and optionally also allows information to be presented to the user and / or other components or devices using various output devices. Examples of input devices include a keyboard, a cursor control device (e.g., a mouse), a microphone (e.g., for voice input), a scanner, touch functionality (e.g., a capacitive or other sensor configured to detect physical touch), a camera (e.g., that can detect motion that does not involve touch as gestures using visible or invisible wavelengths (such as infrared frequencies), etc.). Examples of output devices include a display device, a speaker, a printer, a network card, a tactile response device, etc. Thus, the computing device 1410 can be configured in various ways, as further described below, to support user interaction.
[0098] The computing device 1410 also includes an application 1416. The application 1416 may be, for example, a computer program that is used to Figure 12-13 The software instances of the semantic recall model training apparatus 1200 and the semantic recall apparatus 1300 described herein are provided and implemented in combination with other elements in a computing device 1410 to implement the techniques described herein.
[0099] The present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computing device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computing device to perform the methods for presenting visual data provided in the various optional implementations described above.
[0100] Various techniques may be described herein in the general context of software, hardware, or program modules. Generally, these modules include routines, programs, objects, elements, components, data structures, and the like that perform specific tasks or implement specific abstract data types. As used herein, the terms "module," "function," and "component" generally refer to software, firmware, hardware, or a combination thereof. The techniques described herein are platform-independent, meaning that these techniques can be implemented on a variety of computing platforms with a variety of processors.
[0101] An implementation of the described modules and techniques may be stored on or transmitted across some form of computer-readable media. Computer-readable media may include various media accessible by computing device 1410. By way of example and not limitation, computer-readable media may include "computer-readable storage media" and "computer-readable signal media."
[0102] As opposed to a mere signal transmission, carrier wave, or signal itself, "computer-readable storage medium" refers to a medium and / or device, and / or tangible storage device, capable of persistently storing information. Thus, computer-readable storage media refers to non-signal-bearing media. Computer-readable storage media include hardware such as volatile and non-volatile, removable and non-removable media and / or storage devices implemented in a method or technology suitable for storing information (such as computer-readable instructions, data structures, program modules, logic elements / circuits, or other data). Examples of computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical storage devices, hard disks, cassettes, magnetic tape, magnetic disk storage devices or other magnetic storage devices, or other storage devices, tangible media, or articles of manufacture suitable for storing desired information and accessible by a computer.
[0103] "Computer-readable signal media" refers to signal-bearing media that is configured to send instructions to the hardware of the computing device 1410, such as via a network. Signal media typically embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave, data signal, or other transport mechanism. Signal media also includes any information delivery media. The term "modulated data signal" refers to a signal that has one or more of its characteristics set or changed so as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct connection, and wireless media such as acoustic, RF, infrared, and other wireless media.
[0104] As before, hardware elements 1414 and computer-readable media 1412 represent instructions, modules, programmable device logic and / or fixed device logic implemented in hardware form, which in some embodiments can be used to implement at least some aspects of the technology described herein. Hardware elements can include other implementations in integrated circuits or systems on a chip, application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), complex programmable logic devices (CPLDs) and silicon or other hardware devices. In this context, hardware elements can be used as processing equipment for executing program tasks defined by the instructions, modules and / or logic embodied by the hardware elements, as well as hardware devices for storing instructions for execution, such as the computer-readable storage media described previously.
[0105] The aforementioned combination may also be used to implement various techniques and modules herein. Therefore, software, hardware or program modules and other program modules may be implemented as one or more instructions and / or logic embodied on some form of computer-readable storage medium and / or by one or more hardware elements 1414. Computing device 1410 may be configured to implement specific instructions and / or functions corresponding to software and / or hardware modules. Therefore, for example, by using a computer-readable storage medium and / or hardware elements 1414 of a processing system, a module may be implemented as a module that can be executed by computing device 1410 as software, at least in part, in hardware. Instructions and / or functions may be executable / operable to implement the techniques, modules, and examples herein by one or more articles of manufacture (e.g., one or more computing devices 1410 and / or processing systems 1411).
[0106] In various embodiments, computing device 1410 can be implemented in a variety of different configurations. For example, computing device 1410 can be implemented as a computer-type device including a personal computer, a desktop computer, a multi-screen computer, a laptop computer, a netbook, etc. Computing device 1410 can also be implemented as a mobile device-type device including mobile devices such as mobile phones, portable music players, portable gaming devices, tablet computers, multi-screen computers, etc. Computing device 1410 can also be implemented as a television-type device, which includes devices having or connected to generally larger screens in casual viewing environments. These devices include televisions, set-top boxes, game consoles, etc.
[0107] The techniques described herein can be supported by these various configurations of computing device 1410 and are not limited to the specific examples of the techniques described herein. Functionality can also be implemented in whole or in part on the "cloud" 1420 using a distributed system, such as through platform 1422 as described below.
[0108] Cloud 1420 includes and / or represents a platform 1422 for resources 1424. Platform 1422 is the underlying functionality of the hardware (e.g., servers) and software resources of cloud 1420. Resources 1424 may include applications and / or data that can be used when executing computer processing on servers remote from computing device 1410. Resources 1424 may also include services provided over the Internet and / or over a subscriber network such as a cellular or Wi-Fi network.
[0109] The platform 1422 can abstract resources and functionality to connect the computing device 1410 with other computing devices. The platform 1422 can also be used to abstract hierarchies of resources to provide a corresponding level of hierarchy in the demand encountered for resources 1424 implemented via the platform 1422. Thus, in an interconnected device embodiment, the implementation of the functionality described herein can be distributed throughout the system 1400. For example, functionality can be implemented partially on the computing device 1410 and through the platform 1422 that abstracts the functionality of the cloud 1420.
[0110] Should be understood that, for the sake of clarity, the embodiments of the present application are described with reference to different functional units. However, it will be apparent that, without departing from the present application, the functionality of each functional unit can be implemented in a single unit, implemented in multiple units or implemented as a part for other functional units. For example, the functionality that is described as being performed by a single unit can be performed by multiple different units. Therefore, reference to a specific functional unit is only considered as a reference to the appropriate unit for providing the described functionality, rather than indicating strict logical or physical structure or organization. Therefore, the application can be implemented in a single unit, or can be physically and functionally distributed between different units and circuits.
[0111] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0112] Although the present application has been described in conjunction with some embodiments, it is not intended to be limited to the specific forms set forth herein. On the contrary, the scope of the present application is limited only by the appended claims. Additionally, although individual features may be included in different claims, these may possibly be advantageously combined, and inclusion in different claims does not imply that a combination of features is not feasible and / or advantageous. The order of the features in the claims does not imply any specific order in which the features must work. Furthermore, in the claims, the word "comprising" does not exclude other elements, and the term "a" or "an" does not exclude a plurality. The reference numerals in the claims are provided merely as clear examples and should not be construed as limiting the scope of the claims in any way.
[0113] It is understood that in the specific implementation of this application, entity-related data such as entity default information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use, and processing of relevant data must comply with relevant laws, regulations, and standards of relevant countries and regions.
Claims
1. A method for training a semantic recall model, characterized in that: include: Obtaining a training sample set, the training sample set including a plurality of sample pairs and sample labels thereof, each sample pair including a query text and a title text of a document to be recalled corresponding to the query text, and the sample label of each sample pair indicating the relevance between the query text and the title text in the sample pair; For each sample pair in the training sample set, the query text and the title text are input into the first semantic encoder and the second semantic encoder of the semantic recall model respectively to obtain a first semantic vector corresponding to the query text and a second semantic vector corresponding to the title text; For each sample pair in the training sample set, at least the second semantic vector corresponding to the title text is input into the semantic decoder of the semantic recall model to obtain the predicted event text of the document to be recalled corresponding to the query text; For each sample pair in the training sample set, extracting a third semantic vector of the predicted event text of the document to be recalled corresponding to the query text; Determine a first loss based on the first semantic vector and the third semantic vector corresponding to each sample pair in the training sample set and the sample label, where the first loss includes a first contrast loss; determining a target loss for a semantic recall model based at least on the first loss; The parameters of the semantic recall model are iteratively updated based on the target loss until preset conditions are met.
2. The method according to claim 1, wherein Inputting at least the second semantic vector corresponding to the title text into the semantic decoder of the semantic recall model to obtain the predicted event text of the document to be recalled corresponding to the query text includes: Generate prompt information text corresponding to the title text of the document to be recalled; Extracting a fourth semantic vector from the prompt information text; The second semantic vector and the fourth semantic vector are input into a semantic decoder of a semantic recall model to obtain a predicted event text of the document to be recalled corresponding to the query text.
3. The method according to claim 2, wherein The prompt information text generated corresponding to the title text of the document to be recalled includes: Extracting event elements from the title text of the document to be recalled, wherein the event elements include actions, people, time and categories involved in the document to be recalled; The prompt information text is determined according to the event elements.
4. The method according to claim 1 or 2, wherein: Determining the target loss of the semantic recall model based at least on the first loss includes: For each sample pair in the training sample set, extract the event label corresponding to the document to be recalled from the title text; Calculating a second loss based on the predicted event text and event label corresponding to each sample pair in the training sample set; The target loss of the semantic recall model is determined based on the first loss and the second loss.
5. The method according to claim 1 or 2, wherein: Determining the target loss of the semantic recall model based at least on the first loss includes: Calculate the third loss based on the first semantic vector, the second semantic vector, and the sample label corresponding to each sample pair in the training sample set; The target loss of the semantic recall model is determined based on the first loss and the third loss.
6. The method according to claim 1 or 2, wherein: Determining the target loss of the semantic recall model based at least on the first loss includes: For each sample pair in the training sample set, extract the event label corresponding to the document to be recalled from the title text; Calculating a second loss based on the predicted event text and event label corresponding to each sample pair in the training sample set; Calculate the third loss based on the first semantic vector, the second semantic vector, and the sample label corresponding to each sample pair in the training sample set; The target loss of the semantic recall model is determined based on the first loss, the second loss, and the third loss.
7. The method according to claim 6, wherein The obtaining of the training sample set comprises: Obtaining a positive sample pair, wherein a sample label of the positive sample pair indicates that the query text in the sample pair is related to the title text; A negative sample pair is obtained, where the sample label of the negative sample pair indicates that the query text in the sample pair is irrelevant to the title text.
8. The method according to claim 7, wherein The third loss includes: a second contrastive loss for narrowing the distance between the query text and the title text in the positive pairs and for widening the distance between the query text and the title text in the negative pairs, and Paired loss for learning the sequential relationship between positive and negative sample pairs.
9. The method according to claim 7, wherein: The obtaining of negative sample pairs comprises: The training sample set is augmented by data enhancement to mine negative sample pairs, wherein the augmentation includes one or more of entity replacement, random deletion, duplication, and token reordering.
10. A semantic recall method, characterized in that: The method comprises: Obtain a first text and a plurality of second texts, wherein the first text represents the query text and the second text represents the title text of the document to be recalled; encoding the first text using a semantic recall model trained using the method according to any one of claims 1 to 9 to obtain a first semantic vector; Encoding the plurality of second texts using the semantic recall model to obtain a plurality of second semantic vectors respectively corresponding to the plurality of second texts; For each of the plurality of second semantic vectors, calculating the similarity between the first semantic vector and the second semantic vector, and Based on the similarity between the first semantic vector and each second semantic vector, a recalled document is determined from the plurality of second texts.
11. A training device for a semantic recall model, characterized in that: include: an acquisition module configured such that the training sample set includes a plurality of sample pairs and sample labels thereof, each sample pair including a query text and a title text of a document to be recalled corresponding to the query text, and the sample label of each sample pair indicates the relevance between the query text and the title text in the sample pair; a semantic encoding module configured to input the query text and the title text into a first semantic encoder and a second semantic encoder of the semantic recall model, respectively, for each sample pair in the training sample set, to obtain a first semantic vector corresponding to the query text and a second semantic vector corresponding to the title text; An event extraction module is configured to input, for each sample pair in the training sample set, at least a second semantic vector corresponding to the title text into a semantic decoder of a semantic recall model to obtain a predicted event text of a document to be recalled corresponding to the query text; a semantic vector extraction module configured to extract, for each sample pair in the training sample set, a third semantic vector of the predicted event text of the to-be-recalled document corresponding to the query text; A first loss determination module is configured to determine a first loss based on the first semantic vector and the third semantic vector corresponding to each sample pair in the training sample set and the sample label, where the first loss includes a first contrast loss; a target loss determination module configured to determine a target loss of the semantic recall model based at least on the first loss; The iteration module is configured to iteratively update the parameters of the semantic recall model based on the target loss until a preset condition is met.
12. A semantic recall device, characterized in that: include: An acquisition module is configured to acquire a first text and a plurality of second texts, wherein the first text represents the query text and the second text represents the title text of the document to be recalled; a first encoding module, configured to encode the first text using a semantic recall model trained according to any one of claims 1 to 9 to obtain a first semantic vector; a second encoding module configured to encode the plurality of second texts using the semantic recall model to obtain a plurality of second semantic vectors respectively corresponding to the plurality of second texts; a similarity calculation module configured to calculate the similarity between the first semantic vector and the second semantic vector for each of the plurality of second semantic vectors; and The recall module is configured to determine a recall document from the plurality of second texts based on a similarity between the first semantic vector and each second semantic vector.
13. A computing device, characterized in that include: a memory configured to store computer-executable instructions; A processor configured to perform the method according to any one of claims 1 to 10 when the computer executable instructions are executed by the processor.
14. A computer-readable storage medium, characterized in that It stores computer-executable instructions which, when executed, implement the method according to any one of claims 1 to 10.
15. A computer program product, characterized in that It comprises a computer program which, when executed, implements the steps of the method according to any one of claims 1 to 10.
Citation Information
Cited By
Cross-screen interactive advertisement effect evaluation system based on multi-modal agent driving
CN121120150A
Model training method, online recall retrieval method, electronic equipment and storage medium
CN121683935A