Entity search method, and fine tuning method, device and equipment of large language model

Through the entity search method and large language model fine-tuning method, combined with the dynamic correlation threshold selection of query words and entity representation vectors, the problem of insufficient efficiency and accuracy in entity search is solved, and high-quality entity search and large language model are achieved. Exact match.

CN118733633APending Publication Date: 2024-10-01BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Application Number
CN202410851081.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

It is difficult for existing technologies to effectively improve efficiency and accuracy in entity search. Especially in diversified vertical fields, the quality and coverage of entity search are insufficient, and the application of large language models in entity search has problems with knowledge integration and matching. .

Method used

An entity search method and a large language model fine-tuning method are proposed. By encoding the target query words and combining the predetermined entity representation vectors and virtual entity representation vectors to be processed, the correlation threshold is dynamically determined, and the matching target entities are selected. Fine-tune the large language model through the relevance of the annotated entities to improve the matching and generalization of the model.

Benefits of technology

It improves the efficiency and accuracy of entity search, adapts to the diversity of different vertical fields, improves the quality and coverage of entity search, and enhances the accuracy and generalization ability of large language models in entity processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733633A_ABST
    Figure CN118733633A_ABST
Patent Text Reader

Abstract

The invention provides an entity search method, a large language model fine tuning method and device and electronic equipment, relates to the technical fields of deep learning, natural language processing and the like, and can be applied to scenes such as intelligent search and the like. The entity search method comprises the following steps: encoding a target query word to obtain a target query vector; according to the target query vector and a predetermined representation vector of an entity to be processed, determining a representation vector of a candidate entity from the representation vector of the entity to be processed; according to the target query vector and the representation vector of the candidate entity, determining the relevancy of the candidate entity, and according to the target query vector and a predetermined representation vector of a virtual entity, determining a relevancy threshold value of a target query word; and selecting a matched target entity from the candidate entities according to the relevancy of the candidate entities and the relevancy threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the computer field, in particular to the field of artificial intelligence technology, deep learning, natural language processing and other technical fields, and can be applied to intelligent search scenarios. Specifically, it relates to an entity search method, a fine-tuning method of a large language model, a device and an apparatus. Background Art

[0002] A large language model (LLM) is a generative language model characterized by its large size, large number of parameters and training data. By using more parameters and larger data sets for training, its performance and sample efficiency on various downstream tasks are effectively improved.

[0003] In many search scenarios, entity search is of great interest. Large language models also rely on entity search technology to integrate knowledge that they do not cover. Therefore, the quality of entity search is very important. Summary of the invention

[0004] The present disclosure provides an entity search method, a fine-tuning method, an apparatus and a device for a large language model.

[0005] According to one aspect of the present disclosure, there is provided an entity search method, comprising:

[0006] Encode the target query word to obtain a target query vector;

[0007] Determining a representation vector of a candidate entity from the representation vectors of the entity to be processed according to the target query vector and a predetermined representation vector of the entity to be processed;

[0008] Determine the relevance of the candidate entity according to the target query vector and the representation vector of the candidate entity, and determine the relevance threshold of the target query term according to the target query vector and the representation vector of a predetermined virtual entity;

[0009] A matching target entity is selected from the candidate entities according to the relevance of the candidate entities and the relevance threshold.

[0010] According to one aspect of the present disclosure, a method for fine-tuning a large language model is provided, comprising:

[0011] Input the annotated entities matching the sample query words into the initial large language model to obtain the summary of the annotated entities;

[0012] Encoding the sample query term and the abstract of the annotated entity respectively, and determining the relevance of the annotated entity according to the encoding result;

[0013] The relevance of the labeled entity is used as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

[0014] According to one aspect of the present disclosure, there is provided an entity search device, comprising:

[0015] A query encoding module, used to encode the target query word to obtain a target query vector;

[0016] A candidate entity module, configured to determine a representation vector of a candidate entity from the representation vectors of the entity to be processed according to the target query vector and a predetermined representation vector of the entity to be processed;

[0017] A relevance module, configured to determine the relevance of a candidate entity according to the target query vector and the representation vector of the candidate entity, and to determine a relevance threshold of a target query term according to the target query vector and the representation vector of a predetermined virtual entity;

[0018] The target entity module is used to select a matching target entity from the candidate entities according to the relevance of the candidate entities and the relevance threshold.

[0019] According to one aspect of the present disclosure, a fine-tuning device for a large language model is provided, comprising:

[0020] Annotation summary module, used to input the annotation entity matching the sample query into the initial large language model to obtain the summary of the annotation entity;

[0021] A relevance module, used to encode the sample query term and the abstract of the annotated entity respectively, and determine the relevance of the annotated entity according to the encoding result;

[0022] The model fine-tuning module is used to use the relevance of the labeled entity as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

[0023] According to another aspect of the present disclosure, there is provided an electronic device, the electronic device comprising:

[0024] at least one processor; and

[0025] a memory communicatively connected to the at least one processor; wherein,

[0026] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method provided by any embodiment of the present disclosure.

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

[0028] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method provided according to any embodiment of the present disclosure is implemented.

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

[0030] Figure 1a is a flow chart of an entity search method provided according to an embodiment of the present disclosure;

[0031] Figure 1b is a flow chart of an entity search method provided according to an embodiment of the present disclosure;

[0032] Figure 2 is a flowchart of another entity search method provided according to an embodiment of the present disclosure;

[0033] Figure 3a is a flowchart of another entity search method provided according to an embodiment of the present disclosure;

[0034] Figure 3b is a schematic diagram of the principle of an entity search method provided according to an embodiment of the present disclosure;

[0035] Figure 3c It is a schematic diagram of the training principle of a refined sorting model provided according to an embodiment of the present disclosure;

[0036] Figure 4 is a flow chart of a method for fine-tuning a large language model provided according to an embodiment of the present disclosure;

[0037] Figure 5 is a schematic diagram of the principle of the entity search process provided by the embodiment of the present disclosure;

[0038] Figure 6 is a structural diagram of an entity search device provided according to an embodiment of the present disclosure;

[0039] Figure 7 is a structural schematic diagram of a fine-tuning device for a large language model provided according to an embodiment of the present disclosure;

[0040] Figure 8It is a block diagram of an electronic device used to implement the entity search method or the fine-tuning method of a large language model in the embodiments of the present disclosure. DETAILED DESCRIPTION

[0041] Figure 1a 1 is a flow chart of an entity search method provided according to an embodiment of the present disclosure. The method is applicable to the case of searching for a target entity that matches a target query term. The method can be executed by an entity search device, which can be implemented in software and / or hardware and can be integrated into an electronic device. Figure 1a As shown, the entity search method of this embodiment may include:

[0042] S101, encoding the target query word to obtain a target query vector;

[0043] S102, determining a representation vector of a candidate entity from the representation vectors of the entity to be processed according to the target query vector and a predetermined representation vector of the entity to be processed;

