Resource retrieval method, training method and device based on large language model
The large language model uses the process of search information to generate semantic coding sequences, which solves the problem of difficulty in accurately retrieving target resources in the prior art, achieves more efficient and accurate resource retrieval, and improves user experience.
Patent Information
- Application Number
- CN202311842314.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-28
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2043-12-28
AI Technical Summary
In the information retrieval scenarios such as news resources and advertising resources, it is difficult to accurately retrieve resources that match the needs of the target object through simple search terms, resulting in an increase in the search time and a decrease in user experience.
Using a resource search method based on a large language model, a semantic coding sequence is generated by processing search information, a semantic attribute of search information is characterized, intermediate resources matching the search information are determined from the preset resource library, and target resources are displayed based on the intermediate resources to improve Resource retrieval accuracy and efficiency.
Through the semantic understanding ability and text prediction ability of large language models, the matching degree and efficiency of resource retrieval is improved, multiple rounds of retrieval requirements are reduced, and user experience is improved.
Smart Images

Figure CN117807278B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to technical fields such as intelligent search, big data, deep learning, and large language models, and can be used in scenarios such as information retrieval and human-computer interaction. Background Art
[0002] With the rapid development of Internet technology, users can quickly browse news and other resource information through terminal devices such as smart phones. They can also enter text, images and other search information in terminal devices based on their needs to retrieve resource information. In this way, they can retrieve resource information that matches their actual needs and improve resource acquisition efficiency. Summary of the invention
[0003] The present disclosure provides a resource retrieval method, training method, device, electronic device and storage medium based on a large language model.
[0004] According to one aspect of the present disclosure, a resource retrieval method based on a large language model is provided, comprising: in response to receiving search information, processing the search information using a large language model to obtain a semantic coding sequence, wherein the semantic coding sequence includes at least one semantic coding identifier, and the semantic coding identifier represents at least one semantic attribute; determining an intermediate resource associated with the semantic coding sequence from candidate resources in a preset resource library; determining a target resource matching the search information based on the intermediate resource; and displaying the target resource.
[0005] According to another aspect of the present disclosure, a method for training a large language model is provided, comprising: obtaining a training sample, the training sample comprising sample search information and a sample semantic coding sequence corresponding to a sample resource, wherein the sample search information is associated with the sample resource, the sample semantic coding sequence comprises at least one sample semantic coding identifier, and the sample semantic coding identifier represents at least one sample semantic attribute; training an initial large language model based on the sample search information and the sample semantic coding sequence to obtain a trained large language model.
[0006] According to another aspect of the present disclosure, a resource retrieval device based on a large language model is provided, including: a semantic coding sequence acquisition module, which is used to process the search information using a large language model in response to receiving search information to obtain a semantic coding sequence, wherein the semantic coding sequence includes at least one semantic coding identifier, and the semantic coding identifier represents at least one semantic attribute; an intermediate resource determination module, which is used to determine an intermediate resource associated with the semantic coding sequence from candidate resources in a preset resource library; a target resource determination module, which is used to determine a target resource matching the search information based on the intermediate resource; and a first display module, which is used to display the target resource.
[0007] According to another aspect of the present disclosure, a training device for a large language model is provided, comprising: an acquisition module, used to acquire training samples, the training samples comprising sample search information and a sample semantic coding sequence corresponding to a sample resource, wherein the sample search information is associated with the sample resource, the sample semantic coding sequence comprises at least one sample semantic coding identifier, and the sample semantic coding identifier represents at least one sample semantic attribute; and a training module, used to train an initial large language model based on the sample search information and the sample semantic coding sequence to obtain a trained large language model.
[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method provided according to an embodiment of the present disclosure.
[0009] 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 the computer to execute the method provided according to an embodiment of the present disclosure.
[0010] 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 the embodiment of the present disclosure is implemented.
[0011] 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
[0012] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0013] Figure 1 An exemplary system architecture to which a resource retrieval method and device based on a large language model can be applied according to an embodiment of the present disclosure is schematically shown;
[0014] Figure 2 A flowchart of a resource retrieval method based on a large language model according to an embodiment of the present disclosure is schematically shown;
[0015] Figure 3 The application scenario diagram of the resource retrieval method based on the large language model according to the embodiment of the present disclosure is schematically shown;
[0016] Figure 4The following schematically shows an application scenario diagram of a resource retrieval method based on a large language model according to another embodiment of the present disclosure;
[0017] Figure 5 A flowchart of a method for training a large language model according to an embodiment of the present disclosure is schematically shown;
[0018] Figure 6 The schematic diagram schematically shows the principle of training a large language model according to an embodiment of the present disclosure;
[0019] Figure 7 The schematic diagram schematically shows the principle of training a large language model according to another embodiment of the present disclosure;
[0020] Figure 8 A block diagram of a resource retrieval device based on a large language model according to an embodiment of the present disclosure is schematically shown;
[0021] Fig. 9 A block diagram schematically shows a large language model training device according to an embodiment of the present disclosure; and
[0022] Fig.10 A block diagram of an electronic device suitable for implementing a resource retrieval method and a training method based on a large language model according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0024] In the technical solution disclosed in the present invention, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations, necessary confidentiality measures are taken, and do not violate public order and good morals.
[0025] In the search scenarios of resource information such as news resources and advertising resources, it is usually difficult to accurately search for resources that match the target object's search needs based on the relatively simple search terms entered by the target object, so the target object needs to search for resources that meet the search needs through multiple rounds of searches. This will increase the search time and easily reduce the user experience because the target object cannot find resources that match the needs.
[0026] Embodiments of the present disclosure provide a resource retrieval method, a training method, an apparatus, an electronic device, and a storage medium based on a large language model. The resource retrieval method based on a large language model includes: in response to receiving search information, using a large language model to process the search information to obtain a semantic coding sequence, wherein the semantic coding sequence includes at least one semantic coding identifier, and the semantic coding identifier represents at least one semantic attribute; determining an intermediate resource associated with the semantic coding sequence from candidate resources in a preset resource library; determining a target resource matching the search information based on the intermediate resource; and displaying the target resource.
[0027] According to an embodiment of the present disclosure, a large language model is used to process search information to obtain a semantic coding sequence related to the resources to be searched. The semantic coding identifier can represent at least one semantic attribute. Therefore, based on the semantic understanding ability and text prediction ability of the large language model, the output semantic coding sequence can determine the semantic attributes that match the search information under the condition of a relatively full understanding of the search demand intention of the search information. Then, at least one intermediate resource that matches the search information can be queried from a preset resource library based on the semantic attributes represented by the semantic coding sequence. By determining and displaying the target resource through the intermediate resource, the matching degree between the displayed target resource and the search intention of the search information can be improved, thereby improving the resource retrieval accuracy and retrieval efficiency.
[0028] Figure 1 An exemplary system architecture to which a large language model-based resource retrieval method and apparatus according to an embodiment of the present disclosure can be applied is schematically shown.
[0029] It should be noted that Figure 1 The examples shown are only examples of system architectures to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but do not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios. For example, in another embodiment, an exemplary system architecture to which the resource retrieval method and apparatus based on a large language model can be applied may include a terminal device, but the terminal device may implement the resource retrieval method and apparatus based on a large language model provided by the embodiments of the present disclosure without interacting with the server.
[0030] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0031] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 101, 102, 103, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software, etc. (only as examples).
[0032] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0033] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for the content browsed by the user using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device.
[0034] It should be noted that the resource retrieval method based on the large language model provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the resource retrieval device based on the large language model provided in the embodiment of the present disclosure can generally be set in the server 105. The resource retrieval method based on the large language model provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the resource retrieval device based on the large language model provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105.
[0035] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0036] Figure 2 The flowchart of the resource retrieval method based on a large language model according to an embodiment of the present disclosure is schematically shown.
[0037] like Figure 2 As shown, the resource retrieval method based on a large language model includes operations S210 to S240.
[0038] In operation S210, in response to receiving the search information, the search information is processed using a large language model to obtain a semantic coding sequence, wherein the semantic coding sequence includes at least one semantic coding identifier, and the semantic coding identifier represents at least one semantic attribute.
[0039] In operation S220, an intermediate resource associated with the semantic coding sequence is determined from candidate resources in a preset resource library.
[0040] In operation S230, a target resource matching the search information is determined based on the intermediate resources.
[0041] In operation S240 , the target resource is displayed.
[0042] According to an embodiment of the present disclosure, the search information may include text information generated based on the input operation of the target object, for example, the text information may be obtained based on various types of information such as text, image, audio, etc. input by the target object in the search information input box of the page. The search information may be represented based on natural language, or may also be represented based on other types of text such as numbers, characters, etc. The embodiment of the present disclosure does not limit the specific type of the search information.
[0043] According to an embodiment of the present disclosure, a large language model (LLM) may include a deep learning model trained using a large amount of text data. For example, a large language model may include a model constructed based on a neural network model such as a Transformer model to understand the meaning of language text and generate natural language text. A large language model can process natural language tasks. Since large language models usually contain billions of parameters, large-scale parameters can help large language models learn complex patterns in natural language data, thereby performing better in natural language processing (NLP) tasks.
[0044] According to an embodiment of the present disclosure, the semantic coding identifier in the semantic coding sequence can represent the semantic attribute of the resource that matches the demand intent of the search information, for example, the semantic attribute "plant cultivation" can be represented based on the semantic identification code "1". For another example, the semantic attribute "flower cultivation" can also be represented based on the semantic identification code "2".
[0045] According to the embodiments of the present disclosure, semantic coding identifiers can be represented based on characters or strings, semantic coding identifiers can correspond one-to-one to semantic attributes, and a semantic coding sequence can be a plurality of semantic coding identifiers arranged in sequence. Multiple semantic coding identifiers in a semantic coding sequence can represent multiple semantic attributes. Therefore, the retrieval scope of resource information can be determined based on the semantic coding sequence, thereby improving retrieval efficiency and accuracy.
[0046] According to an embodiment of the present disclosure, a preset resource library may include one or more candidate resources, and the candidate resources may be associated with respective candidate semantic coding sequences, and the candidate semantic coding sequences may represent multiple semantic attributes represented by the candidate resources.
[0047] According to the embodiments of the present disclosure, candidate resources may include any type of resources that can be browsed based on terminal devices such as smart phones, including news resources, advertising resources, video resources, etc. The embodiments of the present disclosure do not limit the specific types of candidate resources, and technical personnel in this field can make choices based on actual needs.
[0048] According to an embodiment of the present disclosure, intermediate resources associated with a semantic coding sequence are determined from candidate resources in a preset resource library, a candidate semantic coding sequence that at least partially matches the semantic coding sequence can be determined, and based on the association relationship between the candidate resources and the candidate semantic coding sequence, intermediate resources that match the semantic coding sequence are determined from the candidate resources.
[0049] According to an embodiment of the present disclosure, when the initial semantic coding sequences output by the large language model include multiple ones, a retrieval method such as a beam search method or a probabilistic random sampling method can also be used to obtain a semantic coding sequence from multiple initial semantic coding sequences, thereby achieving accurate retrieval of intermediate resources.
[0050] According to an embodiment of the present disclosure, determining a target resource matching the search information based on an intermediate resource may include: using the intermediate resource as a target resource to improve the recall rate of resource information. However, this is not limited to this, and multiple intermediate resources may be screened based on preset configuration parameters to obtain a target resource. Alternatively, a target resource may be generated based on a selection operation of the target object on the intermediate object. The embodiment of the present disclosure does not limit the specific method for determining the target resource, and those skilled in the art may make a selection based on actual needs.
[0051] Figure 3 The application scenario diagram of the resource retrieval method based on a large language model according to an embodiment of the present disclosure is schematically shown.
[0052] like Figure 3As shown, the application scenario may include an interactive interface 300. The target object may input the search information 311 "flowers" based on the search box 310 in the interactive interface 300. In response to obtaining the search information 311, the resource retrieval method provided by the embodiment of the present disclosure may be executed, and the search information 311 may be processed using a large language model to obtain a semantic coding sequence including multiple semantic coding identifiers, and the intermediate resources may be determined from a preset resource library using the semantic coding sequence. The large language model may also output feedback information 321 related to the semantic attributes of the intermediate resources, "OK, the following advertising resources related to "flowers", "flowers", "potted plants"... have been displayed to you:", and the intermediate resources may be determined as target resources 330. By displaying the feedback information 321 and the target resource 330 in the interactive interface 300, the target object is prompted to browse advertising resources 1, advertising resources 2, ... to advertising resources N, so as to improve the recall rate of advertising resources for the search information 311 "flowers".
[0053] According to an embodiment of the present disclosure, the resource retrieval method based on a large language model further includes: displaying intermediate resources.
[0054] According to an embodiment of the present disclosure, determining the target resource matching the search information according to the intermediate resources may include: in response to a confirmation operation on the target resource in the intermediate resources, determining the target resource according to the confirmation operation.
[0055] According to an embodiment of the present disclosure, intermediate resources can also be rendered in an interactive interface to facilitate selection by a target object in the interactive interface. The target object can determine one or more target resources that need to be browsed from multiple retrieved intermediate resources according to actual needs, thereby enabling the target object to retrieve more accurate intermediate resources by inputting search information in an open expression manner, and further determine the target resource based on the target object's autonomous selection operation, so that the target resource more accurately matches the target object's search needs.
[0056] According to an embodiment of the present disclosure, the resource retrieval method based on a large language model may also include: displaying a coding identification object sequence corresponding to a semantic coding sequence, responding to an editing operation on the coding identification object sequence, updating the semantic coding sequence according to the editing operation, and obtaining a new semantic coding sequence.
[0057] According to the embodiments of the present disclosure, a coding identifier object sequence can represent one or more semantic coding identifiers arranged in a semantic coding sequence. The target object can update the semantic coding identifiers in the semantic coding sequence by performing various types of editing operations such as deletion, addition, replacement, and confirmation on the coding identifier object sequence, thereby obtaining a new semantic coding sequence. New intermediate resources can be generated based on the new semantic coding sequence, and target resources that match the retrieval intention of the target object can be determined based on the new intermediate resources, thereby achieving timely update of the recalled intermediate resources to timely generate target resources to meet the timely needs of the target object.
[0058] Figure 4 An application scenario diagram of a resource retrieval method based on a large language model according to another embodiment of the present disclosure is schematically shown.
[0059] like Figure 4 As shown, the application scenario may include an interactive interface 400. The target object may input search information 411 "flower cultivation" based on the search box 410 in the interactive interface 400. In response to obtaining the search information 411, the resource retrieval method provided by the embodiment of the present disclosure may be executed, and the search information 411 may be processed using a large language model to obtain a semantic coding sequence containing multiple semantic coding identifiers, and feedback information 421 "OK, the required advertising semantic classification has been displayed for you" related to the search information 411 may also be obtained. The feedback information 421 and the coding identification object sequence 430 corresponding to the semantic coding sequence may be displayed in the interactive interface 400. The coding identification object sequence 430 may include multiple coding identification objects from "flower cultivation", "indoor flower cultivation", ... to "orchid cultivation", and the coding identification object may represent multiple semantic coding identifiers arranged in the semantic coding sequence, so that the target object can quickly and conveniently understand the semantic attributes of the recalled resources, so that the coding identification object sequence 430 may be edited to generate a new semantic coding sequence, thereby meeting the temporary retrieval needs of the target object.
[0060] According to an embodiment of the present disclosure, the resource retrieval method based on a large language model may also include: displaying a coding identification object sequence corresponding to a semantic coding sequence, in response to obtaining update requirement information for the coding identification object sequence, processing the update requirement information using a large language model to obtain a new semantic coding sequence, and displaying a coding identification object sequence representing the new semantic coding sequence.
[0061] According to an embodiment of the present disclosure, update requirement information can be based on a text representation based on natural language expression input by the target object, so that the target object can timely update the semantic coding sequence based on an open natural language expression, and then the target resource that better matches the temporary retrieval requirement of the target object can be retrieved according to the new semantic coding sequence.
[0062] According to an embodiment of the present disclosure, candidate resources are associated with candidate semantic coding sequences, and the candidate semantic coding sequences are determined based on the following operations: obtaining candidate resource-related information corresponding to the candidate resources; performing semantic feature extraction on the candidate resource-related information to obtain candidate resource-related semantic features; and determining the candidate semantic coding sequence based on the candidate resource-related semantic features.
[0063] According to an embodiment of the present disclosure, the candidate resource related information may include multiple types of information such as text and images representing the candidate resource. For example, if the candidate resource is an advertising resource, the candidate resource related information may include the advertising title, advertising promotion text, advertising icon information, advertising description information, etc. of the advertising resource. However, it is not limited to this, and other types of information related to the candidate resource may also be included, such as the jump page information of the advertising resource, the click-through rate of the advertising resource, the historical search terms corresponding to the advertising resource, and other interactive information related to the candidate resource when the candidate resource is an advertising resource.
[0064] It should be noted that when the advertisement-related information includes images, audio and other types of information, the advertisement-related information can be processed based on a text recognition algorithm to identify the text information, and then semantic features can be extracted from the identified text information to obtain semantic features related to the candidate resources.
[0065] According to the embodiments of the present disclosure, candidate resource-related information can be processed based on a pre-trained encoder network layer to achieve semantic feature extraction of candidate resource-related information. Candidate resource-related semantic features can characterize the semantic attributes of candidate resource-related information. By processing candidate resource-related semantic features through a deep learning algorithm, the candidate semantic coding identifiers in the obtained candidate semantic coding sequence can further accurately characterize the semantic attributes, thereby achieving resource retrieval based on the semantic coding sequence and the candidate semantic coding sequence output by the large language model. Under the condition of fully retaining multiple semantic attributes of candidate resource-related information, accurate retrieval can be achieved based on the semantic coding identifiers that characterize the semantic attributes, thereby improving the matching degree between the recalled intermediate resources and the search information requirements, and thus improving the retrieval accuracy and retrieval effect of the target resources.
[0066] In one embodiment of the present disclosure, candidate resource related information can be processed based on a pre-trained encoder to obtain a candidate related candidate semantic coding sequence. The pre-trained encoder may include an encoder network layer and a semantic semantic coding identifier embedding layer, and the semantic semantic coding identifier embedding layer may be used to process candidate resource related semantic features to obtain a candidate related candidate semantic coding sequence.
[0067] According to an embodiment of the present disclosure, determining a candidate semantic coding sequence based on candidate resource-related semantic features may also include: processing the candidate resource-related semantic features based on a clustering algorithm to obtain multiple candidate semantic coding identifiers; and determining the candidate semantic coding sequence based on the multiple candidate semantic coding identifiers.
[0068] According to an embodiment of the present disclosure, semantic features related to candidate resources can be processed based on any type of clustering algorithm. For example, semantic features related to candidate resources can be processed based on a hierarchical clustering algorithm to obtain multiple clusters, and coding identifiers corresponding to each of the multiple clusters can be determined as multiple candidate semantic coding identifiers corresponding to the candidate resources. Multiple candidate semantic coding identifiers can be arranged based on the hierarchical relationship between the multiple clusters to obtain a candidate semantic coding sequence.
[0069] According to the embodiments of the present disclosure, multiple semantic attributes of candidate resources are represented by candidate semantic coding sequences, so that multiple candidate semantic coding identifiers arranged in the candidate semantic coding sequence can represent the "hierarchical abstract" thinking mode of human thinking, and hierarchical and precise management of multiple semantic attributes of candidate resources is achieved. The semantic understanding ability of the large language model is used to fully learn the mapping relationship between the semantic coding sequence and the semantic attributes, so that the semantic coding sequence output by the large language model can accurately query the intermediate resources that match the semantic attributes of the search information requirements, thereby improving the accuracy of the recalled resource information.
[0070] In one embodiment of the present disclosure, the industry semantic attributes of the advertising resources can be first divided based on the industry to which the advertising supplier belongs, and a subset of advertising resources for each of the multiple industries can be obtained. The advertising resources in the subset of advertising resources for each industry can be used as candidate resources, and the candidate semantic coding sequences corresponding to the candidate resources can be determined. For example, the candidate semantic coding sequence can be "[1][4][5][1][9]", and the semantic attributes of the candidate semantic coding identifiers in the candidate semantic coding sequence are represented respectively: "[Legal Consulting]", "[Civil Consulting]", "[Divorce Consulting]", "[Divorce Property Division Consulting]", "[19th Group of Advertisements]". Therefore, the candidate advertising resources can be accurately retrieved based on the semantic coding sequence output by the large language model, avoiding the problem of low retrieval accuracy caused by recalling resources through semantic similarity calculation. At the same time, the semantic attributes related to the candidate resources can be accurately represented based on the semantic coding identifiers, avoiding the problem of feature information loss in the encoding process of the relevant information of the candidate resources, thereby improving the retrieval accuracy.
[0071] According to an embodiment of the present disclosure, using a large language model to process search information to obtain a semantic coding sequence may include: updating a preset search prompt template based on the search information to obtain search prompt information; and using a large language model to process the search prompt information to obtain a semantic coding sequence.
[0072] According to an embodiment of the present disclosure, a prompt template (or a prompt template) may be information used to help a large language model understand the task of generating a semantic coding sequence. The prompt template may be determined based on a prompt tag sequence that controls the large language model to make accurate predictions. The prompt tag sequence may include any type of prompt tags such as characters, fields, and text. The search prompt template may be filled based on the search information to obtain the search prompt information.
[0073] In an example of the present disclosure, the search hint information may be based on the following paragraph representation surrounded by “ / / ”:
[0074] / / The user's search information is "flowers", and the ad semantic coding sequence that can match it is: / /
[0075] By inputting the search hint information into the large language model, the large language model can output a semantic encoding sequence that matches the search information.
[0076] According to an embodiment of the present disclosure, using a large language model to process search information to obtain a semantic coding sequence includes: performing information query based on the search information to obtain associated search information; and using a large language model to process the search information and the associated search information to obtain a semantic coding sequence.
[0077] According to an embodiment of the present disclosure, the associated search information may represent background knowledge related to the search information, and the associated knowledge information associated with the search information may be queried based on a preset knowledge base, and then the associated search information may be generated based on the associated knowledge information.
[0078] According to the embodiments of the present disclosure, the preset search prompt template can be updated using the search information and the associated search information to obtain the search prompt information. The search prompt information is input into the large language model so that the large language model can understand the background knowledge related to the search information, thereby performing the retrieval task more accurately and outputting a semantic coding sequence matching the search information.
[0079] In an example of the present disclosure, the search hint information may be based on the following paragraph representation surrounded by “ / / ”:
[0080] / / The user's search information is "peony", and the background knowledge related to "peony" includes "Paeoniaceae, Paeonia genus..." The advertising semantic coding sequence that can match it is: / /
[0081] Figure 5 The flowchart of the method for training a large language model according to an embodiment of the present disclosure is schematically shown.
[0082] like Figure 5 As shown, the training method of the large language model includes operations S510 to S520.
[0083] In operation S510, a training sample is acquired, where the training sample includes sample search information and a sample semantic coding sequence corresponding to a sample resource.
[0084] In operation S520, an initial large language model is trained based on the sample search information and the sample semantic encoding sequence to obtain a trained large language model.
[0085] According to an embodiment of the present disclosure, the sample search information is associated with the sample resource, the sample semantic coding sequence includes at least one sample semantic coding identifier, and the sample semantic coding identifier represents at least one sample semantic attribute.
[0086] According to an embodiment of the present disclosure, the sample search information may include search information generated in a historical time period, and the sample resource may include resources obtained based on a selection operation corresponding to the search information in the historical time period. The sample semantic coding sequence may be obtained by processing the sample resource related information corresponding to the sample resource based on a pre-trained encoder.
[0087] According to an embodiment of the present disclosure, training an initial large language model based on sample search information and sample semantic coding sequences can include fine-tuning the model parameters of the pre-trained initial large language model, so that the trained large language model can fully learn the mapping relationship between the sample semantic coding sequence and the sample semantic attributes based on its own strong semantic understanding ability and autoregressive generation ability, so that the semantic coding sequence output by the large language model can accurately query the intermediate resources that match the semantic attributes required by the search information, thereby improving the accuracy of the recalled resource information.
[0088] It should be noted that the technical terms mentioned in the training method of the large language model provided in the embodiments of the present disclosure, including but not limited to sample resources, sample search information, and sample semantic coding sequences, have the same or corresponding attributes as the technical terms mentioned in the resource retrieval method based on the large language model provided in the above embodiments, including but not limited to candidate resources, search information, and candidate semantic coding sequences, and the embodiments of the present disclosure will not be repeated here.
[0089] The large language model trained by the large language model training method provided in the embodiment of the present disclosure can be applied to the resource retrieval method based on the large language model provided in the above embodiment, and the embodiment of the present disclosure will not be described in detail here.
[0090] According to an embodiment of the present disclosure, a preset resource library may be constructed based on sample resources provided by the embodiment of the present disclosure as candidate resources, and a sample semantic coding sequence corresponding to the sample resource may be represented as a candidate semantic coding sequence corresponding to the candidate resource.
[0091] According to an embodiment of the present disclosure, the training sample also includes sample resource related information corresponding to the sample resource.
[0092] According to an embodiment of the present disclosure, the sample resource related information may include multiple types of information such as text and images representing the sample resource. For example, if the sample resource is an advertising resource, the sample resource related information may include the advertising title, advertising promotion text, advertising icon information, advertising description information, etc. of the advertising resource. However, it is not limited to this, and other types of information related to the sample resource may also be included, such as the jump page information of the advertising resource, the click rate of the advertising resource, the historical search terms corresponding to the advertising resource, and other interactive information related to the sample resource when the sample resource is an advertising resource.
[0093] According to an embodiment of the present disclosure, training an initial large language model based on sample search information and a sample semantic coding sequence may include: training the initial large language model according to sample resource-related information to obtain an intermediate large language model; determining sample search prompt information according to the sample search information and a preset sample search prompt template; and training the intermediate large language model using the sample search prompt information and the sample semantic coding sequence.
[0094] According to an embodiment of the present disclosure, training an initial large language model based on sample resource-related information may include inputting sample resource-related information into the initial large language model to obtain a first semantic coding sequence, and using a loss value between the first semantic coding sequence and the sample semantic coding sequence to adjust model parameters of the initial large language model to obtain a trained intermediate large language model.
[0095] According to an embodiment of the present disclosure, training an initial large language model based on sample resource-related information may include: determining sample semantic hint information based on sample resource-related information and a preset sample semantic hint template; and training the initial large language model using the sample semantic hint information and the sample semantic encoding sequence.
[0096] Figure 6 The schematic diagram schematically shows the principle of training a large language model according to an embodiment of the present disclosure.
[0097] like Figure 6 As shown, training the initial large language model according to the sample resource related information to obtain the intermediate large language model may include: updating the preset sample semantic hint template according to the sample resource related information to obtain sample semantic hint information 601. Using the initial large language model 610 to process the sample semantic hint information 601, a first semantic coding sequence 603 is obtained. Using the sample semantic coding sequence 605 as a label, the initial large language model 610 is trained according to the first semantic coding sequence 603 and the sample semantic coding sequence 605 to obtain an intermediate large language model 620.
[0098] like Figure 6 As shown, using the sample search prompt information and the sample semantic coding sequence to train the intermediate large language model may include: inputting the sample search prompt information 602 into the intermediate large language model 620, and outputting the second semantic coding sequence 604. Using the sample semantic coding sequence 605 as a label, training the intermediate large language model 620 according to the second semantic coding sequence 604 and the sample semantic coding sequence 605, and obtaining a trained large language model.
[0099] For example, sample semantic hint information can be represented based on the following paragraph surrounded by “ / / ”:
[0100] / / The user's search information is "flowers", and the ad semantic coding sequence that can match it is: / /
[0101] For example, the sample search hint information can be expressed based on the following paragraphs surrounded by “ / / ”:
[0102] / / The title of the advertisement is XXXX, and the page content of the advertisement is yyyy. The corresponding advertisement semantic coding sequence is: / /
[0103] According to the embodiment of the present disclosure, the first stage training task can be generated according to the sample semantic prompt information, and the second stage training task can be generated according to the sample search prompt information. Through the first stage training task, the trained intermediate large language model can fully learn the mapping relationship between the semantic attributes of the sample resource related information and the sample semantic coding sequence, and through the second stage training task, the trained large language model can fully learn the mapping relationship between the search information and the sample resource related information and the sample semantic coding sequence, so that the large language model can realize multi-task learning ability, realize the accurate identification of the target object's retrieval intention according to the search information input by the target object, and search for the sample resource semantic attributes matching the retrieval intention, accurately characterize the retrieved sample resources (candidate resources) through the output semantic coding sequence, so that the trained large language model realizes the deep interaction between the search information and the semantic attributes related to the sample resources, and captures the cross-features between the search information and the semantic attributes related to the sample resources, realizes the integrated construction of model training and resource indexing, reduces the degree of dependence on index information, thereby realizing the modeling process of the large language model indexing for resources, improves the accuracy of resource retrieval, and improves the retrieval accuracy.
[0104] According to an embodiment of the present disclosure, training an initial large language model according to sample resource-related information to obtain an intermediate large language model may also include: inputting sample resource-related information into a preset encoder, outputting sample resource-related semantic features and at least one sample semantic coding identification feature; training an initial encoder according to the sample resource-related semantic features and at least one sample semantic coding identification feature to obtain a pre-trained encoder; and updating the initial large language model according to the pre-trained encoder to obtain an intermediate large language model.
[0105] According to an embodiment of the present disclosure, an initial encoder can be used to process sample resource-related information to obtain sample resource-related semantic features that represent semantic attributes, and sample semantic coding identification features corresponding to the sample semantic coding identification that represents the semantic attributes. The sample resource-related semantic features and the sample semantic coding identification features are processed based on a contrastive loss learning method, and then the initial encoder is trained to obtain a pre-trained encoder, which can enable the encoder to fully learn the mapping relationship between the sample semantic coding identification and the semantic attributes.
[0106] According to the embodiments of the present disclosure, the pre-trained encoder updates the initial large language model, and the learning ability of the pre-trained encoder can be transferred to the initial large language model through transfer training, so that the obtained intermediate large language model can learn the mapping relationship between the sample semantic coding identifier and the semantic attribute, reduce the frequency of adjusting the model parameters of the large language model, and reduce training overhead.
[0107] According to an embodiment of the present disclosure, a pre-trained encoder can be used to process sample resource-related information to obtain sample semantic coding identification features. The sample semantic coding identification features can be processed based on any encoding method to obtain a sample semantic coding identification, so that the sample semantic coding sequence can be determined according to the arrangement position relationship between the sample semantic coding identifications.
[0108] According to an embodiment of the present disclosure, the training sample may further include label semantic features corresponding to semantic features related to the sample resource.
[0109] According to an embodiment of the present disclosure, when the sample resource related information includes multiple items, the sample resource related semantic features corresponding to two different sample resource related information can be used as the label semantic features of each other, thereby realizing contrastive loss learning.
[0110] According to an embodiment of the present disclosure, training an initial encoder based on sample resource-related semantic features and at least one sample semantic coding identification feature may include: processing the sample resource-related semantic features and label semantic features according to a loss function to obtain a first loss value; determining a second loss value based on the difference between the sample resource-related semantic features and at least one sample semantic coding identification feature; and training the initial encoder based on the first loss value and the second loss value.
[0111] According to an embodiment of the present disclosure, processing sample resource-related semantic features and label semantic features according to a loss function may include: processing sample resource-related semantic features corresponding to different sample resource-related information respectively according to the loss function.
[0112] According to an embodiment of the present disclosure, the degree of difference between a sample resource-related semantic feature and at least one sample semantic coding identification feature can be determined based on the calculated similarity by calculating the similarity between the sample resource-related semantic feature and at least one sample semantic coding identification feature based on a similarity algorithm.
[0113] Figure 7 A schematic diagram of the principle of training a large language model according to another embodiment of the present disclosure is schematically shown.
[0114] like Figure 7 As shown, the initial encoder 700 may include an initial encoder network layer 710, a quantization layer 720, and a semantic coding identifier embedding layer 730. The initial encoder network layer 710 may be constructed based on a neural network algorithm, for example, the initial encoder network layer 710 may be constructed based on a convolutional neural network to achieve text feature extraction. The quantization layer 720 may be constructed based on a quantization ( ) algorithm is constructed.
[0115] like Figure 7 As shown, different sample resource related information 701 and 702 can be input into the initial encoder network layer 710 to implement semantic feature extraction for the sample resource related information 701 and 702, and obtain sample resource related semantic features 7011 and 7021. The sample resource related semantic features 7011 and 7021 are respectively input into the quantization layer 720 to obtain sample semantic coding identifiers corresponding to the sample resource related information 701 and 702. The sample semantic coding identifiers corresponding to the sample resource related information 701 and 702 are respectively input into the semantic coding identifier embedding layer 730 to implement inverse decoding of the sample semantic coding identifier, and obtain sample semantic coding identifier features 7012 and 7022 corresponding to the sample resource related information 701 and 702.
[0116] like Figure 7As shown, the sample resource-related semantic features 7011 and 7021 can be processed based on the loss function to obtain a first loss value, and a second loss value can be determined based on the difference between the sample resource-related semantic features 7011 and the sample semantic coding identification features 7012. The third loss value can also be determined based on the sample semantic coding identification features 7012 and 7022. The initial encoder is jointly trained based on the first loss value, the second loss value and the third loss value to obtain a pre-trained encoder.
[0117] According to an embodiment of the present disclosure, the third loss value can characterize the difference between the sample semantic coding identifiers corresponding to different sample resource-related information, so that the initial encoder can be trained by introducing the third loss value, so that the direction of information loss between the sample semantic coding identifiers output by the initial encoder during the training process will not be adjusted in the direction opposite to the training task, thereby improving the robustness of the pre-trained encoder and the recognition accuracy of the encoder for the semantic coding identifiers, so that the initial large language model can be updated by the pre-trained encoder to improve the prediction accuracy of the large language model for the semantic coding sequence.
[0118] According to an embodiment of the present disclosure, a sample semantic coding sequence corresponding to a sample resource is determined based on the following operations: inputting sample related information corresponding to the sample resource into an encoder, and outputting a sample semantic coding identifier.
[0119] According to an embodiment of the present disclosure, the sample semantic coding identifiers output by the encoder may include multiple sample semantic coding identifiers, and the multiple sample semantic coding identifiers may be arranged based on the positional relationship between the multiple sample semantic coding identifiers to obtain a sample semantic coding sequence.
[0120] In one embodiment of the present disclosure, the sample semantic coding sequence may be determined based on a sample semantic coding identifier output by an encoder network layer included in the encoder.
[0121] Figure 8 The block diagram of a resource retrieval device based on a large language model according to an embodiment of the present disclosure is schematically shown.
[0122] like Figure 8 As shown, the resource retrieval device 800 based on the large language model includes: a semantic coding sequence obtaining module 810, an intermediate resource determining module 820, a target resource determining module 830 and a first display module 840.
[0123] The semantic coding sequence obtaining module 810 is used to process the search information using a large language model in response to receiving the search information to obtain a semantic coding sequence, wherein the semantic coding sequence includes at least one semantic coding identifier, and the semantic coding identifier represents at least one semantic attribute.
[0124] The intermediate resource determination module 820 is used to determine the intermediate resource associated with the semantic coding sequence from the candidate resources in the preset resource library.
[0125] The target resource determination module 830 is used to determine the target resource matching the search information according to the intermediate resources.
[0126] The first display module 840 is used to display the target resource.
[0127] According to an embodiment of the present disclosure, candidate resources are associated with candidate semantic coding sequences, and the candidate semantic coding sequences are determined based on the following operations: obtaining candidate resource-related information corresponding to the candidate resources; performing semantic feature extraction on the candidate resource-related information to obtain candidate resource-related semantic features; and determining the candidate semantic coding sequence based on the candidate resource-related semantic features.
[0128] According to an embodiment of the present disclosure, determining a candidate semantic coding sequence according to candidate resource-related semantic features includes: processing the candidate resource-related semantic features based on a clustering algorithm to obtain multiple candidate semantic coding identifiers; and determining the candidate semantic coding sequence according to the multiple candidate semantic coding identifiers.
[0129] According to an embodiment of the present disclosure, the semantic coding sequence obtaining module includes: an information query submodule and a first semantic coding sequence obtaining submodule.
[0130] The information query submodule is used to perform information query based on the search information to obtain related search information.
[0131] The first semantic coding sequence obtaining submodule is used to process the search information and the associated search information using the large language model to obtain a semantic coding sequence.
[0132] According to an embodiment of the present disclosure, the semantic coding sequence obtaining module includes: a search prompt information obtaining submodule and a second semantic coding sequence obtaining submodule.
[0133] The search prompt information obtaining submodule is used to update a preset search prompt template based on the search information to obtain the search prompt information.
[0134] The second semantic coding sequence obtaining submodule is used to process the search prompt information using the large language model to obtain a semantic coding sequence.
[0135] According to an embodiment of the present disclosure, the resource retrieval device based on a large language model further includes a second display module.
[0136] The second display module is used to display intermediate resources;
[0137] According to an embodiment of the present disclosure, the target resource determination module includes a target resource determination submodule.
[0138] The target resource determination submodule is used to respond to a confirmation operation on a target resource in the intermediate resources and determine the target resource according to the confirmation operation.
[0139] According to an embodiment of the present disclosure, the resource retrieval device based on a large language model further includes a third display module and an update module.
[0140] The third display module is used to display the coding identification object sequence corresponding to the semantic coding sequence.
[0141] The updating module is used to respond to the editing operation on the coding identification object sequence, update the semantic coding sequence according to the editing operation, and obtain a new semantic coding sequence.
[0142] Fig. 9 A block diagram of a large language model training device according to an embodiment of the present disclosure is schematically shown.
[0143] like Fig. 9 As shown, the large language model training device 900 may include: an acquisition module 910 and a training module 920 .
[0144] The acquisition module 910 is used to acquire training samples, where the training samples include sample search information and a sample semantic coding sequence corresponding to a sample resource, wherein the sample search information is associated with the sample resource, and the sample semantic coding sequence includes at least one sample semantic coding identifier, and the sample semantic coding identifier represents at least one sample semantic attribute.
[0145] The training module 920 is used to train the initial large language model based on the sample search information and the sample semantic coding sequence to obtain a trained large language model.
[0146] According to an embodiment of the present disclosure, the training sample also includes sample resource related information corresponding to the sample resource.
[0147] The training module includes: a first training submodule, a sample search prompt information determination submodule and a second training submodule.
[0148] The first training submodule is used to train an initial large language model according to sample resource related information to obtain an intermediate large language model.
[0149] The sample search prompt information determination submodule is used to determine the sample search prompt information according to the sample search information and a preset sample search prompt template.
[0150] The second training submodule is used to train the intermediate large language model using the sample search prompt information and the sample semantic encoding sequence.
[0151] According to an embodiment of the present disclosure, the first training submodule includes: a first encoding unit, a pre-training unit and an updating unit.
[0152] The first encoding unit is used to input sample resource related information into a preset encoder, and output sample resource related semantic features and at least one sample semantic coding identification feature.
[0153] The pre-training unit is used to train an initial encoder according to the sample resource related semantic features and at least one sample semantic coding identification feature to obtain a pre-trained encoder.
[0154] An updating unit is used to update the initial large language model according to the pre-trained encoder to obtain an intermediate large language model.
[0155] According to an embodiment of the present disclosure, the training sample further includes label semantic features corresponding to semantic features related to the sample resource.
[0156] According to an embodiment of the present disclosure, the pre-training unit includes: a first loss value obtaining subunit, a second loss value obtaining subunit and a training subunit.
[0157] The first loss value obtaining subunit is used to process the sample resource related semantic features and label semantic features according to the loss function to obtain a first loss value.
[0158] The second loss value obtaining subunit is used to determine the second loss value according to the difference between the sample resource related semantic feature and at least one sample semantic coding identification feature.
[0159] A training subunit is used to train an initial encoder according to the first loss value and the second loss value.
[0160] According to an embodiment of the present disclosure, a sample semantic coding sequence corresponding to a sample resource is determined based on the following operations: inputting sample related information corresponding to the sample resource into an encoder, and outputting a sample semantic coding identifier.
[0161] According to an embodiment of the present disclosure, the first training submodule includes: a sample semantic prompt information determination unit and a training unit.
[0162] The sample semantic hint information determining unit is used to determine the sample semantic hint information according to the sample resource related information and a preset sample semantic hint template.
[0163] The training unit is used to train an initial large language model using sample semantic prompt information and sample semantic encoding sequences.
[0164] 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.
[0165] According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0166] According to an embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute the method as described above.
[0167] According to an embodiment of the present disclosure, a computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the method as described above.
[0168] Fig.10 A block diagram of an electronic device suitable for implementing a resource retrieval method and a training method based on a large language model according to an embodiment of the present disclosure is schematically shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, 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.
[0169] like Fig.10 As shown, the device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0170] A number of components in the device 1000 are connected to the I / O interface 1005, including: an input unit 1006, such as a keyboard, a mouse, etc.; an output unit 1007, such as various types of displays, speakers, etc.; a storage unit 1008, such as a disk, an optical disk, etc.; and a communication unit 1009, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1009 allows the device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0171] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics 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 1001 performs the various methods and processes described above, such as resource retrieval methods and training methods based on large language models. For example, in some embodiments, resource retrieval methods and training methods based on large language models may be implemented as computer software programs, which are tangibly included in machine-readable media, such as storage units 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1000 via ROM 1002 and / or communication unit 1009. When the computer program is loaded into RAM 1003 and executed by the computing unit 1001, one or more steps of the resource retrieval methods and training methods based on large language models described above may be executed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute a resource retrieval method and a training method based on a large language model in any other appropriate manner (for example, by means of firmware).
[0172] 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), load 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.
[0173] 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.
[0174] 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 device, 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.
[0175] 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, voice input, or tactile input).
[0176] 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 communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0177] A computer system may include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises through computer programs running on respective computers and having a client-server relationship to each other. The server may be a cloud server, a server in a distributed system, or a server combined with a blockchain.
[0178] 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.
[0179] 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. A resource retrieval method based on a large language model, comprising: In response to receiving the search information, the search information is processed using a large language model to obtain a semantic coding sequence, wherein the semantic coding sequence includes at least one semantic coding identifier, the semantic coding identifier represents at least one semantic attribute, the large language model is trained based on the sample search information and a sample semantic coding sequence corresponding to a sample resource, the sample semantic coding sequence includes at least one sample semantic coding identifier, the sample semantic coding identifier represents at least one sample semantic attribute, and the sample semantic coding sequence is obtained based on a pre-trained encoder processing sample related information corresponding to the sample resource; Determine an intermediate resource associated with the semantic coding sequence from candidate resources in a preset resource library; Determining, based on the intermediate resources, a target resource that matches the search information; and The target resource is displayed.
2. The method according to claim 1, wherein: The candidate resource is associated with a candidate semantic coding sequence, and the candidate semantic coding sequence is determined based on the following operations: Acquire candidate resource related information corresponding to the candidate resource; Extracting semantic features from the candidate resource related information to obtain semantic features related to the candidate resource; as well as The candidate semantic coding sequence is determined according to the semantic features related to the candidate resource.
3. The method according to claim 2, wherein: The determining the candidate semantic coding sequence according to the semantic features related to the candidate resource comprises: Processing the semantic features related to the candidate resources based on a clustering algorithm to obtain a plurality of candidate semantic coding identifiers; and The candidate semantic coding sequence is determined according to the multiple candidate semantic coding identifiers.
4. The method according to claim 1, wherein: The using of a large language model to process the search information to obtain a semantic coding sequence comprises: Performing information query based on the search information to obtain related search information; The search information and the associated search information are processed using the large language model to obtain the semantic coding sequence.
5. The method according to claim 1, wherein: The using of a large language model to process the search information to obtain a semantic coding sequence comprises: Based on the search information, a preset search prompt template is updated to obtain search prompt information; The search prompt information is processed using the large language model to obtain the semantic coding sequence.
6. The method according to any one of claims 1 to 5, further comprising: displaying the intermediate resource; Wherein, determining the target resource matching the search information according to the intermediate resource includes: In response to a confirmation operation on a target resource among the intermediate resources, the target resource is determined according to the confirmation operation.
7. The method according to any one of claims 1 to 5, further comprising: Displaying a sequence of coded identification objects corresponding to the semantic coding sequence, In response to an editing operation on the coding identification object sequence, the semantic coding sequence is updated according to the editing operation to obtain a new semantic coding sequence.
8. A method for training a large language model, comprising: Acquire a training sample, wherein the training sample includes sample search information and a sample semantic coding sequence corresponding to a sample resource, wherein the sample search information is associated with the sample resource, the sample semantic coding sequence includes at least one sample semantic coding identifier, the sample semantic coding identifier represents at least one sample semantic attribute, and the sample semantic coding sequence is obtained by processing sample resource related information corresponding to the sample resource based on a pre-trained encoder; An initial large language model is trained based on the sample search information and the sample semantic coding sequence to obtain a large language model for determining the semantic coding sequence.
9. The method according to claim 8, wherein: The training sample also includes sample resource related information corresponding to the sample resource. The training of the initial large language model based on the sample search information and the sample semantic coding sequence comprises: Training the initial large language model according to the sample resource related information to obtain an intermediate large language model; Determining sample search prompt information according to the sample search information and a preset sample search prompt template; and The intermediate large language model is trained using the sample search prompt information and the sample semantic encoding sequence.
10. The method according to claim 9, wherein: The training of the initial large language model according to the sample resource related information to obtain the intermediate large language model comprises: Inputting the sample resource related information into a preset initial encoder, and outputting a sample resource related semantic feature and at least one sample semantic coding identification feature; Training the initial encoder according to the sample resource related semantic features and the at least one sample semantic encoding identification feature to obtain a pre-trained encoder; and The initial large language model is updated according to the pre-trained encoder to obtain the intermediate large language model.
11. The method according to claim 10, wherein: The training sample also includes label semantic features corresponding to semantic features related to the sample resource; The step of training the initial encoder according to the sample resource related semantic features and the at least one sample semantic coding identification feature comprises: Processing the sample resource related semantic features and the label semantic features according to the loss function to obtain a first loss value; determining a second loss value according to a difference between the sample resource-related semantic feature and the at least one sample semantic coding identification feature; and The initial encoder is trained according to the first loss value and the second loss value.
12. The method according to claim 10, wherein: The sample semantic coding sequence corresponding to the sample resource is determined based on the following operations: The sample related information corresponding to the sample resource is input into the encoder, and the sample semantic coding identifier is output.
13. The method according to claim 9, wherein: The training of the initial large language model according to the sample resource related information includes: Determining sample semantic prompt information according to the sample resource related information and a preset sample semantic prompt template; and The initial large language model is trained using the sample semantic prompt information and the sample semantic encoding sequence.
14. A resource retrieval device based on a large language model, comprising: A semantic coding sequence acquisition module, configured to, in response to receiving search information, process the search information using a large language model to obtain a semantic coding sequence, wherein the semantic coding sequence includes at least one semantic coding identifier, the semantic coding identifier represents at least one semantic attribute, the large language model is obtained by training based on sample search information and a sample semantic coding sequence corresponding to a sample resource, the sample semantic coding sequence includes at least one sample semantic coding identifier, the sample semantic coding identifier represents at least one sample semantic attribute, and the sample semantic coding sequence is obtained by processing sample related information corresponding to a sample resource based on a pre-trained encoder; An intermediate resource determination module, used to determine the intermediate resource associated with the semantic coding sequence from the candidate resources in the preset resource library; a target resource determination module, configured to determine a target resource matching the search information based on the intermediate resource; and The first display module is used to display the target resource.
15. The device according to claim 14, wherein: The candidate resource is associated with a candidate semantic coding sequence, and the candidate semantic coding sequence is determined based on the following operations: Acquire candidate resource related information corresponding to the candidate resource; Extracting semantic features from the candidate resource related information to obtain semantic features related to the candidate resource; as well as The candidate semantic coding sequence is determined according to the semantic features related to the candidate resource.
16. The device according to claim 15, wherein: The determining the candidate semantic coding sequence according to the semantic features related to the candidate resource comprises: Processing the semantic features related to the candidate resources based on a clustering algorithm to obtain a plurality of candidate semantic coding identifiers; and The candidate semantic coding sequence is determined according to the multiple candidate semantic coding identifiers.
17. The device according to claim 14, wherein: The semantic coding sequence acquisition module comprises: An information query submodule, used to perform information query based on the search information to obtain related search information; The first semantic coding sequence obtaining submodule is used to process the search information and the associated search information using the large language model to obtain the semantic coding sequence.
18. The device according to claim 14, wherein: The semantic coding sequence acquisition module comprises: A search prompt information obtaining submodule, used for updating a preset search prompt template based on the search information to obtain search prompt information; The second semantic coding sequence obtaining submodule is used to process the search prompt information using the large language model to obtain the semantic coding sequence.
19. The device according to any one of claims 14 to 18, further comprising: A second display module, used to display the intermediate resources; Wherein, the target resource determination module includes: The target resource determination submodule is used to respond to a confirmation operation on a target resource in the intermediate resource and determine the target resource according to the confirmation operation.
20. The device according to any one of claims 14 to 18, further comprising: The third display module is used to display the coding identification object sequence corresponding to the semantic coding sequence, The updating module is used to respond to an editing operation on the coding identification object sequence and update the semantic coding sequence according to the editing operation to obtain a new semantic coding sequence.
21. A large language model training device, comprising: an acquisition module, configured to acquire a training sample, wherein the training sample includes sample search information and a sample semantic coding sequence corresponding to a sample resource, wherein the sample search information is associated with the sample resource, the sample semantic coding sequence includes at least one sample semantic coding identifier, the sample semantic coding identifier represents at least one sample semantic attribute, and the sample semantic coding sequence is obtained by processing sample resource related information corresponding to the sample resource based on a pre-trained encoder; The training module is used to train an initial large language model based on the sample search information and the sample semantic coding sequence to obtain a large language model for determining the semantic coding sequence.
22. The device according to claim 21, wherein The training sample also includes sample resource related information corresponding to the sample resource. The training module includes: A first training submodule, configured to train the initial large language model according to the sample resource related information to obtain an intermediate large language model; a sample search prompt information determination submodule, configured to determine the sample search prompt information according to the sample search information and a preset sample search prompt template; and The second training submodule is used to train the intermediate large language model using the sample search prompt information and the sample semantic coding sequence.
23. The device according to claim 22, wherein: The first training submodule includes: A first encoding unit, configured to input the sample resource related information into a preset initial encoder, and output a sample resource related semantic feature and at least one sample semantic coding identification feature; a pre-training unit, configured to train the initial encoder according to the sample resource related semantic features and the at least one sample semantic coding identification feature to obtain a pre-trained encoder; and An updating unit is used to update the initial large language model according to the pre-trained encoder to obtain the intermediate large language model.
24. The device according to claim 23, wherein: The training sample also includes label semantic features corresponding to semantic features related to the sample resource; Wherein, the pre-training unit comprises: A first loss value obtaining subunit, configured to process the sample resource related semantic features and the label semantic features according to a loss function to obtain a first loss value; a second loss value obtaining subunit, configured to determine a second loss value according to a difference between the sample resource related semantic feature and the at least one sample semantic coding identification feature; and A training subunit is used to train the initial encoder according to the first loss value and the second loss value.
25. The device according to claim 23, wherein: The sample semantic coding sequence corresponding to the sample resource is determined based on the following operations: The sample related information corresponding to the sample resource is input into the encoder, and the sample semantic coding identifier is output.
26. The device according to claim 22, wherein: The first training submodule includes: a sample semantic hint information determining unit, configured to determine the sample semantic hint information according to the sample resource related information and a preset sample semantic hint template; and A training unit is used to train the initial large language model using the sample semantic prompt information and the sample semantic encoding sequence.
27. 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 executable 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 13.
28. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 13.
29. 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 13.
