Query method and electronic device
By rewriting query statements using both offline and online query rewriting models, and combining this with a multimodal document rewriting model, the problem of traditional search engines' insufficient understanding of complex query statements is solved, thereby improving the processing capabilities of the query system and the document matching success rate.
Patent Information
- Application Number
- CN202511134053.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-14
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-08-14
AI Technical Summary
Traditional search engines struggle to accurately understand complex queries, leading to inaccurate search results.
The query statements are rewritten using pre-trained offline and online query rewriting models, and combined with a multimodal document rewriting model to enrich document information, thereby improving the matching success rate and recall dimension of the query statements.
It significantly improves the ability to handle complex queries and the document matching success rate, thus optimizing query performance.
Smart Images

Figure CN120705290B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a query method and an electronic device. Background Technology
[0002] As user needs become more complex and information becomes more voluminous, traditional search engines face the challenge of accurately understanding user query intent. For short queries, search engines often struggle to accurately grasp the user's intent, leading to inaccurate search results. Therefore, improving the intelligence of search engines to better understand complex queries and generate high-quality results is one of the most pressing issues to be addressed. Summary of the Invention
[0003] This application provides a query method and an electronic device to alleviate or solve one or more technical problems existing in the prior art.
[0004] Firstly, embodiments of this application provide a query method, including:
[0005] In response to querying documents using a first query statement, a pre-generated query terminology and document library are obtained; the query terminology includes the original query statement and the rewritten query statement obtained by rewriting the original query statement using a pre-trained offline query statement rewriting model; the document library includes the original documents associated with each query statement and the rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model; the offline query statement rewriting model is obtained by training a large language model based on first sample data related to historical query records; the multimodal document rewriting model is obtained by training a multimodal language model using second sample data, the second sample data including sample image information related to the sample query object and / or sample text information corresponding to the sample image information;
[0006] The first query statement is matched with the query terminology to determine whether the query terminology contains the first query statement;
[0007] If the query terminology contains the first query statement, the first query statement is used to query the document library to obtain a first target document associated with the first query statement from the original document and / or the rewritten document;
[0008] If the query lexicon does not contain the first query statement, the first query statement is rewritten using a pre-trained online query statement rewriting model to obtain a second query statement rewritten online. The second query statement is then used to query the document library to obtain a second target document associated with the second query statement from the original document and / or the rewritten document. The online query statement rewriting model is obtained by training the large language model using the first sample data. The model parameters of the online query statement rewriting model are fewer than those of the offline query statement rewriting model.
[0009] Optionally, before responding to querying documents using the first query statement and obtaining the pre-generated query thesaurus and document thesaurus, the method further includes:
[0010] Obtain first sample data; the first sample data includes: the original sample query statement and the sample rewritten query statement corresponding to the original sample query statement;
[0011] The first sample data is input into the large language model to be trained to obtain the offline query rewriting model and the online query rewriting model.
[0012] Optionally, the original sample query statement includes a first original query statement; the rewritten sample query statement includes a first rewritten query statement.
[0013] The acquisition of the first sample data includes:
[0014] Based on the historical query records, a user session click graph for the first historical time period is obtained; the user session click graph includes: query information entered by the user and document information clicked by the user;
[0015] Based on the query statement information and the document information, a query document association graph is constructed; the query document association graph is used to represent the association relationship between the first original query statement and the first original document.
[0016] Generate the first rewritten query statement corresponding to the first original query statement.
[0017] Optionally, the original sample query statement includes the core entity in the document title; the rewritten sample query statement includes a second rewritten query statement.
[0018] The acquisition of the first sample data includes:
[0019] Based on the historical query records, obtain the historical query statements and the historical documents associated with the historical query statements within the second historical time period;
[0020] Based on the query intent expressed by the historical query statements, extract the core entities from the document titles of the historical documents;
[0021] The core entity is expanded to obtain the second rewritten query statement.
[0022] Optionally, after obtaining the first sample data, the method further includes:
[0023] Calculate the semantic similarity between the original query statement of the sample and the rewritten query statement of the sample;
[0024] The sample rewritten query statements are screened out based on the semantic similarity, so that the semantic similarity of the retained sample rewritten query statements is higher than or equal to a preset threshold.
[0025] Optionally, after inputting the first sample data into the large language model to be trained for model training to obtain the offline query rewriting model and the online query rewriting model, the method further includes:
[0026] The second original query statement is rewritten using the offline query statement rewriting model to obtain the third rewritten query statement;
[0027] Collect the query document pairs corresponding to the third rewritten query statement; the query document pairs are used to represent the documents retrieved based on the third rewritten query statement;
[0028] The offline query statement rewriting model is optimized based on the click-through rate of the query document pairs.
[0029] Optionally, before responding to querying documents using the first query statement and obtaining the pre-generated query thesaurus and document thesaurus, the method further includes:
[0030] Obtain second sample data; the second sample data includes: the sample image information and the sample text information; the sample text information includes: the sample document title associated with the sample image information, the object attribute information of the sample query object, and the sample rewriting information;
[0031] The second sample data is input into the multimodal language model to be trained to obtain the multimodal document rewriting model.
[0032] Optionally, obtaining the second sample data includes:
[0033] The sample image information, the sample document title, and the object attribute information are input into the artificial intelligence model for rewriting to obtain the sample rewritten information.
[0034] Optionally, the method further includes:
[0035] Add the second query statement to the query term database;
[0036] Establish the association between the second query statement and the second target document.
[0037] Secondly, embodiments of this application provide a query device, including:
[0038] The first acquisition module is configured to, in response to querying documents using a first query statement, acquire a pre-generated query terminology and document library; the query terminology includes the original query statement and the rewritten query statement obtained by rewriting the original query statement using a pre-trained first query statement rewriting model; the document library includes the original documents associated with each query statement and the rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model; the offline query statement rewriting model is obtained by training a large language model based on first sample data related to historical query records; the multimodal document rewriting model is obtained by training a multimodal language model using second sample data, the second sample data including sample image information related to the sample query object and / or sample text information corresponding to the sample image information;
[0039] A matching module is used to match the first query statement with the query term database to determine whether the query term database contains the first query statement;
[0040] The second acquisition module is configured to: if the query terminology contains the first query statement, query the document library using the first query statement to obtain a first target document associated with the first query statement from the original document and / or the rewritten document; if the query terminology does not contain the first query statement, rewrite the first query statement using a pre-trained online query statement rewriting model to obtain a second query statement rewritten online; and query the document library using the second query statement to obtain a second target document associated with the second query statement from the original document and / or the rewritten document; wherein the online query statement rewriting model is obtained by training the large language model using the first sample data; and the model parameters of the online query statement rewriting model are fewer than those of the offline query statement rewriting model.
[0041] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory, wherein the processor implements any of the methods of embodiments of this application when executing the computer program.
[0042] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method of any one of the embodiments of this application.
[0043] Fifthly, embodiments of this application provide a computer program product, including a computer program, which, when executed by a processor, implements any of the methods described in the embodiments of this application.
[0044] According to the technical solution of this application embodiment, when querying a document using a first query statement, a pre-generated query terminology and document library are obtained, and then the first query statement and the query terminology are matched to determine whether the query terminology contains the first query statement. Since the query terminology includes the original query statement and the rewritten query statement obtained by rewriting the original query statement using a pre-trained offline query statement rewriting model, such as synonyms and near-synonyms of the original query statement, the matching success rate of the first query statement can be improved. Furthermore, if the query terminology contains the first query statement, the document library is queried using the first query statement to obtain the first target document associated with the first query statement from the document library. Since the document library includes the original documents associated with each query statement and the rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model, such as documents with the same semantics as the original document, when matching the first query statement, both the original document and its corresponding rewritten document can be used as matching objects, thereby improving the success rate of the first query statement matching a document. It is evident that by simultaneously rewriting both the query and document sides, document information can be significantly enriched, enhancing the ability of query systems (such as search engines) to handle complex queries. Furthermore, when the query thesaurus does not contain the first query, a pre-trained online query rewriting model can be used to rewrite the first query, resulting in a rewritten second query. This second query is then used to query the document library to retrieve a second target document associated with the second query from the original and / or rewritten documents. Since online rewriting expands the query semantically, matching documents through online rewritten queries greatly improves the document matching success rate. Moreover, by performing document queries from both offline and online dimensions, the document recall dimension is significantly expanded, optimizing query performance.
[0045] The technical solution of this application can be applied to the transaction and delivery services of instant e-commerce platforms, such as Taobao Flash Sale, Taoxianda, Ele.me takeaway and retail.
[0046] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application, it can be implemented according to the contents of the specification. In order to make the above and other objects, features and advantages of this application more obvious and understandable, specific embodiments of this application are given below. Attached Figure Description
[0047] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the various drawings denote the same or similar parts or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings depict only some embodiments according to this application and should not be construed as limiting the scope of this application.
[0048] Figure 1 A flowchart of the query method provided in an embodiment of this application is shown;
[0049] Figure 2 This diagram illustrates the training principle of the first query statement rewriting model provided in an embodiment of this application.
[0050] Figure 3 The diagram illustrates the training principle of the document rewriting model provided in an embodiment of this application.
[0051] Figure 4 A schematic diagram of the query method provided in an embodiment of this application is shown;
[0052] Figure 5 A block diagram of the query device provided in an embodiment of this application is shown;
[0053] Figure 6 A block diagram of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0054] In the following description, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments can be modified in various ways without departing from the concept or scope of this application. Therefore, the drawings and description are considered to be exemplary in nature and not restrictive.
[0055] To facilitate understanding of the technical solutions of the embodiments of this application, the relevant technologies of the embodiments of this application are described below. The following relevant technologies are optional solutions and can be combined with the technical solutions of the embodiments of this application in any way, and all of them fall within the protection scope of the embodiments of this application.
[0056] The following terms will be used in the following text:
[0057] LLM: Large Language Model, used to process and understand complex natural language queries.
[0058] VLM: Visual Language Model, is an artificial intelligence model that combines visual and language processing capabilities. It can simultaneously understand image content and text information, and combine image and text information for search and retrieval.
[0059] SFT: Supervised Fine-Tuning is a technique in machine learning that uses labeled data to make targeted adjustments to a pre-trained model, aiming to make the model more suitable for a specific task or domain, thereby improving model performance.
[0060] LORA: Low-Rank Adaptation, which achieves rapid fine-tuning of the model by adding new extension layers.
[0061] DPO: Direct Probability Ordering, which sorts probabilities based on generation probabilities.
[0062] This application aims to provide a query method that enriches both the query statement and the document content by simultaneously rewriting both the query side and the document side. When querying a document using a first query statement, a pre-generated query terminology and document library are first obtained. The first query statement is then matched with the query terminology to determine if the query terminology contains the first query statement. Since the query terminology includes the original query statement and the rewritten query statement obtained by rewriting the original query statement using a pre-trained offline query statement rewriting model (e.g., synonyms and near-synonyms of the original query statement), the matching success rate of the first query statement can be improved. Furthermore, if the query terminology contains the first query statement, the first query statement is used to query the document library to obtain a first target document associated with the first query statement. Since the document library includes the original documents associated with each query statement and the rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model (such as documents with the same semantics as the original documents), when matching the first query statement, both the original documents and their corresponding rewritten documents can be used as matching objects, thereby improving the success rate of matching documents with the first query statement. It is evident that by rewriting both the query side and the document side simultaneously, document information can be greatly enriched, enhancing the query system's (such as a search engine's) ability to handle complex query statements. Furthermore, when the query thesaurus does not contain the first query statement, the first query statement can be rewritten using a pre-trained online query statement rewriting model to obtain the online rewritten second query statement. This second query statement is then used to query the document library to retrieve the second target document associated with the second query statement from the original documents and / or rewritten documents. Since online rewriting can expand the query statement semantically, matching documents through online rewritten query statements greatly improves the document matching success rate. Moreover, by performing document queries from both offline and online dimensions, the document recall dimension is significantly expanded, optimizing the query performance.
[0063] Furthermore, this application embodiment rewrites the query side and document side by combining a large language model and a visual language model, improving the ability to process complex query statements, thereby ensuring comprehensive understanding and efficient retrieval in complex query scenarios. In addition, the use of a visual language model enables visual information (such as images) to be fully understood and expanded, so that the document content is no longer limited to single text, thereby deeply expanding the document content and achieving accurate matching and retrieval.
[0064] It should be noted that the application scenarios or examples provided in the embodiments of this application are for ease of understanding, and the embodiments of this application do not specifically limit the application of the technical solutions. In addition, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0065] The technical solution of this application and how it solves the aforementioned technical problems are described in detail below with specific embodiments. The listed specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0066] Figure 1 A flowchart of the query method provided in an embodiment of this application is shown, such as... Figure 1 As shown, the method may include steps S101, S102, S103 and S104.
[0067] Step S101: In response to querying documents using the first query statement, obtain the pre-generated query thesaurus and document library.
[0068] The query lexicon includes the original query statement and the rewritten query statement obtained by rewriting the original query statement using a pre-trained offline query statement rewriting model. The rewritten query statement may include at least one of the following: synonyms, near-synonyms, and words with semantic similarity higher than a predetermined threshold of the original query statement.
[0069] The document library includes the original documents associated with each query statement, and the rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model. Rewritten documents may include at least one of the following: documents with a semantic similarity to the original document higher than a predetermined threshold, or documents used to describe image information in the original document.
[0070] The offline query rewriting model is trained on a large language model using first-sample data related to historical query records. The multimodal document rewriting model is trained on a multimodal language model using second-sample data, which includes sample image information related to the sample query object and / or sample text information corresponding to the sample image information.
[0071] Step S102: Match the first query statement with the query terminology to determine whether the query terminology contains the first query statement.
[0072] Step S103: If the query thesaurus contains the first query statement, the document library is queried using the first query statement to obtain the first target document associated with the first query statement from the original document and / or the rewritten document.
[0073] Step S104: If the query lexicon does not contain the first query statement, the first query statement is rewritten using a pre-trained online query statement rewriting model to obtain the online rewritten second query statement; the second query statement is used to query the document library to obtain the second target document associated with the second query statement from the original document and / or the rewritten document.
[0074] The online query rewriting model is trained on a large language model using the first sample data, and it has fewer model parameters than the offline query rewriting model. Documents associated with a query statement refer to documents that can be found when the query statement is used. Optionally, if a document contains a query statement, it means that the document can be found using that query statement, and there is a relationship between the document and the query statement.
[0075] In this embodiment, the query statement can be in the form of words or sentences, and the documents retrieved using the query statement can include various types of content, such as images, text, links, etc.
[0076] According to the technical solution of this application embodiment, when querying a document using a first query statement, a pre-generated query terminology and document library are obtained, and then the first query statement and the query terminology are matched to determine whether the query terminology contains the first query statement. Since the query terminology includes the original query statement and the rewritten query statement obtained by rewriting the original query statement using a pre-trained offline query statement rewriting model, such as synonyms and near-synonyms of the original query statement, the matching success rate of the first query statement can be improved. Furthermore, if the query terminology contains the first query statement, the document library is queried using the first query statement to obtain the first target document associated with the first query statement from the document library. Since the document library includes the original documents associated with each query statement and the rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model, such as documents with the same semantics as the original document, when matching the first query statement, both the original document and its corresponding rewritten document can be used as matching objects, thereby improving the success rate of the first query statement matching a document. It is evident that by simultaneously rewriting both the query and document sides, document information can be significantly enriched, enhancing the ability of query systems (such as search engines) to handle complex queries. Furthermore, when the query thesaurus does not contain the first query, a pre-trained online query rewriting model can be used to rewrite the first query, resulting in a rewritten second query. This second query is then used to query the document library to retrieve a second target document associated with the second query from the original and / or rewritten documents. Since online rewriting expands the query semantically, matching documents through online rewritten queries greatly improves the document matching success rate. Moreover, by performing document queries from both offline and online dimensions, the document recall dimension is significantly expanded, optimizing query performance.
[0077] In one embodiment, a query thesaurus and a document library may be pre-generated before performing step S101. The query thesaurus and document library may be generated through steps A1 and A2.
[0078] Step A1: Obtain the original query statements and original documents within the preset time period.
[0079] Step A2 involves inputting the original query statement into a pre-trained offline query statement rewriting model to obtain the rewritten query statement corresponding to the original query statement. Additionally, the original document is input into a pre-trained multimodal document rewriting model to obtain the rewritten document corresponding to the original document.
[0080] Optionally, when rewriting the original document, the specific execution involves rewriting the document title of the original document to obtain the rewritten document title, i.e., the rewritten document. If the original document includes image information, a multimodal document rewriting model is used to understand the image information and generate the rewritten content corresponding to the image information. In this case, the rewritten document corresponding to the original document includes the rewritten content corresponding to the image information.
[0081] Offline query rewriting models, online query rewriting models, and multimodal document rewriting models can all be trained using sample data.
[0082] In one embodiment, an offline query rewriting model is trained through steps B1 and B2.
[0083] Step B1: Obtain the first sample data, which includes the original sample query statement and the corresponding rewritten sample query statement.
[0084] Step B2: Input the first sample data into the LLM to be trained for model training to obtain the offline query rewriting model and the online query rewriting model.
[0085] The original query statement in the sample may include at least one of the following: the first original query statement within the first historical time period, and the core entity in the document title. The rewritten query statement in the sample may include at least one of the following: the first rewritten query statement corresponding to the first original query statement, and the second rewritten query statement corresponding to the core entity.
[0086] When the first sample data is input into the LLM to be trained for model training, the sample rewritten query statement can be used as the label content of the original query statement, so as to carry out supervised model training. The trained offline query statement rewriting model can accurately rewrite the original query statement.
[0087] The first sample data can be obtained through at least one of the following methods:
[0088] Method 1 involves expanding the historical session click graph to generate a rewritten query statement with high semantic similarity to the original query statement. This may specifically include steps B11 to B13.
[0089] Step B11: Based on historical query records, obtain the user session click graph for the first historical time period; the user session click graph includes: the query statement information entered by the user and the document information clicked by the user.
[0090] Historical query records correspond to a time period including the first historical period, the specific time period of which is not limited, for example, it could be the most recent week. User session click graphs are used to record and analyze user click behavior within a single session, including which elements (such as buttons, links, images, etc.) were clicked. Based on the user session click graph, it can be determined which query(s) the user clicked on, thus allowing the construction of the relationship between the query(s) and the documents.
[0091] Step B12: Based on the query statement information and document information, construct a query document association graph. The query document association graph is used to represent the association relationship between the first original query statement and the first original document.
[0092] The query-document association graph includes multiple nodes and edges connecting them. Each node can represent two entities: a query statement entered by the user or a document clicked by the user. Edges represent the relationship between query statements and documents. If an edge exists between query statement A and document B, it means that when the user used query statement A to perform a query, they clicked on the found document B. Since the query statement and document represented in the query-document association graph have not been rewritten, they can be referred to as the original query statement and the original document.
[0093] Step B13: Generate the first rewritten query statement corresponding to the first original query statement.
[0094] Optionally, for the first original query statement in the query document association graph, the first rewritten query statement can be obtained by generating synonyms, near-synonyms and / or statements with semantic similarity higher than a predetermined threshold for the first original query statement.
[0095] This method leans towards the mining of synonyms and near-synonyms, resulting in a high semantic similarity between the generated first rewritten query and the first original query. By generating a first rewritten query corresponding to the first original query, a relationship can be established between the first rewritten query and the first original document, thereby improving the success rate of subsequent document matching.
[0096] Method two involves mining query statements and document titles to generate rewritten query statements that are consistent with core entities and have strong scalability. This can specifically include steps B14 to B16.
[0097] Step B14: Based on the historical query records, obtain the historical query statements and the historical documents associated with the historical query statements within the second historical time period.
[0098] Among them, historical documents associated with historical query statements refer to historical documents retrieved using historical query statements. The record time period corresponding to historical query records includes the second historical time period, the specific time period of which is not limited.
[0099] Step B15: Based on the query intent expressed by the historical query statements, extract the core entities from the document titles of historical documents.
[0100] A query statement is essentially a "compressed expression" of a user's query intent. Therefore, by analyzing the keywords in the query statement, we can determine the query intent it represents. Then, we extract the core entities from the document titles that match the query intent.
[0101] Step B16 expands the core entity to obtain the second rewritten query statement.
[0102] Optionally, when expanding the core entity, synonyms, near-synonyms, and / or entity words with semantic similarity to the core entity exceeding a predetermined threshold can be generated, and / or the core entity can be expanded into a complete statement to obtain a second rewritten query statement. Since the core entity matches the query intent represented by the historical query statement, by expanding the core entity in the document title, it is possible to generate a query intent consistent with the original historical query statement. Figure 1 The rewritten terms, i.e., the second rewritten query statement, are obtained. Furthermore, the core entities may be words that match the query intent expressed by the historical query statement but have low semantic similarity. Therefore, by expanding the core entities to obtain the rewritten query statement, it is possible to obtain rewritten terms that have low semantic similarity to the original query statement but high extensibility.
[0103] Method three involves generating a third rewritten query statement corresponding to the third original query statement using an artificial intelligence model. The third original query statement can include at least one of the following: a relatively complex query statement or a knowledge-based query statement. These types of queries often require a higher level of semantic understanding; therefore, using an artificial intelligence model to generate the rewritten query statement ensures high accuracy. Method three is more suitable for rewriting complex and knowledge-based queries, incorporating world knowledge to solve reasoning (rewriting) problems.
[0104] In some embodiments, after obtaining the first sample data, the first sample data can be enhanced in terms of quality, which includes both knowledge enhancement and quality control.
[0105] Optionally, when enhancing the knowledge of the first sample data, new knowledge can be introduced by incorporating category prediction results, NER (Named Entity Recognition) results, and extensions based on search sessions.
[0106] By integrating category prediction results, named entity recognition results, and extended knowledge based on search sessions, the system's semantic understanding capabilities and knowledge coverage can be significantly improved.
[0107] Optionally, when performing quality control on the first sample data, the semantic similarity between the original query statement and the rewritten query statement can be calculated first, and then the rewritten query statements can be screened out based on the semantic similarity. For example, rewritten query statements with semantic similarity lower than a preset threshold can be screened out, so that the semantic similarity of the remaining rewritten query statements is higher than or equal to the preset threshold.
[0108] Optionally, when performing quality control on the first sample data, the statement quality score of the rewritten query statements can be calculated first. Then, the rewritten query statements can be filtered out based on their statement quality scores. For example, rewritten query statements with statement quality scores lower than a preset value can be filtered out, ensuring that the remaining rewritten query statements have statement quality scores higher than or equal to the preset value. The statement quality score can be calculated based on relevant information about the rewritten query statement itself, such as click-through rate, bounce rate, number of queries, conversion rate, and dwell time. By weighting these relevant information according to their respective weights, the quality score of the rewritten query statement can be calculated.
[0109] Based on the three methods for obtaining the first sample data listed in the above embodiments, after obtaining the first sample data, the offline query rewriting model and the online query rewriting model are trained using the first sample data. Figure 2 The diagram illustrates the training principle of the offline query rewriting model and the online query rewriting model provided in the embodiments of this application. Figure 2 As shown, the first sample data is obtained first using the three methods described above. This includes the first original query statement within the first historical time period, the core entity in the document title, the first rewritten query statement corresponding to the first original query statement, and the second rewritten query statement corresponding to the core entity. Then, the first sample data undergoes quality enhancement, including knowledge enhancement and quality control. Afterward, the quality-enhanced first sample data is input into the LLM to be trained, and the sample rewritten query statements are used as labels for the sample original query statements to perform SFT on the LLM, thereby training both the offline and online query rewriting models.
[0110] To train a query rewriting model applicable to both offline and online scenarios, two models can be trained based on initial sample data, such as a 14B model and a 0.5B model. The 14B and 0.5B models refer to neural network models with 14 billion and 500 million parameters, respectively. The 14B model focuses on rewriting quality and can be applied to offline scenarios, including T+1 prediction of queries (a prediction mechanism delayed by one day). Therefore, the 14B model can be used as an offline query rewriting model. The 0.5B model focuses on rewriting speed and can be applied to online scenarios. Therefore, the 0.5B model can be used as an online query rewriting model.
[0111] Optionally, the proportion of the first sample data obtained through the three methods is pre-configured for use during model training, for example... Figure 2 The first original query statement and its corresponding first rewritten query statement obtained using Method 1 account for 3.2%, the core entity and the second rewritten query statement obtained using Method 2 account for 95.4%, and the third original query statement and its corresponding third rewritten query statement obtained using Method 3 account for 1.4%. Of course, the above are merely illustrative examples illustrating the different usage percentages of the three sample data sets. In practical applications, the usage percentages of the three sample data sets can be customized as needed.
[0112] After training the offline query rewriting model and the online query rewriting model, the offline query rewriting model and / or the online query rewriting model can be optimized. Optionally, the offline query rewriting model and / or the online query rewriting model can be optimized based on the DPO method, and the optimization method includes the following steps C1, C2 and C3.
[0113] Step C1: Use the first query rewriting model to rewrite the second original query statement to obtain the third rewritten query statement.
[0114] The second original query statement can be an original query statement extracted from the first sample data, or it can be a newly collected original query statement.
[0115] Step C2: Collect the query document pairs corresponding to the third rewritten query statement. The query document pairs are used to represent the documents retrieved based on the third rewritten query statement.
[0116] Step C3: Optimize the offline query rewriting model and / or the online query rewriting model based on the click-through rate of the query document pairs.
[0117] The second original query statement can be followed by multiple rewritten third query statements, each corresponding to at least one query document pair. During step C3, the rewritten third query statements can be sorted based on the click-through rate (CTR) of the corresponding query document pairs. Then, the top N rewritten third query statements and / or those with CTRs exceeding a preset CTR threshold are used as positive samples, while the remaining rewritten third query statements are used as negative samples to optimize the offline query rewriting model. Optimizing the offline query rewriting model using the DPO (Depth-Point Object) method improves both the efficiency and accuracy of the offline query rewriting model.
[0118] In some embodiments, a multimodal document rewriting model is trained through steps D1 and D2.
[0119] Step D1: Obtain the second sample data, which includes: sample image information of the sample query object and sample text information corresponding to the sample image information. The sample text information includes: the sample document title associated with the sample image information, the object attribute information of the sample query object, and sample rewriting information.
[0120] The sample query object can be any object involved in the query function, such as shops and products on an online shopping app. Users can enter a query statement at the query (or search) portal of the online shopping app to search for shops or products on the app. Taking a shop as an example, the sample image information can include shop photos, shop logos, and photos of products sold in the shop. The sample document title can include the shop name and shop slogan. The object attribute information can be the attribute information of the products sold in the shop, such as category, name, function, and detailed description. The sample rewritten information of the sample query object can include at least one of the following: the rewritten result of the sample image information, the rewritten result of the sample document title, and the rewritten result of the object attribute information.
[0121] Optionally, at least one of the sample image information, sample document title, and object attribute information can be input into the artificial intelligence model for rewriting to obtain sample rewritten information.
[0122] Step D2: Input the second sample data into the multimodal language model to be trained to train the model and obtain the multimodal document rewriting model.
[0123] Among them, the multimodal language model includes VLM. VLM can understand both image content and text information at the same time. Therefore, when the second sample data includes sample image information, VLM can understand the sample data well and train a multimodal document rewriting model that can accurately recognize image and text information.
[0124] Alternatively, training the multimodal document rewriting model using the LORA method can enable the model to converge faster during training and maintain good generalization capabilities.
[0125] Figure 3 The diagram illustrates the training principle of the multimodal document rewriting model provided in this application embodiment, as follows: Figure 3 As shown, firstly, multimodal sample image and text information is acquired, including sample image information of the sample query object and sample document titles associated with the sample image information. Then, knowledge augmentation is performed on the multimodal sample image and text information by introducing object attribute information of the sample query object, such as store information, product attributes, product category information, detailed description, and basic attribute information. Next, the sample image information, sample document titles, and object attribute information are input into the artificial intelligence model for rewriting, resulting in rewritten sample information. The multimodal sample image and text information, the knowledge-augmented object attribute information, and the rewritten sample information together constitute the second sample data. Finally, the second sample data is input into the multimodal language model to be trained for model training, resulting in the multimodal document rewriting model.
[0126] After training the offline query rewriting model and the multimodal document rewriting model, the original query statement on the query side and the document on the document side are rewritten using the offline query rewriting model and the multimodal document rewriting model, respectively, and queries are performed based on the rewritten query thesaurus and document library.
[0127] In some embodiments, after matching the first query statement with a query terminology to determine whether the query terminology contains the first query statement (i.e., step S102), if the query terminology contains the first query statement, step S103 is executed. If the query terminology does not contain the first query statement, the first query statement is first rewritten using an online query statement rewriting model to obtain a rewritten second query statement. Then, the second query statement is queried in a document library to obtain a second target document matching the second query statement from the original documents and / or rewritten documents in the document library. The online query statement rewriting model is trained based on the first sample data. The online query statement rewriting model includes... Figure 2 The 0.5B model in the illustrated embodiment.
[0128] Optionally, the second query statement can be added to the query thesaurus, and an association can be established between the second query statement and the second target document.
[0129] In this embodiment, when the query dictionary does not contain the first query statement, an online query statement rewriting model is used, such as a 0.5B model suitable for online rewriting, to rewrite the first query statement into a second query statement. This second query statement is then matched with the document library, thereby improving the document matching success rate. Furthermore, by adding the rewritten second query statement to the query dictionary, the dictionary becomes richer and more complete. When the first query statement is used again, since the query dictionary already contains the rewritten second query statement and the document library can match the documents corresponding to the second query statement, there is no need to rewrite the first query statement online, thus reducing the system performance pressure when using the first query statement again.
[0130] Figure 4 A schematic diagram of the query method provided in this application embodiment is shown. In this embodiment, the query rewriting model is LLM, including a 14B model suitable for offline rewriting (i.e., offline query rewriting model) and a 0.5B model suitable for online rewriting (i.e., online query rewriting model). The multimodal document rewriting model is VLM. For example... Figure 4 As shown, firstly, the full set of query statements is rewritten using a pre-trained 14B model to obtain rewritten query statements; and secondly, the document titles of all documents are rewritten using a pre-trained VLM to obtain rewritten documents. Then, quality control is performed on both the rewritten query statements and the rewritten documents. Optionally, when performing quality control on the rewritten query statements, the semantic similarity between the rewritten query statement and the corresponding original query statement is calculated, thereby deleting rewritten query statements with a semantic similarity lower than a predetermined threshold, and only retaining those with a semantic similarity higher than or equal to the predetermined threshold. When performing quality control on the rewritten documents, the semantic similarity between the rewritten document and the corresponding original document is calculated, thereby deleting rewritten documents with a semantic similarity lower than a predetermined threshold, and only retaining those with a semantic similarity higher than or equal to the predetermined threshold.
[0131] In this embodiment, the original document in the full document contains image information and / or text information. The pre-trained VLM can understand both image and text information simultaneously. Therefore, the pre-trained VLM can be used to rewrite the original document, resulting in a rewritten document that includes the rewritten content corresponding to the image and / or text information. The rewritten document can also be referred to as a multimodal rewritten document.
[0132] Subsequently, the rewritten query statements and multimodal rewritten documents obtained after quality control are cached offline. Optionally, the rewritten query statements and the corresponding original query statements are stored in the online link cache to obtain the query thesaurus; the multimodal rewritten documents and the corresponding original documents are stored in the online link cache to obtain the document library.
[0133] Subsequently, upon receiving a query request based on the first query statement, the first query statement is matched against a query thesaurus to determine if the thesaurus contains the first query statement. If the query thesaurus contains the first query statement (i.e., a successful match), the first target document associated with the first query statement is retrieved from the document repository. If the query thesaurus does not contain the first query statement (i.e., a failed match), the first query statement is rewritten online using a pre-trained 0.5B model to obtain the second query statement. The second query statement is then matched against the document repository to determine the second target document that matches the second query statement.
[0134] Then, the second query statement is stored in the query thesaurus as a rewritten query statement corresponding to the first query statement, so as to make the query thesaurus richer and more complete.
[0135] As can be seen, by simultaneously rewriting the query side and the document side, the query statement on the query side and the document content on the document side are enriched. Therefore, when querying a document using the first query statement, the first query statement is first matched with a query thesaurus to determine whether the query thesaurus contains the first query statement. If the query thesaurus contains the first query statement, the first target document associated with the first query statement is retrieved from the document library. Since the query thesaurus includes the original query statement and the corresponding rewritten query statement, such as synonyms and near-synonyms of the original query statement, the matching success rate of the first query statement can be improved. Furthermore, since the document library includes the original document associated with each query statement and the corresponding rewritten document, such as a document with the same semantics as the original document, when matching the first query statement, both the original document and its corresponding rewritten document can be used as matching objects, thereby improving the success rate of the first query statement matching a document. When the query terminology does not contain the first query statement, the 0.5B model is used to rewrite the first query statement into a second query statement, which is then matched against the rewritten document database, thereby improving the document matching success rate. Furthermore, by adding the rewritten second query statement to the query terminology, the terminology becomes richer and more complete. When the first query statement is used again, since the query terminology already contains the rewritten second query statement and the document database can match the documents corresponding to the second query statement, there is no need to rewrite the first query statement online, thus reducing the system performance pressure when using the first query statement again. It is evident that by rewriting both the query side and the document side simultaneously, document information can be greatly enriched, the query system's (such as a search engine) ability to handle complex queries can be enhanced, the document recall dimension can be significantly expanded, and query performance can be optimized.
[0136] Corresponding to the application scenarios and methods provided in the embodiments of this application, the embodiments of this application also provide a query device.
[0137] Figure 5 A block diagram of the query device provided in an embodiment of this application is shown, such as Figure 5 As shown, the query device includes:
[0138] The first acquisition module 51 is configured to acquire a pre-generated query terminology and document library in response to querying documents using a first query statement; the query terminology includes the original query statement and the rewritten query statement obtained by rewriting the original query statement using a pre-trained first query statement rewriting model; the document library includes the original documents associated with each query statement and the rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model; the offline query statement rewriting model is obtained by training a large language model based on first sample data related to historical query records; the multimodal document rewriting model is obtained by training a multimodal language model using second sample data, the second sample data including sample image information related to the sample query object and / or sample text information corresponding to the sample image information;
[0139] Matching module 52 is used to match the first query statement with the query term database to determine whether the query term database contains the first query statement;
[0140] The second acquisition module 53 is configured to, when the query terminology contains the first query statement, use the first query statement to query the document library to obtain a first target document associated with the first query statement from the original document and / or the rewritten document; when the query terminology does not contain the first query statement, use a pre-trained online query statement rewriting model to rewrite the first query statement to obtain a second query statement rewritten online; use the second query statement to query the document library to obtain a second target document associated with the second query statement from the original document and / or the rewritten document; the online query statement rewriting model is obtained by training the large language model using the first sample data; the model parameters of the online query statement rewriting model are fewer than the model parameters of the offline query statement rewriting model.
[0141] Optionally, the device further includes:
[0142] The third acquisition module is used to acquire first sample data before the pre-generated query thesaurus and document thesaurus are acquired in response to querying the document using the first query statement; the first sample data includes: the original sample query statement and the sample rewritten query statement corresponding to the original sample query statement;
[0143] The first training module is used to input the first sample data into the large language model to be trained for model training, so as to obtain the offline query rewriting model and the online query rewriting model.
[0144] Optionally, the original sample query statement includes a first original query statement; the rewritten sample query statement includes a first rewritten query statement.
[0145] When the third acquisition module acquires the first sample data, it performs the following steps:
[0146] Based on the historical query records, a user session click graph for the first historical time period is obtained; the user session click graph includes: query information entered by the user and document information clicked by the user;
[0147] Based on the query statement information and the document information, a query document association graph is constructed; the query document association graph is used to represent the association relationship between the first original query statement and the first original document.
[0148] Generate the first rewritten query statement corresponding to the first original query statement.
[0149] Optionally, the original sample query statement includes the core entity in the document title; the rewritten sample query statement includes a second rewritten query statement.
[0150] When the third acquisition module acquires the first sample data, it performs the following steps:
[0151] Based on the historical query records, obtain the historical query statements and the historical documents associated with the historical query statements within the second historical time period;
[0152] Based on the query intent expressed by the historical query statements, extract the core entities from the document titles of the historical documents;
[0153] The core entity is expanded to obtain the second rewritten query statement.
[0154] Optionally, the device further includes:
[0155] The calculation module is used to calculate the semantic similarity between the original query statement of the sample and the rewritten query statement of the sample after the first sample data is obtained;
[0156] The filtering module is used to filter out the rewritten query statements of the samples based on the semantic similarity, so that the semantic similarity of the rewritten query statements of the samples retained after filtering is higher than or equal to a preset threshold.
[0157] Optionally, the device further includes:
[0158] The second rewriting module is used to input the first sample data into the large language model to be trained for model training, and after obtaining the offline query statement rewriting model and the online query statement rewriting model, use the offline query statement rewriting model to rewrite the second original query statement to obtain the third rewritten query statement.
[0159] The acquisition module is used to acquire the query document pairs corresponding to the third rewritten query statement; the query document pairs are used to represent the documents retrieved based on the third rewritten query statement.
[0160] An optimization module is used to optimize the offline query rewriting model and / or the online query rewriting model based on the click-through rate of the query document pairs.
[0161] Optionally, the device further includes:
[0162] The fourth acquisition module is used to acquire second sample data before acquiring the pre-generated query thesaurus and document thesaurus in response to querying the document using the first query statement; the second sample data includes: the sample image information and the sample text information; the sample text information includes: the sample document title associated with the sample image information, the object attribute information of the sample query object, and the sample rewriting information;
[0163] The second training module is used to input the second sample data into the multimodal language model to be trained for model training, thereby obtaining the multimodal document rewriting model.
[0164] Optionally, when acquiring the second sample data, the fourth acquisition module performs the following steps:
[0165] The sample image information, the sample document title, and the object attribute information are input into the artificial intelligence model for rewriting to obtain the sample rewritten information.
[0166] Optionally, the device further includes:
[0167] An add module is used to add the second query statement to the query thesaurus;
[0168] A module is established to create a relationship between the second query statement and the second target document.
[0169] According to the apparatus of this application embodiment, when querying a document using a first query statement, a pre-generated query terminology and document library are obtained, and then the first query statement and the query terminology are matched to determine whether the query terminology contains the first query statement. Since the query terminology includes the original query statement and the rewritten query statement obtained by rewriting the original query statement using a pre-trained offline query statement rewriting model, such as synonyms and near-synonyms of the original query statement, the matching success rate of the first query statement can be improved. Furthermore, if the query terminology contains the first query statement, the document library is queried using the first query statement to obtain a first target document associated with the first query statement from the document library. Since the document library includes the original documents associated with each query statement and the rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model, such as documents with the same semantics as the original documents, when matching the first query statement, both the original document and its corresponding rewritten document can be used as matching objects, thereby improving the success rate of the first query statement matching a document. It is evident that by simultaneously rewriting both the query and document sides, document information can be significantly enriched, enhancing the ability of query systems (such as search engines) to handle complex queries. Furthermore, when the query thesaurus does not contain the first query, a pre-trained online query rewriting model can be used to rewrite the first query, resulting in a rewritten second query. This second query is then used to query the document library to retrieve a second target document associated with the second query from the original and / or rewritten documents. Since online rewriting expands the query semantically, matching documents through online rewritten queries greatly improves the document matching success rate. Moreover, by performing document queries from both offline and online dimensions, the document recall dimension is significantly expanded, optimizing query performance.
[0170] The functions of each module in each device in the embodiments of this application can be found in the corresponding description in the above method, and they have corresponding beneficial effects, which will not be repeated here.
[0171] Figure 6 This is a block diagram for implementing the electronic device provided in the embodiments of this application. Figure 6 As shown, the electronic device includes a memory 601 and a processor 602. The memory 601 stores a computer program that can run on the processor 602. When the processor 602 executes the computer program, it implements the method described in the above embodiments. The number of memories 601 and processors 602 can be one or more. In a specific implementation, the electronic device may also include a communication interface 603 for communicating with external devices and exchanging data.
[0172] In practical implementation, if the memory 601, processor 602, and communication interface 603 are implemented independently, they can be interconnected via a bus to communicate with each other. This bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0173] Optionally, in a specific implementation, if the memory 601, processor 602 and communication interface 603 are integrated on a single chip, the memory 601, processor 602 and communication interface 603 can communicate with each other through an internal interface.
[0174] This application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method provided in this application.
[0175] This application provides a computer program product, including a computer program that, when executed by a processor, implements the method provided in this application.
[0176] This application also provides a chip including a processor for calling and executing instructions stored in a memory, causing a communication device with the chip installed to perform the method provided in this application.
[0177] This application also provides a chip, including: an input interface, an output interface, a processor, and a memory. The input interface, output interface, processor, and memory are connected through an internal connection path. The processor is used to execute code in the memory. When the code is executed, the processor is used to execute the method provided in the application embodiment.
[0178] It should be understood that the aforementioned processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. It is worth noting that the processor can be a processor supporting the Advanced Reduced Instruction Set Computing (ARM) architecture.
[0179] Further, optionally, the aforementioned memory may include read-only memory and random access memory. The memory may be volatile memory or non-volatile memory, or may include both. Non-volatile memory may include read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available. Examples include Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Sync Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0180] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another.
[0181] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of those different embodiments or examples.
[0182] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "a plurality of" means two or more, unless otherwise explicitly specified.
[0183] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing a particular logical function or process. Furthermore, the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functionality involved.
[0184] The logic and / or steps described in the flowchart or otherwise herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).
[0185] It should be understood that various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. All or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware, the program being stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiments.
[0186] Furthermore, the functional units in the various embodiments of this application can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. This storage medium can be a read-only memory, a disk, or an optical disk, etc.
[0187] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various variations or substitutions within the technical scope described in this application, and these should all be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A query method, characterized in that, include: In response to querying documents using the first query statement, a pre-generated query thesaurus and document library are obtained; The query lexicon includes original query statements and rewritten query statements obtained by rewriting the original query statements using a pre-trained offline query statement rewriting model; the document library includes original documents associated with each query statement and rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model; the offline query statement rewriting model is obtained by training a large language model based on first sample data related to historical query records; the multimodal document rewriting model is obtained by training a multimodal language model using second sample data, the second sample data including sample image information related to the sample query object and / or sample text information corresponding to the sample image information; The first query statement is matched with the query terminology to determine whether the query terminology contains the first query statement; If the query terminology contains the first query statement, the first query statement is used to query the document library to obtain a first target document associated with the first query statement from the original document and / or the rewritten document; If the first query statement is not included in the query terminology, the first query statement is rewritten using a pre-trained online query statement rewriting model to obtain the online rewritten second query statement. The document library is queried using the second query statement to obtain a second target document associated with the second query statement from the original document and / or the rewritten document; The online query rewriting model is obtained by training the large language model using the first sample data; the model parameters of the online query rewriting model are fewer than those of the offline query rewriting model.
2. The method according to claim 1, characterized in that, Before responding to querying documents using the first query statement and obtaining the pre-generated query thesaurus and document thesaurus, the method further includes: Obtain first sample data; the first sample data includes: the original sample query statement and the sample rewritten query statement corresponding to the original sample query statement; The first sample data is input into the large language model to be trained to obtain the offline query rewriting model and the online query rewriting model.
3. The method according to claim 2, characterized in that, The original query statement of the sample includes a first original query statement; the rewritten query statement of the sample includes a first rewritten query statement. The acquisition of the first sample data includes: Based on the historical query records, a user session click graph for the first historical time period is obtained; the user session click graph includes: query information entered by the user and document information clicked by the user; Based on the query statement information and the document information, a query document association graph is constructed; the query document association graph is used to represent the association relationship between the first original query statement and the first original document. Generate the first rewritten query statement corresponding to the first original query statement.
4. The method according to claim 2, characterized in that, The original query statement in the sample includes the core entities in the document title; The sample rewritten query statement includes a second rewritten query statement; The acquisition of the first sample data includes: Based on the historical query records, obtain the historical query statements and the historical documents associated with the historical query statements within the second historical time period; Based on the query intent expressed by the historical query statements, extract the core entities from the document titles of the historical documents; The core entity is expanded to obtain the second rewritten query statement.
5. The method according to claim 2, characterized in that, After obtaining the first sample data, the process further includes: Calculate the semantic similarity between the original query statement of the sample and the rewritten query statement of the sample; The sample rewritten query statements are filtered out based on the semantic similarity, so that the semantic similarity of the remaining sample rewritten query statements is higher than or equal to a preset threshold.
6. The method according to claim 2, characterized in that, After inputting the first sample data into the large language model to be trained for model training, and obtaining the offline query rewriting model and the online query rewriting model, the method further includes: The second original query statement is rewritten using the offline query statement rewriting model to obtain the third rewritten query statement; Collect the query document pairs corresponding to the third rewritten query statement; the query document pairs are used to represent the documents retrieved based on the third rewritten query statement; Based on the click-through rate of the query document pairs, optimize the offline query rewriting model and / or the online query rewriting model.
7. The method according to claim 1, characterized in that, Before responding to querying documents using the first query statement and obtaining the pre-generated query thesaurus and document thesaurus, the method further includes: Obtain second sample data; the second sample data includes: the sample image information and the sample text information; the sample text information includes: the sample document title associated with the sample image information, the object attribute information of the sample query object, and the sample rewriting information; The second sample data is input into the multimodal language model to be trained to obtain the multimodal document rewriting model.
8. The method according to claim 7, characterized in that, The acquisition of the second sample data includes: The sample image information, the sample document title, and the object attribute information are input into the artificial intelligence model for rewriting to obtain the sample rewritten information.
9. The method according to claim 1, characterized in that, Also includes: Add the second query statement to the query term database; Establish the association between the second query statement and the second target document.
10. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory, wherein the processor, when executing the computer program, implements the method of any one of claims 1 to 9.
Citation Information
Patent Citations
Method and system for generating search engine query expansion terms
CN107291914A
Query search method, query information processing method, equipment and storage medium
CN117520477A