[0044] S103, determining the relevance of the candidate entity according to the target query vector and the representation vector of the candidate entity, and determining the relevance threshold of the target query term according to the target query vector and the representation vector of a predetermined virtual entity;

[0045] S104: Select a matching target entity from the candidate entities according to the relevance of the candidate entities and the relevance threshold.

[0046] The target query term is the query term carried in the query request. The entity to be processed is an entity existing in the entity library, which has actual physical meaning and can belong to many vertical fields such as science and technology, history and culture, entertainment and art, geography and tourism, education and academics; the virtual entity is not an actual entity, has no actual physical meaning, and does not belong to any vertical field. It can be represented by a specified special string, such as the string Virtual Entity. The virtual entity can also be other specified strings, which are not specifically limited.

[0047] In order to improve the efficiency of entity search, the entity to be processed can be processed offline in advance to obtain the representation vector of the entity to be processed. For example, if the length of the entity to be processed is less than or equal to a preset quantity threshold (for example, 256 words), the entity to be processed can be encoded to obtain the representation vector of the entity to be processed; if the length of the entity to be processed is greater than the preset quantity threshold, a summary of the entity to be processed can be generated, so that the summary of the entity to be processed is less than or equal to the preset quantity threshold, and the summary of the entity to be processed is encoded to obtain the representation vector of the summary as the representation vector of the entity to be processed. The virtual entity can also be encoded in advance to obtain the representation vector of the virtual entity. The representation vector of the virtual entity can be represented by THE TOKEN below.

[0048] In the disclosed embodiment, the entity search process may include a recall phase of candidate entities and a refined ranking phase of candidate entities. The recall phase is used to preliminarily screen out candidate objects that may match the query request from the full amount of data as input to the refined ranking phase; the refined ranking phase is used to accurately sort the candidate objects obtained in the recall phase. In the recall phase, the target query term is extracted from the query request, and the target query term is encoded to obtain a target query vector; the representation vector of each entity to be processed is obtained, and the relevance between the target query vector and the representation vector of each entity to be processed can be determined based on the Approximate Nearest Neighbor Search (ANN) algorithm, and the representation vectors of the previously preset number of entities to be processed (for example, 300) with relatively high relevance are used as the representation vectors of the candidate entities. In the refined ranking phase, the relevance of the candidate entity can be determined based on the target query vector and the representation vector of the candidate entity; the relevance of the virtual entity can be determined based on the target query vector and the representation vector of the virtual entity as the relevance threshold of the target query term, that is, the relevance of the virtual entity is used as the threshold of the target query term, so that the threshold of the target query term is different. If the relevance score between the target query vector and the candidate entity is greater than the relevance threshold of the target query term, it is determined that the candidate entity matches the target query term; otherwise, it is determined that there is no match.

[0049] In order to further improve the coverage and accuracy of entity search, synonym mining can be performed on the entities to be processed in the entity library to obtain multiple synonyms of the entities to be processed, and each synonym can be encoded to obtain a representation vector of the synonym, which is used as the representation vector of the entity to be processed. Figure 1b This is an example diagram of an entity search provided according to an embodiment of the present disclosure. The entity to be processed "Lingyin Temple" has synonyms "Yunlin Temple" and "Lingyin Temple in Hangzhou", and the entity to be processed "Faxi Temple" has a synonym "Shangtianzhu Temple". When the target query word Query is Yunlin Temple in Hangzhou, the relevance threshold of the target query word can be 0.45, and the relevance of "Lingyin Temple", "Yunlin Temple" and "Lingyin Temple in Hangzhou" are 0.98, 0.79, and 0.83, respectively, and the maximum relevance is 0.98; the relevance of "Faxi Temple" and "Shangtianzhu Temple" are 0.31 and 0.23, respectively, and the maximum relevance is 0.31. Since the maximum relevance of "Lingyin Temple" of 0.98 is greater than the relevance threshold (THE TOKEN) 0.45, and the maximum relevance of "Faxi Temple" of 0.31 is less than the relevance threshold 0.45, "Lingyin Temple" can be used as a matching target entity; "Faxi Temple" does not match the target query word.

[0050] By determining the relevance threshold of the target query term according to the target query vector and the representation vector of the virtual entity, the relevance threshold of each target query term is made different, that is, by determining a dynamic relevance threshold for the target query term, and using the dynamic relevance threshold as the target query term in the fine ranking stage, it adapts to the diversity of various vertical fields, improves the generalization of the fine ranking stage, makes the entity search method applicable to different vertical fields, improves the quality of entity search, and improves the efficiency of entity search compared to optimizing each vertical field separately and customizing specific recall and fine ranking strategies.

[0051] The technical solution provided by the embodiments of the present disclosure introduces virtual entities in the fine ranking stage, dynamically determines the relevance threshold of the target query term according to the target query vector and the representation vector of the virtual entity, and selects the target entity matching the target query term from the candidate entities according to the relevance threshold of the target query term and the relevance of each candidate entity, thereby adapting to the diversity of each vertical field, improving the generalization of the fine ranking stage, and improving the quality and efficiency of entity search.

[0052] Figure 2 is a flowchart of another entity search method provided according to an embodiment of the present disclosure. Figure 2 , the entity search method of this embodiment may include:

[0053] S201, encoding the target query word to obtain a target query vector;

[0054] S202, determining a representation vector of a candidate entity from the representation vectors of the entity to be processed according to the target query vector and a predetermined representation vector of the entity to be processed; the representation vector of the entity to be processed is determined in advance by: inputting the entity to be processed into a target large language model, generating a summary for the entity to be processed by the target large language model; encoding the summary of the entity to be processed to obtain the representation vector of the entity to be processed;

[0055] S203, determining the relevance of the candidate entity according to the target query vector and the representation vector of the candidate entity, and determining the relevance threshold of the target query term according to the target query vector and the representation vector of a predetermined virtual entity;

[0056] S204: Select a matching target entity from the candidate entities according to the relevance of the candidate entities and the relevance threshold.

[0057] In an embodiment of the present disclosure, in order to improve the efficiency of entity search, a summary of the entity to be processed may be generated offline in advance, and the summary of the entity to be processed may be encoded to obtain a representation vector of the entity to be processed. Exemplarily, if the length of the entity to be processed is greater than a preset quantity threshold, the entity to be processed may be input into a target large language model, and a summary may be generated for the entity to be processed through the target large language model; the summary of the entity to be processed may be encoded to obtain a representation vector of the entity to be processed. The target large language model may be obtained by fine-tuning the initial large language model using the corpus of the entity scene, and the corpus may include the association relationship between the entity and the summary of the entity. By pre-generating a summary of the entity to be processed based on the target large language model, and encoding the summary of the entity to be processed to obtain a representation vector of the entity to be processed, the deep semantic understanding ability of the large language model can be used to generate a summary, thereby improving the accuracy of the representation vector of the entity to be processed obtained by encoding the summary.

[0058] In an optional implementation, the step of inputting the entity to be processed into a target large language model and generating a summary for the entity to be processed through the target large language model includes: inputting the entity to be processed into the target large language model to obtain the type of the entity to be processed; selecting similar entities from entities with summaries according to the entity to be processed and the type of the entity to be processed, and obtaining summaries of the similar entities; using the similar entities and the summaries of the similar entities as support sets for few-shot learning, and generating a summary prompt sentence according to the entity to be processed and the support set; inputting the summary prompt sentence into the target large language model to obtain a summary of the entity to be processed output by the target large language model.

[0059] In the disclosed embodiment, the idea of ​​chain-of-thought can be used to generate a summary of the entity to be processed through the target large language model. Prompt refers to a prompt sentence provided to the large language model, which can be a given question, task or instruction to guide the language generation process of the model. The content of the prompt sentence depends on the user's needs and the task type. The classification prompt sentence is used to guide the large language model to classify entities. Exemplarily, the prompt words of the entity to be processed and the entity classification can be combined to generate a classification prompt sentence, and the classification prompt sentence is input into the target large language model to obtain the type of the entity to be processed.

[0060] In addition, a basic entity library can be constructed in advance based on the entities and entity summaries provided by the online document sharing platform, and a set of entities belonging to the type of the entity to be processed can be selected from the basic entity library according to the type of the entity to be processed, and similar entities of the entity to be processed can be recalled from the entity set, and summaries of similar entities can be obtained from the basic entity library. Similar entities and summaries of similar entities are used as support sets (Support Set) for few-shot learning (FSL). Few-shot learning, also known as low-shot learning (LSL), is an important technology in the field of machine learning. The support set is a data set used to train models in few-shot learning. Specifically, the entity to be processed, the support set of few-shot learning, and the summary prompt words can be concatenated to obtain a summary prompt sentence, and the summary prompt sentence can be input into the target large language model to obtain the summary of the entity to be processed output by the target large language model. By determining similar entities and summaries of similar entities according to the type of the entity to be processed, and using similar entities and summaries of similar entities as support sets for few-sample learning, the target large language model generates a summary of the entity to be processed. That is, by introducing a small number of training samples in the summary prompt sentence, the target large language model can learn based on a small number of training samples, thereby improving the summary generation capability of the target large language model, that is, improving the accuracy of summary generation.

[0061] In an optional implementation, after inputting the summary prompt sentence into the target large language model to obtain the summary of the entity to be processed output by the target large language model, the method further includes: adding the summary output by the target large language model to the summary prompt sentence to obtain a new summary prompt sentence; inputting the new summary prompt sentence into the target large language model to obtain a new summary, until the number of summaries of the entity to be processed reaches a preset quantity threshold.

[0062] In the disclosed embodiment, after the summary prompt sentence is input into the target large language model to obtain the summary of the entity to be processed, the summary output by the target large language model can also be added to the summary prompt sentence, so that the target large language model refers to the generated summary and generates a new summary from other angles again, and repeats multiple times until a preset number threshold summary is generated for the entity to be processed, for example, until 4 summaries are generated for the entity to be processed. Each summary of the entity to be processed is encoded separately to obtain multiple representation vectors of the entity to be processed. It should be noted that some of the representation vectors recalled in the recall stage may belong to the same candidate entity, that is, the same candidate entity can be recalled multiple times, and multiple representation vectors of the same candidate entity can be finely sorted. By generating multiple different summaries for an entity to be processed, and encoding each summary separately to obtain multiple representation vectors of the entity to be processed, the entity to be processed has representation vectors from different angles, that is, the representation vector of the entity to be processed has generalization, thereby improving the generalization of subsequent entity recall based on multiple representation vectors of the entity to be processed.

[0063] In an optional implementation, the target large language model is predetermined in the following manner: inputting a tagged entity matching a sample query term into an initial large language model to obtain a summary of the tagged entity; encoding the sample query term and the summary of the tagged entity respectively, and determining the relevance of the tagged entity based on the encoding result; using the relevance of the tagged entity as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

[0064] In the fine-tuning stage of the large language model, a sample query word can be obtained, and the positive and negative entities matching the sample query word are used as the annotated entities. The annotated entities are input into the initial large language model to obtain the summary of the annotated entity, and the sample query word and the summary of the annotated entity are encoded respectively. Moreover, the relevance of the annotated entity can be determined according to the encoding result. For example, the encoding result of the sample query word and the encoding result of the summary can be spliced ​​to obtain the splicing result, and the splicing result can be input into the pre-trained fine-ranking model to obtain the relevance of the annotated entity, and the relevance of the annotated entity is used as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model. By using the relevance of the annotated entity as a supervisory signal to fine-tune the initial large language model, the accuracy of the supervisory signal is improved, thereby improving the accuracy of the model fine-tuning; and by using the relevance of the annotated entity obtained by the fine-ranking model as the supervisory signal for fine-tuning the large language model, the matching degree between the target large language model and the fine-ranking model is also improved, thereby further improving the accuracy of entity processing.

[0065] The technical solution provided by the embodiment of the present disclosure classifies the entity type of the entity to be processed to obtain the type to which the entity to be processed belongs, determines similar entities and summaries of similar entities according to the entity to be processed and the type to which it belongs, and uses the similar entities and summaries of similar entities as a support set for few-sample learning, thereby improving the summary generation capability of the target large language model, thereby further improving the accuracy of entity processing.

[0066] Figure 3a is a flowchart of another entity search method provided according to an embodiment of the present disclosure. Figure 3a , the entity search method of this embodiment may include:

[0067] S301, encoding the target query word to obtain a target query vector;

[0068] S302, determining a representation vector of a candidate entity from the representation vectors of the entity to be processed according to the target query vector and a predetermined representation vector of the entity to be processed;

[0069] S303, for each candidate entity, concatenate the target query vector and the representation vector of the candidate entity to obtain a first concatenated vector, and input the first concatenated vector into a pre-trained refined ranking model to obtain the relevance of the candidate entity;

[0070] S304, concatenating the target query vector and the representation vector of the virtual entity to obtain a second concatenated vector, and inputting the second concatenated vector into the refined ranking model to obtain the relevance of the virtual entity as a relevance threshold of the target query term;

[0071] S305: Select a matching target entity from the candidate entities according to the relevance of the candidate entities and the relevance threshold.

[0072] Figure 3b is a schematic diagram of a principle of an entity search method provided according to an embodiment of the present disclosure, with reference to Figure 3b The entity search method may include an offline phase and an online phase. In the offline phase, multiple summaries of the entity to be processed may be generated through the target large language model. That is, the existing entities in the basic entity library and the summaries of the existing entities may be used to generate summaries for entities that lack summaries in the heterogeneous entity library. In addition, each summary of the entity to be processed may be input into the second sub-network in the dual-tower model to obtain each representation vector of the entity to be processed, and the virtual entity may be input into the second sub-network to obtain the representation vector of the virtual entity for online use.

[0073] The online stage may include a recall sub-stage and a fine ranking sub-stage. In the recall sub-stage, the target query word is obtained, and the target query word is input into the first sub-network in the dual-tower model to obtain the target query vector; the target query vector and the representation vectors of each entity to be processed are input into the relevance layer in the dual-tower model to obtain the relevance, and the representation vectors of each entity to be processed are sorted according to the relevance, and N relatively high relevances are selected as the representation vectors of the candidate entity according to the sorting. It should be noted that the different selected representation vectors may belong to the same candidate entity, that is, a candidate entity may have multiple representation vectors selected, for example, the correlation between multiple representation vectors of the candidate entity and the target query vector is relatively high.

[0074] In the fine ranking sub-stage, for each candidate entity, the target query vector and the representation vector of the candidate entity are concatenated to obtain a first concatenated vector, and the first concatenated vector is input into a pre-trained fine ranking model to obtain the relevance of the candidate entity; the target query vector and the representation vector of the virtual entity are concatenated to obtain a second concatenated vector, and the second concatenated vector is input into a pre-trained fine ranking model to obtain the relevance of the virtual entity as the relevance threshold of the target query term. The fine ranking model can adopt a single-tower network structure. The relevance of the virtual entity is determined by the fine ranking model according to the target query vector and the representation vector of the virtual entity as the relevance threshold of the target query term; and the relevance of each candidate entity is determined separately by the fine ranking model; if the relevance of the candidate entity is equal to or greater than the relevance threshold of the target query term, the candidate entity is a target entity that matches the target query term; otherwise, it does not match. It should be noted that if there is a target entity matching the target query term in the basic entity library or the heterogeneous entity library, the target query term can be linked to the matching target entity; if the entities in the basic entity library or the heterogeneous entity library do not match the target query term, the target query term can be added to the entity library as a new entity. For ease of operation, entities with summaries in the basic database and the heterogeneous entity library can be merged to obtain a merged entity library for subsequent use.

[0075] In an optional embodiment, the refined ranking model is predetermined in the following manner: constructing a refined ranking corpus based on sample query terms, sample entities and the relevance annotated by the sample entities; wherein the sample entities include positive sample entities, negative sample entities and virtual entities, the positive relevance annotated by the positive sample entities is greater than the virtual relevance annotated by the virtual entities, and the virtual relevance is greater than the negative relevance annotated by the negative sample entities; and using the refined ranking corpus to train an initial matching model to obtain the refined ranking model.

[0076] The refined ranking corpus includes sample query words, sample entities, and the relevance of sample entities, i.e., the relevance between sample entities and sample query words. Sample entities include virtual entities, positive sample entities matching sample query words, and negative sample entities not matching sample query words; and the positive relevance annotated by the positive sample entity is greater than the virtual relevance annotated by the virtual entity, and the virtual relevance is greater than the negative relevance annotated by the negative sample entity. In the training process of the refined ranking model, the sample query word can be input into the first sub-network in the double tower model to obtain the representation vector of the sample query word; the sample entity can be input into the second sub-network in the double tower model to obtain the representation vector of the sample entity; the representation vector of the sample query word and the representation vector of the sample entity are concatenated, and the concatenation result is input into the initial matching model to obtain the predicted relevance of the sample entity; the difference between the predicted relevance of the sample entity and the relevance annotated by the sample entity is compared, and the initial matching model is trained according to the difference to obtain the refined ranking model.

[0077] Figure 3c is a schematic diagram of the training principle of a refined sorting model provided according to an embodiment of the present disclosure, with reference to Figure 3c , taking the sample query term as Lingyin Temple, there are positive sample entities Lingyin Temple and Yunlin Temple, and negative sample entity Faxi Temple as examples, the positive correlation of the positive sample entity can be 4, the negative correlation represented by the negative sample entity can be 2, 1 or 0, and the virtual correlation THE TOKEN marked by the virtual entity can be 3. By splicing the representation vector of the sample query term and the query vector of the sample entity, the splicing result is input into the initial matching model to obtain the predicted correlation of the sample entity; the initial matching model is trained to obtain the refined ranking model by combining the predicted correlation of the sample entity and the labeled correlation. By controlling the virtual correlation to be less than the positive correlation and greater than the negative correlation, not only can the refined ranking model be trained, but also the refined ranking model can use the correlation of the virtual entity as the threshold for the query term in various vertical fields, so as to be applicable to entity search requests in different vertical fields and improve the accuracy of entity search.

[0078] In an optional implementation, before concatenating the target query vector and the representation vector of the candidate entity to obtain a first concatenated vector, the method further includes: obtaining the number of clicks and the number of impressions of the candidate entity; and fusing the number of clicks and the number of impressions of the candidate entity into the representation vector of the candidate entity.

[0079] In order to further improve the quality of fine ranking of each candidate entity, a posteriori data such as the number of clicks and impressions of the candidate entity can also be obtained, and the posterior data can be fused into the representation vector of the candidate entity; the correlation between the target query vector and the fused representation vector of the candidate entity can be determined through the fine ranking model.

[0080] The technical solution provided by the embodiments of the present disclosure, by controlling the virtual relevance to be less than the positive correlation and greater than the negative correlation, can not only train a refined ranking model, but also enable the refined ranking model to use the relevance of the virtual entity as the qualifying threshold for query terms in various vertical fields, thereby being suitable for entity search requests in different vertical fields and further improving the accuracy of entity search.

[0081] Figure 4 1 is a flow chart of a method for fine-tuning a large language model according to an embodiment of the present disclosure. The method is applicable to the case where a large language model is fine-tuned for intelligent search scenarios. The method can be performed by a fine-tuning device for a large language model, which can be implemented in software and / or hardware and can be integrated into an electronic device. Figure 4 As shown, the fine-tuning method of the large language model of this embodiment may include:

[0082] S401, inputting the annotated entity matching the sample query into the initial large language model to obtain a summary of the annotated entity;

[0083] S402, encoding the sample query term and the abstract of the annotated entity respectively, and determining the relevance of the annotated entity according to the encoding result;

[0084] S403 , using the relevance of the labeled entity as a supervisory signal, and fine-tuning the initial large language model to obtain a fine-tuned target large language model.

[0085] In the fine-tuning stage of the large language model, a sample query word can be obtained, and the positive and negative entities matching the sample query word are used as the annotated entities. The annotated entities are input into the initial large language model to obtain the summary of the annotated entity, and the sample query word and the summary of the annotated entity are encoded respectively. In addition, the relevance of the annotated entity can be determined according to the encoding result. For example, the encoding result of the sample query word and the encoding result of the summary can be spliced ​​to obtain the splicing result, and the splicing result can be input into the pre-trained fine-ranking model to obtain the relevance of the annotated entity, and the relevance of the annotated entity is used as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model. By fine-tuning the initial large language model using the relevance of the annotated entity as a supervisory signal, the accuracy of the supervisory signal is improved, thereby improving the accuracy of model fine-tuning; and, by obtaining the relevance of the annotated entity through the pre-trained fine-ranking model, the matching degree between the target large language model and the fine-ranking model is also improved, thereby further improving the accuracy of entity processing.

[0086] In an optional implementation, a tagged entity matching a sample query term is input into an initial large language model to obtain a summary of the tagged entity, including: inputting the tagged entity into the initial large language model to obtain the type to which the tagged entity belongs; selecting a similar entity from entities with a summary based on the tagged entity and the type to which the tagged entity belongs, and obtaining a summary of the similar entity; using the similar entity and the summary of the similar entity as a support set for few-shot learning, and generating a summary prompt sentence based on the tagged entity and the support set; inputting the summary prompt sentence into the initial large language model to obtain a summary of the tagged entity output by the initial large language model.

[0087] In the disclosed embodiment, the idea of ​​chain-of-thought can be used to generate a summary of the labeled entity by initially obtaining a large language model. The classification prompt sentence is used to guide the large language model to classify the entity. Exemplarily, the labeled entity and the prompt word of the entity classification can be spliced ​​to generate a classification prompt sentence, and the classification prompt sentence is input into the initial large language model to obtain the type of the labeled entity.

[0088] In addition, a basic entity library can be constructed in advance based on the entities and entity summaries provided by the online document sharing platform, and an entity set belonging to the type of the entity to be processed can be selected from the basic entity library, and similar entities of the labeled entity can be recalled from the entity set, and the summary of the similar entity can be obtained from the basic entity library. The similar entities and the summaries of the similar entities are used as the support set (Support Set) of Few-Shot Learning (FSL). Specifically, the labeled entity, the support set of the few-shot learning and the summary prompt words can be spliced ​​to obtain the summary prompt sentence, and the summary prompt sentence can be input into the initial large language model to obtain the summary of the labeled entity output by the initial large language model. By determining the similar entities and the summaries of the similar entities according to the type of the labeled entity, and using the similar entities and the summaries of the similar entities as the support set of the few-shot learning, the initial large language model generates the summary of the labeled entity, so that the initial large language model can improve the summary generation ability through few-shot learning, thereby improving the accuracy of summary generation.

[0089] In an optional implementation, after inputting the summary prompt sentence into the initial large language model to obtain the summary of the labeled entity output by the initial large language model, the method further includes: adding the summary output by the initial large language model to the summary prompt sentence to obtain a new summary prompt sentence; inputting the new summary prompt sentence into the initial large language model to obtain a new summary, until the number of summaries of the entities to be processed reaches a preset quantity threshold.

[0090] In the disclosed embodiment, after the summary prompt sentence is input into the initial large language model to obtain the summary of the annotated entity, the summary output by the initial large language model can also be added to the summary prompt sentence, so that the initial large language model can refer to the generated summary and generate it again from other angles, and repeat it multiple times until a preset threshold number of summaries are generated for the annotated entity. By generating multiple different summaries for a annotated entity and encoding each summary to obtain multiple representation vectors of the annotated entity, the representation vector of the annotated entity has generalization.

[0091] The technical solution provided by the disclosed embodiment obtains the summary of the labeled entity by inputting the labeled entity matching the sample query term into the initial large language model, and determines the relevance of the labeled entity according to the sample query term and the summary of the labeled entity through a pre-trained refined ranking model, and uses the relevance of the labeled entity as a supervisory signal to fine-tune the initial large language model, thereby improving the accuracy of the supervisory signal and thus improving the accuracy of model fine-tuning; and, by obtaining the relevance of the labeled entity through the refined ranking model, the matching degree between the target large language model and the refined ranking model is also improved, thereby further improving the accuracy of entity processing.

[0092] For ease of understanding, a specific embodiment of entity search is provided as follows. Figure 5 is a schematic diagram of the principle of the entity search process provided by the embodiment of the present disclosure, refer to Figure 5 ,Entity search may include an offline preprocessing stage and an online entity search stage.

[0093] In the preprocessing stage, multiple summaries are constructed for the entities to be processed, and the summaries of the entities to be processed are encoded to obtain multiple representation vectors of the entities to be processed. Figure 5 ,The preprocessing stage may include training of a refined ranking model, fine-tuning of a large language model, generating a summary of the entity, and generating a representation vector of the entity.

[0094] Among them, the refined ranking model is used to score the relevance of query words and entities. In the training process of the refined ranking model, sample query words, sample entities and the relevance annotated by the sample entities are obtained. The sample entities include positive sample entities, negative sample entities and virtual entities. The positive relevance annotated by the positive sample entity is greater than the virtual relevance annotated by the virtual entity, and the virtual relevance is greater than the negative relevance annotated by the negative sample entity. In the training process of the refined ranking model, the sample query word can be input into the first sub-network in the double tower model to obtain the representation vector of the sample query word; the sample entity is input into the second sub-network in the double tower model to obtain the representation vector of the sample entity; the representation vector of the sample query word and the representation vector of the sample entity are spliced, and the splicing result is input into the initial matching model to obtain the predicted relevance of the sample entity; the difference between the predicted relevance of the sample entity and the relevance annotated by the sample entity is compared, and the initial matching model is trained according to the difference to obtain the refined ranking model. By introducing virtual entities, the refined ranking model can effectively learn the dynamic relevance threshold for query words in different vertical fields, thereby improving the accuracy of subsequent refined ranking of each candidate entity.

[0095] In the fine-tuning stage of the large language model, sample query words and annotated entities matching the sample query words can be obtained, and the annotated entities include positive entities and negative entities; the sample query words and the annotated entities are input into the initial large language model to obtain the summary of the annotated entities; the sample query words and the summary of the annotated entities are input into the pre-trained fine ranking model to obtain the relevance of the annotated entities; the relevance of the annotated entities is used as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model. The above processing makes the target large language model adapt to the fine ranking model, and also improves the accuracy of subsequent summary generation.

[0096] In the process of generating entity summaries, the idea of ​​thought chain can be used to generate multiple summaries for heterogeneous entities through the target large language model. Specifically, the heterogeneous entities can be input into the target large language model to obtain the entity type; according to the heterogeneous entities and entity types, multiple similar entities are selected from the entity library, and the summaries of similar entities are obtained from the entity library; the similar entities and the summaries of similar entities are used as the support set for few-shot learning to guide the target large language model to generate summaries for heterogeneous entities; the summaries generated by the target large language model are also introduced into the prompt sentence of the target large language model, and new summaries are continuously generated from other angles until the summaries of the heterogeneous entities reach the preset quantity threshold.

[0097] In the process of generating the entity representation vector, the summary of each entity can be input into the second sub-model in the twin tower model, and the summary of each entity can be encoded by the second sub-model, and the encoding results are used as the entity representation vector. By representing the entity by vector from different angles, more abundant information is provided for the entity, thereby improving robustness and generalization.

[0098] refer to Figure 5 The entity search phase may include the recall of candidate entities and the fine ranking of candidate entities. In the recall process of candidate entities, the target query word is obtained, and the target query word is input into the first sub-network in the dual-tower model to obtain the target query vector. The representation vector of each entity to be processed in the entity library is obtained, and the target query vector and the representation vector of each entity to be processed are input into the relevance layer in the dual-tower model to obtain the relevance, and the top N with relatively high relevance are selected as the representation vectors of the candidate entities.

[0099] In the process of fine ranking of candidate entities, a posteriori data such as the number of clicks and the number of impressions of the candidate entities can also be obtained, and the posteriori data can be fused into the representation vector of the candidate entity to obtain the fused representation vector of the candidate entity. The target query vector and the fused representation vector of the candidate entity are concatenated to obtain a first concatenated vector, and the first concatenated vector is input into the fine ranking model to obtain the relevance of the candidate entity; and the target query vector and the representation vector of the virtual vector are concatenated to obtain a second concatenated vector, and the second concatenated vector is input into the fine ranking model to obtain the relevance of the virtual entity as the relevance threshold of the target query term; if the relevance of any candidate entity is greater than the relevance threshold, the candidate entity matches the target query term; otherwise, it does not match.

[0100] The technical solution provided by the embodiment of the present disclosure proposes a unified modeling framework based on entity search, aiming to provide a unified model solution for multiple scenarios. This framework supports streaming data library building and real-time online normalization, can cover all entity types encountered in business applications, and significantly improve the efficiency of policy iteration.

[0101] Figure 6 1 is a schematic diagram of the structure of an entity search device provided according to an embodiment of the present disclosure. The device is suitable for searching for a target entity that matches a target query term. The device can be implemented in software and / or hardware and can be integrated into an electronic device. Figure 6 As shown, the entity search device 600 of this embodiment may include:

[0102] A query encoding module 610, configured to encode a target query word to obtain a target query vector;

[0103] A candidate entity module 620, configured to determine a representation vector of a candidate entity from the representation vectors of the entity to be processed according to the target query vector and a predetermined representation vector of the entity to be processed;

[0104] A relevance module 630, configured to determine the relevance of a candidate entity according to the target query vector and the representation vector of the candidate entity, and to determine a relevance threshold of a target query term according to the target query vector and the representation vector of a predetermined virtual entity;

[0105] The target entity module 640 is used to select a matching target entity from the candidate entities according to the relevance of the candidate entities and the relevance threshold.

[0106] In an optional implementation, the entity search device 600 further includes an entity encoding module, and the entity encoding module includes:

[0107] A summary generating unit, used for inputting the entity to be processed into a target large language model, and generating a summary for the entity to be processed through the target large language model;

[0108] The summary encoding unit is used to encode the summary of the entity to be processed to obtain a representation vector of the entity to be processed.

[0109] In an optional implementation, the summary generation unit includes:

[0110] A type subunit, used for inputting the entity to be processed into the target large language model to obtain the type to which the entity to be processed belongs;

[0111] A similar entity subunit, configured to select similar entities from entities with summaries according to the entity to be processed and the type to which the entity to be processed belongs, and obtain summaries of the similar entities;

[0112] A summary prompt subunit, used to use the similar entities and the summaries of the similar entities as a support set for few-shot learning, and generate a summary prompt sentence according to the entity to be processed and the support set;

[0113] The summary generation subunit is used to input the summary prompt sentence into the target large language model to obtain the summary of the entity to be processed output by the target large language model.

[0114] In an optional implementation manner, the summary generation unit is further configured to:

[0115] Adding the summary output by the target large language model to the summary prompt sentence to obtain a new summary prompt sentence;

[0116] The new summary prompt sentence is input into the target large language model to obtain a new summary, until the number of summaries of the entities to be processed reaches a preset number threshold.

[0117] In an optional implementation, the entity search device 600 further includes a model fine-tuning module, and the model fine-tuning module includes:

[0118] A tag summary unit, used for inputting the tag entity matching the sample query term into the initial large language model to obtain a summary of the tag entity;

[0119] A relevance unit, used to encode the sample query term and the abstract of the annotated entity respectively, and determine the relevance of the annotated entity according to the encoding result;

[0120] The model fine-tuning unit is used to use the relevance of the labeled entity as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

[0121] In an optional implementation, the relevance module 630 includes:

[0122] A candidate relevance unit is used to concatenate the target query vector and the representation vector of the candidate entity for each candidate entity to obtain a first concatenated vector, and input the first concatenated vector into a pre-trained refined ranking model to obtain the relevance of the candidate entity;

[0123] The virtual relevance unit is used to concatenate the target query vector and the representation vector of the virtual entity to obtain a second concatenated vector, and input the second concatenated vector into the refined ranking model to obtain the relevance of the virtual entity as the relevance threshold of the target query term.

[0124] In an optional implementation, the entity search device 600 further includes a refined sorting training module, and the refined sorting training module includes:

[0125] A refined corpus unit, used to construct a refined corpus according to sample query terms, sample entities and the relevances annotated by the sample entities; wherein the sample entities include positive sample entities, negative sample entities and virtual entities, the positive relevance annotated by the positive sample entities is greater than the virtual relevance annotated by the virtual entities, and the virtual relevance is greater than the negative relevance annotated by the negative sample entities;

[0126] The refined sorting training unit is used to train the initial matching model using the refined sorting corpus to obtain the refined sorting model.

[0127] In an optional implementation, the refined arrangement corpus unit is further used for:

[0128] Get the click count and display count of the candidate entity;

[0129] The number of clicks and the number of impressions of the candidate entity are integrated into the representation vector of the candidate entity.

[0130] The technical solution of the disclosed embodiment introduces virtual entities in the process of fine ranking to determine the relevance threshold of the target query term, and selects the target entity matching the target query term from each candidate entity according to the relevance threshold of the target query term and the relevance of each candidate entity, adapts to the diversity of each vertical field, improves the generalization of the fine ranking stage, and generates a summary for the entity to be processed through the target large language model, and encodes the summary to obtain the representation vector of the entity to be processed, thereby improving the generalization of the representation of the entity to be processed. By uniformly modeling the entity search-related scenarios, it can cover all vertical categories, provide a unified normalization service for the upstream, and better assist the development of subsequent large language models.

[0131] Figure 7 1 is a schematic diagram of a structure of a fine-tuning device for a large language model provided according to an embodiment of the present disclosure. The device is suitable for fine-tuning a large language model for an entity search scenario. The device can be implemented in software and / or hardware and can be integrated into an electronic device. Figure 7 As shown, the fine-tuning device 700 of the large language model of this embodiment may include:

[0132] The annotation summary module 710 is used to input the annotation entity matching the sample query word into the initial large language model to obtain the summary of the annotation entity;

[0133] A relevance module 720 is used to encode the sample query term and the abstract of the annotated entity respectively, and determine the relevance of the annotated entity according to the encoding result;

[0134] The model fine-tuning module 730 is used to use the relevance of the labeled entity as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

[0135] In an optional implementation, the annotation summary module 710 includes:

[0136] A type unit, used for inputting the annotated entity into an initial large language model to obtain the type to which the annotated entity belongs;

[0137] A similar entity unit, used to select similar entities from entities with summaries according to the annotated entity and the type to which the annotated entity belongs, and obtain summaries of the similar entities;

[0138] A summary prompt unit, used to use the similar entities and the summaries of the similar entities as support sets for few-shot learning, and generate summary prompt sentences according to the labeled entities and the support sets;

[0139] The summary generating unit is used to input the summary prompt sentence into the initial large language model to obtain the summary of the labeled entity output by the initial large language model.

[0140] In an optional implementation manner, the summary generation unit is further configured to:

[0141] Adding the summary output by the initial large language model to the summary prompt sentence to obtain a new summary prompt sentence;

[0142] The new summary prompt sentence is input into the initial large language model to obtain a new summary, until the number of summaries of the entities to be processed reaches a preset number threshold.

[0143] The technical solution of the disclosed embodiment obtains a summary of the labeled entity by inputting the labeled entity matching the sample query term into the initial large language model, and determines the relevance of the labeled entity according to the sample query term and the summary of the labeled entity through a pre-trained refined ranking model, and uses the relevance as a supervisory signal to fine-tune the initial large language model, thereby improving the accuracy of the supervisory signal, thereby improving the accuracy of model fine-tuning; and, by obtaining the relevance of the labeled entity through the refined ranking model, the matching degree between the target large language model and the refined ranking model is also improved, thereby further improving the accuracy of entity processing.

[0144] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

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

[0146] Figure 8 It is a block diagram of an electronic device used to implement the entity search method or the fine-tuning method of a large language model in the embodiments of the present disclosure.

[0147] Figure 8 A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0148] like Figure 8As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0149] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0150] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), an image processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as an entity search method or a fine-tuning method for a large language model. For example, in some embodiments, the entity search method or the fine-tuning method for a large language model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the entity search method or the fine-tuning method for a large language model described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the entity search method or the fine-tuning method of the large language model in any other appropriate manner (for example, by means of firmware).

[0151] Figure 8A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0152] like Figure 8 As shown, the electronic device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0153] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0154] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), an image processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as an entity search method or a fine-tuning method for a large language model. For example, in some embodiments, the entity search method or the fine-tuning method for a large language model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the entity search method or the fine-tuning method for a large language model described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute the entity search method or the fine-tuning method of the large language model in any other appropriate manner (for example, by means of firmware).

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

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

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

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

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

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

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

[0162] Cloud computing refers to a technology system that uses network access to elastically scalable shared physical or virtual resource pools. Resources can include servers, operating systems, networks, software, applications, and storage devices, and can be deployed and managed on demand and in a self-service manner. Cloud computing technology can provide efficient and powerful data processing capabilities for technical applications such as artificial intelligence and blockchain, as well as model training.

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

[0164] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. An entity search method, comprising: Encode the target query word to obtain a target query vector; Determining a representation vector of a candidate entity from the representation vectors of the entity to be processed according to the target query vector and a predetermined representation vector of the entity to be processed; Determine the relevance of the candidate entity according to the target query vector and the representation vector of the candidate entity, and determine the relevance threshold of the target query term according to the target query vector and the representation vector of a predetermined virtual entity; A matching target entity is selected from the candidate entities according to the relevance of the candidate entities and the relevance threshold.

2. The method according to claim 1, wherein: The characterization vector of the entity to be processed is determined in advance in the following manner: Inputting the entity to be processed into a target large language model, and generating a summary for the entity to be processed by using the target large language model; The summary of the entity to be processed is encoded to obtain a representation vector of the entity to be processed.

3. The method according to claim 2, wherein: The step of inputting the entity to be processed into a target large language model and generating a summary for the entity to be processed by using the target large language model includes: Inputting the entity to be processed into the target large language model to obtain the type of the entity to be processed; According to the entity to be processed and the type of the entity to be processed, a similar entity is selected from the entities with summaries, and the summaries of the similar entities are obtained; Using the similar entities and the summaries of the similar entities as support sets for few-shot learning, and generating summary prompt sentences according to the entity to be processed and the support set; The summary prompt sentence is input into the target large language model to obtain a summary of the entity to be processed output by the target large language model.

4. The method according to claim 3, after inputting the summary prompt sentence into the target large language model to obtain the summary of the entity to be processed output by the target large language model, further comprising: Adding the summary output by the target large language model to the summary prompt sentence to obtain a new summary prompt sentence; The new summary prompt sentence is input into the target large language model to obtain a new summary, until the number of summaries of the entities to be processed reaches a preset number threshold.

5. The method according to claim 2, wherein: The target large language model is predetermined in the following manner: Input the annotated entities matching the sample query words into the initial large language model to obtain the summary of the annotated entities; Encoding the sample query term and the abstract of the annotated entity respectively, and determining the relevance of the annotated entity according to the encoding result; The relevance of the labeled entity is used as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

6. The method according to any one of claims 1 to 5, wherein: The determining the relevance of the candidate entity according to the target query vector and the representation vector of the candidate entity, and determining the relevance threshold of the target query term according to the target query vector and the representation vector of a predetermined virtual entity, includes: For each candidate entity, concatenate the target query vector and the representation vector of the candidate entity to obtain a first concatenated vector, and input the first concatenated vector into a pre-trained refined ranking model to obtain the relevance of the candidate entity; The target query vector and the representation vector of the virtual entity are concatenated to obtain a second concatenated vector, and the second concatenated vector is input into the refined ranking model to obtain the relevance of the virtual entity as the relevance threshold of the target query term.

7. The method according to claim 6, wherein the refined sorting model is predetermined by: The refined corpus is constructed based on the sample query terms, sample entities and the relevance of the sample entity annotations; The sample entities include positive sample entities, negative sample entities and virtual entities, the positive correlation degree marked by the positive sample entity is greater than the virtual correlation degree marked by the virtual entity, and the virtual correlation degree is greater than the negative correlation degree marked by the negative sample entity; The refined sorting corpus is used to train an initial matching model to obtain the refined sorting model.

8. The method according to claim 6, before concatenating the target query vector and the representation vector of the candidate entity to obtain a first concatenated vector, further comprising: Get the click count and display count of the candidate entity; The number of clicks and the number of impressions of the candidate entity are integrated into the representation vector of the candidate entity.

9. A method for fine-tuning a large language model, comprising: Input the annotated entities matching the sample query words into the initial large language model to obtain the summary of the annotated entities; Encoding the sample query term and the abstract of the annotated entity respectively, and determining the relevance of the annotated entity according to the encoding result; The relevance of the labeled entity is used as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

10. The method according to claim 9, wherein: The step of inputting the annotated entity matching the sample query into the initial large language model to obtain a summary of the annotated entity includes: Inputting the annotated entity into an initial large language model to obtain the type to which the annotated entity belongs; According to the annotated entity and the type to which the annotated entity belongs, selecting similar entities from entities with summaries, and obtaining summaries of the similar entities; Using the similar entities and the summaries of the similar entities as support sets for few-shot learning, and generating summary prompt sentences according to the annotated entities and the support sets; The summary prompt sentence is input into an initial large language model to obtain a summary of the labeled entity output by the initial large language model.

11. The method according to claim 10, wherein: After inputting the summary prompt sentence into the initial large language model to obtain the summary of the labeled entity output by the initial large language model, the method further includes: Adding the summary output by the initial large language model to the summary prompt sentence to obtain a new summary prompt sentence; The new summary prompt sentence is input into the initial large language model to obtain a new summary, until the number of summaries of the entities to be processed reaches a preset number threshold.

12. An entity search device, comprising: A query encoding module, used to encode the target query word to obtain a target query vector; A candidate entity module, configured to determine a representation vector of a candidate entity from the representation vectors of the entity to be processed according to the target query vector and a predetermined representation vector of the entity to be processed; A relevance module, configured to determine the relevance of a candidate entity according to the target query vector and the representation vector of the candidate entity, and to determine a relevance threshold of a target query term according to the target query vector and the representation vector of a predetermined virtual entity; The target entity module is used to select a matching target entity from the candidate entities according to the relevance of the candidate entities and the relevance threshold.

13. The device according to claim 12, further comprising an entity encoding module, wherein the entity encoding module comprises: A summary generating unit, used for inputting the entity to be processed into a target large language model, and generating a summary for the entity to be processed through the target large language model; The summary encoding unit is used to encode the summary of the entity to be processed to obtain a representation vector of the entity to be processed.

14. The device according to claim 13, wherein: The summary generating unit comprises: A type subunit, used for inputting the entity to be processed into the target large language model to obtain the type to which the entity to be processed belongs; A similar entity subunit, configured to select similar entities from entities with summaries according to the entity to be processed and the type to which the entity to be processed belongs, and obtain summaries of the similar entities; A summary prompt subunit, used to use the similar entities and the summaries of the similar entities as a support set for few-shot learning, and generate a summary prompt sentence according to the entity to be processed and the support set; The summary generation subunit is used to input the summary prompt sentence into the target large language model to obtain the summary of the entity to be processed output by the target large language model.

15. The device according to claim 14, wherein the summary generation unit is further configured to: Adding the summary output by the target large language model to the summary prompt sentence to obtain a new summary prompt sentence; The new summary prompt sentence is input into the target large language model to obtain a new summary, until the number of summaries of the entities to be processed reaches a preset number threshold.

16. The device according to claim 13, further comprising a model fine-tuning module, wherein the model fine-tuning module comprises: A tag summary unit, used for inputting the tag entity matching the sample query term into the initial large language model to obtain a summary of the tag entity; A relevance unit, used to encode the sample query term and the abstract of the annotated entity respectively, and determine the relevance of the annotated entity according to the encoding result; The model fine-tuning unit is used to use the relevance of the labeled entity as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

17. The device according to any one of claims 12 to 15, wherein: The relevance module comprises: A candidate relevance unit is used to concatenate the target query vector and the representation vector of the candidate entity for each candidate entity to obtain a first concatenated vector, and input the first concatenated vector into a pre-trained refined ranking model to obtain the relevance of the candidate entity; The virtual relevance unit is used to concatenate the target query vector and the representation vector of the virtual entity to obtain a second concatenated vector, and input the second concatenated vector into the refined ranking model to obtain the relevance of the virtual entity as the relevance threshold of the target query term.

18. The device according to claim 17, further comprising a precision training module, wherein the precision training module comprises: A refined corpus unit, used to construct a refined corpus according to sample query terms, sample entities and the relevances annotated by the sample entities; wherein the sample entities include positive sample entities, negative sample entities and virtual entities, the positive relevance annotated by the positive sample entities is greater than the virtual relevance annotated by the virtual entities, and the virtual relevance is greater than the negative relevance annotated by the negative sample entities; The refined sorting training unit is used to train the initial matching model using the refined sorting corpus to obtain the refined sorting model.

19. The device according to claim 18, wherein the refined corpus unit is further used for: Get the click count and display count of the candidate entity; The number of clicks and the number of impressions of the candidate entity are integrated into the representation vector of the candidate entity.

20. A fine-tuning device for a large language model, comprising: Annotation summary module, used to input the annotation entity matching the sample query into the initial large language model to obtain the summary of the annotation entity; A relevance module, used to encode the sample query term and the abstract of the annotated entity respectively, and determine the relevance of the annotated entity according to the encoding result; The model fine-tuning module is used to use the relevance of the labeled entity as a supervisory signal to fine-tune the initial large language model to obtain a fine-tuned target large language model.

21. The device according to claim 20, wherein: The annotation summary module includes: A type unit, used for inputting the annotated entity into an initial large language model to obtain the type to which the annotated entity belongs; A similar entity unit, used to select similar entities from entities with summaries according to the annotated entity and the type to which the annotated entity belongs, and obtain summaries of the similar entities; A summary prompt unit, used to use the similar entities and the summaries of the similar entities as support sets for few-shot learning, and generate summary prompt sentences according to the labeled entities and the support sets; The summary generating unit is used to input the summary prompt sentence into the initial large language model to obtain the summary of the labeled entity output by the initial large language model.

22. The device according to claim 21, wherein The summary generation unit is further used for: Adding the summary output by the initial large language model to the summary prompt sentence to obtain a new summary prompt sentence; The new summary prompt sentence is input into the initial large language model to obtain a new summary, until the number of summaries of the entities to be processed reaches a preset number threshold.

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

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

25. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Entity search method, related equipment and computer storage medium

    CN110472058A

  • Knowledge graph-based search method and device, computer equipment and storage medium

    CN114637855A

  • Enterprise screening method and device based on large language model and medium

    CN116860957A

Cited By

  • Method, device and equipment for querying data, medium and program product

    CN119322839A

  • Method, system and equipment for identifying fraud-related short messages based on pruning large model and medium

    CN119416778A

  • Fraud-related short message identification method, system and device based on pruned large model and medium

    CN119416778B

  • Dynamic self-programming operation control method and device of virtual power plant, equipment and medium

    CN119717544A