Query method and electronic equipment

By combining offline and online query statement rewriting models with multimodal document rewriting models, the problem of traditional search engines' insufficient understanding of complex query statements is solved, and more efficient query matching and recall effects are achieved.

CN120705290AActive Publication Date: 2025-09-26RAJAX NETWORK &TECHNOLOGY (SHANGHAI) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511134053.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-14
Publication Date
2025-09-26
Estimated Expiration
2045-08-14

AI Technical Summary

Technical Problem

Traditional search engines have difficulty accurately understanding complex query statements, resulting in inaccurate query results.

Method used

The query statement is rewritten through pre-trained offline and online query statement rewriting models, and the multimodal document rewriting model is combined to enrich document information and improve the query matching success rate.

Benefits of technology

The processing capability of complex query statements and the document recall dimension have been significantly improved, ensuring the accuracy and comprehensiveness of query results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705290A_ABST
    Figure CN120705290A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a query method and electronic equipment, and the query method comprises the steps: obtaining a query word library and a document library in response to the query of a document by using a first query statement; the query word bank comprises original query statements and rewritten query statements; the document library comprises original documents and rewritten documents associated with the query statements; matching the first query statement with a query word bank, and acquiring a target document associated with the first query statement from the original document and / or the rewritten document under the condition that the query word bank contains the first query statement; under the condition that the query word bank does not contain the first query statement, rewriting the first query statement by utilizing a pre-trained online query statement rewriting model to obtain a second query statement; and obtaining a target document associated with the second query statement from the original document and / or the rewritten document. According to the method, the processing capacity of a query system on complex query statements can be enhanced, the document recall dimension is remarkably expanded, and the query effect is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a query method and electronic device. Background Art

[0002] With the increasing complexity of user needs and the scale of information, traditional search engines face the challenge of accurately understanding user query intent. For short queries, search engines often struggle to accurately understand user intent, resulting in inaccurate results. Therefore, improving the intelligence of search engines to better understand complex queries and generate high-quality results is a pressing issue. Summary of the Invention

[0003] The embodiments of the present application provide a query method and an electronic device to alleviate or solve one or more technical problems existing in the prior art.

[0004] In a first aspect, an embodiment of the present application provides a query method, comprising: In response to querying a document using a first query statement, a pre-generated query word library and a document library are obtained; the query word library includes an original query statement and a rewritten query statement obtained by rewriting the original query statement using a pre-trained offline query statement rewriting model; the document library includes an original document associated with each query statement and a rewritten document obtained by rewriting the original document 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, wherein the second sample data includes sample image information related to a sample query object and / or sample text information corresponding to the sample image information; Matching the first query statement with the query lexicon to determine whether the query lexicon contains the first query statement; In a case where the query word library includes the first query statement, querying 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; When the query vocabulary does not include 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 after online rewriting; 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 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 less than the model parameters of the offline query statement rewriting model.

[0005] Optionally, before obtaining a pre-generated query vocabulary and document vocabulary in response to querying a document using the first query statement, the method further includes: Acquire first sample data; the first sample data includes: a sample original query statement and a sample rewritten query statement corresponding to the sample original query statement; The first sample data is input into a large language model to be trained for model training to obtain the offline query statement rewriting model and the online query statement rewriting model.

[0006] Optionally, the sample original query statement includes a first original query statement; the sample rewritten query statement includes a first rewritten query statement; The obtaining of the first sample data includes: Obtaining a user session click graph within a first historical period based on the historical query records; the user session click graph includes: query statement information input by the user and document information clicked by the user; Constructing a query-document association graph based on the query statement information and the document information; 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.

[0007] Optionally, the sample original query statement includes a core entity in a document title; the sample rewritten query statement includes a second rewritten query statement; The obtaining of the first sample data includes: Acquire historical query statements and historical documents associated with the historical query statements within a second historical period according to the historical query records; Extracting core entities from the document titles of the historical documents based on the query intent expressed by the historical query sentences; The core entity is expanded to obtain the second rewritten query statement.

[0008] Optionally, after obtaining the first sample data, the method further includes: Calculating the semantic similarity between the sample original query statement and the sample rewritten query statement; The sample rewritten query statements are screened out according to the semantic similarity, so that the semantic similarity corresponding to the sample rewritten query statements retained after screening out is higher than or equal to a preset threshold.

[0009] Optionally, after inputting the first sample data into a large language model to be trained for model training to obtain the offline query statement rewriting model and the online query statement rewriting model, the method further includes: Rewriting the second original query statement using the offline query statement rewriting model to obtain a third rewritten query statement; Collecting query-document pairs corresponding to the third rewritten query statement; the query-document pairs are used to represent documents found based on the third rewritten query statement; The offline query statement rewriting model is optimized according to the click rate of the query document pair.

[0010] Optionally, before obtaining a pre-generated query vocabulary and document vocabulary in response to querying a document using the first query statement, the method further includes: Acquire second sample data; the second sample data includes: the sample image information and the sample text information; the sample text information includes: a sample document title associated with the sample image information, object attribute information of the sample query object, and sample rewriting information; The second sample data is input into the multimodal language model to be trained for model training to obtain the multimodal document rewriting model.

[0011] Optionally, obtaining the second sample data includes: The sample image information, the sample document title and the object attribute information are input into an artificial intelligence model for rewriting to obtain the sample rewritten information.

[0012] Optionally, the method further includes: adding the second query statement to the query vocabulary; An association relationship is established between the second query statement and the second target document.

[0013] In a second aspect, an embodiment of the present application provides a query device, including: A first acquisition module is configured to acquire a pre-generated query vocabulary and document library in response to querying a document using a first query statement; the query vocabulary includes an original query statement and a rewritten query statement obtained by rewriting the original query statement using a pre-trained first query statement rewriting model; the document library includes an original document associated with each query statement and a rewritten document obtained by rewriting the original document 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, wherein the second sample data includes sample image information related to a sample query object and / or sample text information corresponding to the sample image information; a matching module, configured to match the first query statement with the query lexicon to determine whether the query lexicon contains the first query statement; A second acquisition module is used to 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 when the query vocabulary contains the first query statement; to rewrite the first query statement using a pre-trained online query statement rewriting model to obtain an online rewritten second query statement when the query vocabulary does not contain the first query statement; to 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; 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.

[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor implements any method of the embodiments of the present application when executing the computer program.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any one of the embodiments of the present application is implemented.

[0016] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which implements any method of the embodiments of the present application when executed by a processor.

[0017] According to the technical solution of an embodiment of the present application, when searching for documents using a first query statement, a pre-generated query lexicon and document library are obtained, and then the first query statement and the query lexicon are matched to determine whether the query lexicon contains the first query statement. Because the query lexicon includes the original query statement and rewritten query statements obtained by rewriting the original query statement using a pre-trained offline query rewriting model, such as synonyms and synonyms of the original query statement, the matching success rate of the first query statement can be improved. Furthermore, if the query lexicon 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. Because the document library includes the original documents associated with each query statement and 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 targets, thereby improving the success rate of matching the first query statement to documents. It can be seen that by rewriting both the query and document sides simultaneously, document information can be greatly enriched, enhancing the query system's (such as a search engine's) ability to process complex query statements. Furthermore, when the query vocabulary 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 an online rewritten second query statement. This 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. Since online rewriting can expand the query statement from a semantic dimension, matching documents using online rewritten query statements greatly improves the success rate of document matching. Furthermore, by performing document queries from both offline and online dimensions, the document recall dimension is significantly expanded, optimizing query effectiveness.

[0018] The technical solution of this application can be applied to the transaction and delivery services of instant e-commerce platforms, such as Taobao Flash Purchase, Taoxianda, Ele.me takeout and retail, etc.

[0019] The above description is only an overview of the technical solution of this application. In order to more clearly understand the technical means of this application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of this application more obvious and easy to understand, the specific implementation methods of this application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In the accompanying drawings, unless otherwise specified, the same reference numerals throughout the multiple drawings represent the same or similar components or elements. These drawings are not necessarily drawn to scale. It should be understood that these drawings only depict some embodiments according to the present application and should not be regarded as limiting the scope of the present application.

[0021] Figure 1 A flowchart of a query method provided by an embodiment of the present application is shown; Figure 2 A diagram showing the training principle of the first query statement rewriting model provided in an embodiment of the present application is shown; Figure 3 A diagram showing the training principle of the document rewriting model provided in an embodiment of the present application is shown; Figure 4 A schematic diagram of a query method provided in an embodiment of the present application is shown; Figure 5 A block diagram of a query device provided in an embodiment of the present application is shown; Figure 6 A block diagram of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0022] Hereinafter, only certain exemplary embodiments are briefly described. As will be appreciated by those skilled in the art, the described embodiments may be modified in various ways without departing from the spirit or scope of the present application. Therefore, the drawings and description are to be regarded as illustrative in nature and not restrictive.

[0023] To facilitate understanding of the technical solutions of the embodiments of the present application, the following describes the related technologies of the embodiments of the present application. The following related technologies can be combined with the technical solutions of the embodiments of the present application as optional solutions, and all of them fall within the scope of protection of the embodiments of the present application.

[0024] The following terms will be used in the following text: LLM: Large Language Model, a large-scale language model used to process and understand complex natural language queries.

[0025] VLM: Visual Language Model, is an artificial intelligence model that combines vision and language processing capabilities. It can understand image content and text information at the same time, and combine image and text information for search and recall.

[0026] SFT: Supervised Fine-Tuning, a technique in machine learning that uses labeled data to perform targeted adjustments to pre-trained models, aiming to make the model more suitable for specific tasks or fields to improve model performance.

[0027] LORA: Low-Rank Adaptation, low-rank adaptation, achieves fast fine-tuning performance of the model by adding new extension layers.

[0028] DPO: Direct Probability Ordering, direct probability sorting, sorting by generating probability.

[0029] The embodiment of the present application aims to provide a query method, which enriches the query statement on the query side and the document content on the document side by rewriting the query side and the document side at the same time. Therefore, when querying a document using a first query statement, a pre-generated query vocabulary and document library are first obtained, and then the first query statement and the query vocabulary are matched to determine whether the query vocabulary contains the first query statement. Since the query vocabulary 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 antonyms of the original query statement, the matching success rate of the first query statement can be improved. Furthermore, when the query vocabulary 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. Because the document repository includes the original documents associated with each query statement and 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, both the original document and its corresponding rewritten document can be used as matching targets when matching the first query statement, thereby improving the success rate of matching the first query statement to documents. As can be seen, by simultaneously rewriting the query and document sides, document information can be significantly enriched, enhancing the query system's (e.g., search engine) ability to process complex queries. Furthermore, if the query vocabulary does not contain the first query statement, the first query statement can be rewritten using a pre-trained online query rewriting model to obtain an online rewritten second query statement. This second query statement is then used to query the document repository to obtain a second target document associated with the second query statement from the original document and / or the rewritten document. Since online rewriting can expand the query statement semantically, matching documents using the online rewritten query statement significantly improves the document matching success rate. Furthermore, by performing document search from both offline and online perspectives, the document recall dimension is significantly expanded, optimizing query performance.

[0030] Furthermore, the embodiments of this application rewrite both the query and document sides by combining a large language model with a visual language model, improving the ability to process complex query statements, thereby ensuring comprehensive understanding and efficient recall in complex query scenarios. Furthermore, the use of a visual language model enables the full understanding and expansion of visual information (such as images), extending document content beyond the limitations of single text. This in-depth expansion of document content enables precise matching and recall.

[0031] It should be noted that the above-mentioned application scenarios or application 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 solution. 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 relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation portals for users to choose to authorize or refuse.

[0032] The following describes in detail the technical solution of this application and how it solves the aforementioned technical problems using specific embodiments. The several specific embodiments listed can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The following describes the embodiments of this application in detail with reference to the accompanying drawings.

[0033] Figure 1 A flowchart of the query method provided by an embodiment of the present application is shown. Figure 1 As shown, the method may include step S101, step S102, step S103 and step S104.

[0034] Step S101 : in response to querying a document using a first query statement, obtaining a pre-generated query word library and document library.

[0035] The query vocabulary includes the original query and rewritten query statements 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 above a predetermined threshold to the original query statement.

[0036] The document library includes the original documents associated with each query statement, as well as rewritten documents obtained by rewriting the original documents using a pre-trained multimodal document rewriting model. The rewritten documents can include at least one of the following: documents with a semantic similarity to the original document exceeding a predetermined threshold, or documents describing image information in the original document.

[0037] The offline query 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, which includes sample image information related to the sample query object and / or sample text information corresponding to the sample image information.

[0038] Step S102: Match the first query statement with the query vocabulary to determine whether the query vocabulary contains the first query statement.

[0039] Step S103: when the query word library includes the first query statement, the document library is searched 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.

[0040] Step S104: When the query vocabulary 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 after online rewriting; 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.

[0041] The online query rewriting model is obtained by training a 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. Documents associated with a query statement refer to documents that can be found when using the query statement. Optionally, if a document contains a query statement, it indicates that the document can be found using the query statement, and the document is associated with the query statement.

[0042] In this embodiment, the query statement may be in the form of a word or a sentence, and the documents retrieved using the query statement may include various types of content, such as pictures, text, links, and the like.

[0043] According to the technical solution of an embodiment of the present application, when searching for documents using a first query statement, a pre-generated query lexicon and document library are obtained, and then the first query statement and the query lexicon are matched to determine whether the query lexicon contains the first query statement. Because the query lexicon includes the original query statement and rewritten query statements obtained by rewriting the original query statement using a pre-trained offline query rewriting model, such as synonyms and synonyms of the original query statement, the matching success rate of the first query statement can be improved. Furthermore, if the query lexicon 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. Because the document library includes the original documents associated with each query statement and 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 targets, thereby improving the success rate of matching the first query statement to documents. It can be seen that by rewriting both the query and document sides simultaneously, document information can be greatly enriched, enhancing the query system's (such as a search engine's) ability to process complex query statements. Furthermore, when the query vocabulary 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 an online rewritten second query statement. This 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. Since online rewriting can expand the query statement from a semantic dimension, matching documents using online rewritten query statements greatly improves the success rate of document matching. Furthermore, by performing document queries from both offline and online dimensions, the document recall dimension is significantly expanded, optimizing query effectiveness.

[0044] In one embodiment, before executing step S101, a query word library and a document library may be generated in advance. The query word library and the document library may be generated by following steps A1 and A2.

[0045] Step A1: Obtain original query statements and original documents within a preset time period.

[0046] In step A2, the original query statement is input into a pre-trained offline query statement rewriting model for rewriting to obtain a rewritten query statement corresponding to the original query statement. Furthermore, the original document is input into a pre-trained multimodal document rewriting model for rewriting to obtain a rewritten document corresponding to the original document.

[0047] Optionally, when rewriting the original document, the document title of the original document is rewritten to obtain a rewritten document title, i.e., the rewritten document. If the original document includes image information, the multimodal document rewriting model is used to understand the image information and generate 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.

[0048] Offline query statement rewriting models, online query statement rewriting models and multimodal document rewriting models can all be trained based on sample data.

[0049] In one embodiment, the offline query statement rewriting model is trained through the following steps B1 and B2.

[0050] Step B1: Acquire first sample data, where the first sample data includes: a sample original query statement and a sample rewritten query statement corresponding to the sample original query statement.

[0051] Step B2: input the first sample data into the LLM to be trained to perform model training, and obtain an offline query statement rewriting model and an online query statement rewriting model.

[0052] The sample original query statements may include at least one of the following: a first original query statement within a first historical period, and a core entity in a document title. The sample rewritten query statements may include at least one of the following: a first rewritten query statement corresponding to the first original query statement, and a second rewritten query statement corresponding to the core entity.

[0053] 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 sample original query statement, thereby performing supervised model training. The trained offline query statement rewriting model can accurately rewrite the original query statement.

[0054] The first sample data can be obtained by at least one of the following methods: Method 1 is to expand the historical session click graph to generate a rewritten query statement with a high semantic similarity to the original query statement, which may specifically include the following steps B11 to B13.

[0055] Step B11: Obtain a user session click graph within a first historical period based on historical query records; the user session click graph includes: query statement information input by the user and document information clicked by the user.

[0056] The recording period corresponding to historical query records includes the first historical period. The specific period of the first historical period is not limited and can be, for example, the most recent week. The user session click graph is used to record and analyze user click behavior within a session, including which elements (such as buttons, links, and images) were clicked. Based on the user session click graph, it is possible to determine which query statements and documents the user clicked on, thereby establishing the association between the query statements and documents.

[0057] Step B12: construct a query-document association graph based on the query statement information and the document information. The query-document association graph is used to represent the association relationship between the first original query statement and the first original document.

[0058] The query-document association graph consists of multiple nodes and edges connecting them. Each node can represent two entities: a query entered by a user or a document clicked by a user. Edges represent the relationship between a query and a document. For example, if an edge exists between query A and document B, it means that the user clicked on document B when searching with query A. Since the query and document represented in the query-document association graph have not been rewritten, they can be referred to as the original query and document.

[0059] Step B13: Generate a first rewritten query statement corresponding to the first original query statement.

[0060] Optionally, for the first original query statement in the query document association graph, the first rewritten query statement may be obtained by generating synonyms, near synonyms and / or statements of the first original query statement with a semantic similarity higher than a predetermined threshold.

[0061] This method focuses on mining synonyms and near-synonyms, generating a high degree of semantic similarity between the first rewritten query and the first original query. By generating a first rewritten query corresponding to the first original query, an association is established between the first rewritten query and the first original document, thereby improving the success rate of subsequent document matching.

[0062] Method 2 is to mine query statements and document titles to generate rewritten query statements with consistent core entities and strong scalability, which may specifically include the following steps B14 to B16.

[0063] Step B14: Obtain historical query statements and historical documents associated with the historical query statements within the second historical period based on the historical query records.

[0064] The historical documents associated with the historical query statement refer to the historical documents found by the historical query statement. The recording period corresponding to the historical query record includes the second historical period, and the specific period of the second historical period is not limited.

[0065] Step B15: extract the core entities in the document titles of the historical documents based on the query intent expressed by the historical query sentences.

[0066] The essence of a query is a compressed representation of the user's query intent. Therefore, the query intent can be determined based on the keywords in the query. Next, the core entities that match the query intent are extracted from the document titles.

[0067] Step B16: Expand the core entity to obtain a second rewritten query statement.

[0068] Optionally, when the core entity is expanded, synonyms, near synonyms and / or entity words with a semantic similarity with the core entity higher than a predetermined threshold value can be generated, and / or the core entity can be expanded into a complete sentence to obtain a second rewritten query sentence. Since the core entity is consistent with the query intent expressed by the historical query sentence, by expanding the core entity in the document title, a query intent that is consistent with the original historical query sentence can be generated. Figure 1 The corresponding rewritten word is the second rewritten query statement. In addition, the core entity may be a word that matches the query intent expressed by the historical query statement but has low semantic similarity. Therefore, by expanding the core entity to obtain the rewritten query statement, it is possible to obtain a rewritten word with low semantic similarity to the original query statement but strong extensibility.

[0069] Method three uses an AI model to generate a third rewritten query corresponding to the third original query. The third original query can include at least one of the following: a relatively complex query or a knowledge-based query. These queries often require higher semantic understanding capabilities, so using an AI model to generate the rewritten query can ensure rewriting accuracy. Method three is more suitable for rewriting complex and knowledge-based queries, incorporating world knowledge to solve reasoning (rewriting) problems.

[0070] In some embodiments, after obtaining the first sample data, quality enhancement may be performed on the first sample data, where the quality enhancement includes knowledge enhancement and quality control.

[0071] Optionally, when performing knowledge enhancement on the first sample data, category prediction results, NER (named entity recognition) results, and new knowledge based on the expansion of the search session can be introduced.

[0072] 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.

[0073] Optionally, when performing quality control on the first sample data, the semantic similarity between the sample original query statement and the sample rewritten query statement can be calculated first, and then the sample rewritten query statements can be screened out according to the semantic similarity, for example, the sample rewritten query statements whose semantic similarity is lower than a preset threshold are screened out, so that the semantic similarity corresponding to the sample rewritten query statements retained after screening is higher than or equal to the preset threshold.

[0074] Optionally, when performing quality control on the first sample data, the sentence quality score of the sample rewritten query statement can be calculated first, and then the sample rewritten query statements can be screened out according to the sentence quality score. For example, the sample rewritten query statements with a sentence quality score lower than a preset score can be screened out, so that the sentence quality scores corresponding to the sample rewritten query statements retained after screening are higher than or equal to the preset score. The sentence quality score can be calculated based on the relevant information of the sample rewritten query statement itself, such as the click-through rate, bounce rate, number of queries, conversion rate, dwell time, and other information of the sample rewritten query statement. Based on the weights corresponding to these relevant information, a weighted calculation is performed on these relevant information to calculate the quality score of the sample rewritten query statement.

[0075] Based on the three methods of obtaining the first sample data listed in the above embodiment, after obtaining the first sample data, the offline query statement rewriting model and the online query statement rewriting model are trained using the first sample data. Figure 2 The training principle diagram of the offline query statement rewriting model and the online query statement rewriting model provided in the embodiment of the present application is shown as follows: Figure 2 As shown, first, sample data is acquired using the three methods described above, including the first original query within a first historical period, the core entity in the document title, the first rewritten query corresponding to the first original query, and the second rewritten query corresponding to the core entity. Quality enhancement is then performed on the first sample data, including knowledge enhancement and quality control. The enhanced first sample data is then input into the LLM to be trained, and the SFT is performed on the LLM using the sample rewritten query as the label of the sample original query, thereby training an offline query rewriting model and an online query rewriting model.

[0076] To train a query rewriting model suitable for both offline and online rewriting scenarios, two query rewriting models can be trained based on the first sample data, for example, a 14B model and a 0.5B model. The 14B model and the 0.5B model are neural network models with 14 billion and 500 million parameters, respectively. The 14B model focuses on rewriting quality and can be applied to offline rewriting scenarios, including T+1 predictions for queries, i.e., a one-day delayed prediction mechanism. 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 rewriting scenarios. Therefore, the 0.5B model can be used as an online query rewriting model.

[0077] Optionally, the usage ratio of the first sample data obtained in three ways during model training is pre-configured, for example Figure 2 As mentioned above, the first original query statement obtained using method 1 and its corresponding first rewritten query statement accounted for 3.2%, the core entity and the second rewritten query statement obtained using method 2 accounted for 95.4%, and the third original query statement obtained using method 3 and its corresponding third rewritten query statement accounted for 1.4%. Of course, the above is only an example of the different usage ratios of the three types of sample data. In actual applications, the usage ratios of the three types of sample data can be customized as needed.

[0078] 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 a DPO approach, including the following steps C1, C2, and C3.

[0079] Step C1: rewrite the second original query statement using the first query statement rewriting model to obtain a third rewritten query statement.

[0080] The second original query statement may be an original query statement extracted from the first sample data, or may be a re-collected original query statement.

[0081] Step C2: collecting query-document pairs corresponding to the third rewritten query statement, where the query-document pairs are used to represent documents found based on the third rewritten query statement.

[0082] Step C3: Optimizing the offline query statement rewriting model and / or the online query statement rewriting model according to the click-through rate of the query document pair.

[0083] The third rewritten query statements corresponding to the second original query statement may include multiple ones, each corresponding to at least one query-document pair. When executing step C3, the multiple third rewritten query statements may be ranked based on the click-through rate of the query-document pairs corresponding to each third rewritten query statement. Subsequently, the third rewritten query statements ranked in the top N and / or with a click-through rate above a preset click-through rate threshold are used as positive samples, and the other third rewritten query statements are used as negative samples to optimize the offline query statement rewriting model. Optimizing the offline query statement rewriting model through DPO can improve the rewriting efficiency and accuracy of the offline query statement rewriting model.

[0084] In some embodiments, the multimodal document rewriting model is trained by following steps D1 and D2.

[0085] Step D1: Acquire second sample data, which includes sample image information of a sample query object and sample text information corresponding to the sample image information. The sample text information includes a sample document title associated with the sample image information, object attribute information of the sample query object, and sample rewriting information.

[0086] The sample query object can be any object related to the query function, such as stores and products on online shopping software. Users can enter query statements in the query (or search) entrance of the online shopping software to query stores or products on the online shopping software. Taking the sample query object as an example, the sample image information can include store photos, store logos, photos of products sold in the store, etc. The sample document title can include the store name, store slogan, etc. The object attribute information can be the attribute information of the products sold in the store, such as category, name, function, detailed description, etc. The sample rewriting information of the sample query object can include at least one of the following: the rewriting result of the sample image information, the rewriting result of the sample document title, and the rewriting result of the object attribute information.

[0087] Optionally, at least one of the sample image information, the sample document title, and the object attribute information is input into the artificial intelligence model for rewriting to obtain sample rewritten information.

[0088] Step D2: Input the second sample data into the multimodal language model to be trained to perform model training to obtain a multimodal document rewriting model.

[0089] Among them, the multimodal language model includes VLM, which can understand image content and text information at the same time. Therefore, when the second sample data includes sample picture information, VLM can understand the sample data well and train a multimodal document rewriting model that can accurately identify image and text information.

[0090] Optionally, training the multimodal document rewriting model using the LORA method can enable the model to converge faster during training and maintain good general capabilities.

[0091] Figure 3 The training principle diagram of the multimodal document rewriting model provided in the embodiment of the present application is shown as follows: Figure 3 As shown, first, multimodal sample image and text information is obtained. The multimodal sample image and text information includes sample image information of the sample query object and the sample document title associated with the sample image information. Then, the multimodal sample image and text information is enhanced with knowledge, and the object attribute information of the sample query object is introduced, such as store information, product attributes, product category information, detailed description, basic attribute information, etc. Afterwards, the sample image information, sample document title and object attribute information are input into the artificial intelligence model for rewriting to obtain sample rewriting information. The multimodal sample image and text information, the object attribute information after knowledge enhancement and the sample rewriting information together constitute the second sample data. Afterwards, the second sample data is input into the multimodal language model to be trained for model training to obtain a multimodal document rewriting model.

[0092] After training the offline query statement rewriting model and the multimodal document rewriting model, the offline query statement rewriting model and the multimodal document rewriting model are used to rewrite the original query statement on the query side and the document on the document side respectively, and queries are performed based on the rewritten query vocabulary and document library.

[0093] In some embodiments, after matching the first query statement with the query lexicon to determine whether the query lexicon contains the first query statement (i.e., step S102), if the query lexicon contains the first query statement, step S103 is executed. If the query lexicon does not contain the first query statement, the first query statement is first rewritten using the online query statement rewriting model to obtain a second query statement after online rewriting, and then the second query statement is queried in the document library to obtain a second target document that matches the second query statement from the original document and / or rewritten document 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 0.5B model in the embodiment shown.

[0094] Optionally, the second query statement is added to the query vocabulary, and an association relationship is established between the second query statement and the second target document.

[0095] In this embodiment, if the query lexicon does not contain the first query statement, an online query rewriting model, such as the 0.5B model suitable for online rewriting, is used to rewrite the first query statement into a second query statement, which is then matched against the document repository, thereby improving the document matching success rate. Furthermore, by adding the rewritten second query statement to the query lexicon, the query lexicon becomes richer and more complete. When the first query statement is used again, since the rewritten second query statement is already stored in the query lexicon and the document repository can match the corresponding document, there is no need to rewrite the first query statement online, thereby reducing the system performance pressure when the first query statement is used again.

[0096] Figure 4 The schematic diagram of the query method provided by the embodiment of the present application is shown. In this embodiment, the query statement rewriting model is LLM, including a 14B model suitable for offline rewriting (i.e., an offline query statement rewriting model) and a 0.5B model suitable for online rewriting (i.e., an online query statement rewriting model). The multimodal document rewriting model is VLM. Figure 4 As shown, first, the full query statement is rewritten using the pre-trained 14B model to obtain a rewritten query statement; and the document title of the full document is rewritten using the pre-trained VLM to obtain a rewritten document. Afterwards, the rewritten query statement and the rewritten document are quality controlled separately. Optionally, when performing quality control on the rewritten query statement, the semantic similarity between the rewritten query statement and the corresponding original query statement is calculated, thereby deleting the rewritten query statements with a semantic similarity lower than a predetermined threshold, and only retaining the rewritten query statements with a semantic similarity higher than or equal to a predetermined threshold. When performing quality control on the rewritten document, the semantic similarity between the rewritten document and the corresponding original document is calculated, thereby deleting the rewritten documents with a semantic similarity lower than a predetermined threshold, and only retaining the rewritten documents with a semantic similarity higher than or equal to a predetermined threshold.

[0097] 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 information and text information. Therefore, the pre-trained VLM can rewrite the original document to obtain a rewritten document corresponding to the original document, where the rewritten document includes rewritten content corresponding to the image information and / or text information. The rewritten document can also be referred to as a multimodal rewritten document.

[0098] Afterwards, the rewritten query statements and multimodal rewritten documents obtained after quality control are cached offline respectively. Optionally, the rewritten query statements and the corresponding original query statements are stored in an online link cache to obtain a query vocabulary library; the multimodal rewritten documents and the corresponding original documents are stored in an online link cache to obtain a document library.

[0099] Subsequently, upon receiving a query request based on the first query statement, the first query statement is matched against the query lexicon to determine whether the query lexicon contains the first query statement. If the query lexicon contains the first query statement (i.e., a successful match), a first target document associated with the first query statement is retrieved from the document library. If the query lexicon does not contain the first query statement (i.e., a failed match), the first query statement is rewritten online using the pre-trained 0.5B model to obtain a second query statement. The second query statement is then matched against the document library to determine a second target document that matches the second query statement.

[0100] Afterwards, the second query statement is stored in the query vocabulary as a rewritten query statement corresponding to the first query statement, so as to make the query vocabulary more abundant and complete.

[0101] It can be seen that by adopting the technical solution provided by the embodiment of the present application, by rewriting the query side and the document side at the same time, the query statement on the query side and the document content on the document side are enriched, so that when using the first query statement to query a document, the first query statement is first matched with the query vocabulary to determine whether the query vocabulary contains the first query statement. In the case that the query vocabulary contains the first query statement, the first target document associated with the first query statement is obtained from the document library. Since the query vocabulary includes the original query statement and the rewritten query statement corresponding to the original query statement, such as the synonyms and antonyms of the original query statement, the matching success rate of the first query statement can be improved. Moreover, since the document library includes the original document associated with each query statement and the rewritten document corresponding to the original document, such as a document with the same semantics as the original document, when matching the first query statement, the original document and its corresponding rewritten document can be used as matching objects, thereby improving the success rate of matching the first query statement to the document. If the query lexicon 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 with the rewritten document library, thereby improving the document matching success rate. In addition, by adding the rewritten second query statement to the query lexicon, the query lexicon becomes richer and more complete. When the first query statement is used again, since the rewritten second query statement is already stored in the query lexicon and the document library can match the document corresponding to the second query statement, there is no need to rewrite the first query statement online, thereby reducing the system performance pressure when the first query statement is used again. It can be seen that by rewriting on both the query side and the document side, document information can be greatly enriched, the query system (such as a search engine) can be enhanced to process complex query statements, the recall dimension of documents can be significantly expanded, and the query effect can be optimized.

[0102] Corresponding to the application scenario and method of the method provided in the embodiment of the present application, the embodiment of the present application also provides a query device.

[0103] Figure 5 A block diagram of a query device provided in an embodiment of the present application is shown. Figure 5 As shown, the query device includes: A first acquisition module 51 is configured to acquire a pre-generated query vocabulary and document library in response to querying a document using a first query statement; the query vocabulary includes an original query statement and a rewritten query statement obtained by rewriting the original query statement using a pre-trained first query statement rewriting model; the document library includes an original document associated with each query statement and a rewritten document obtained by rewriting the original document 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, wherein the second sample data includes sample image information related to a sample query object and / or sample text information corresponding to the sample image information; A matching module 51 is configured to match the first query statement with the query lexicon to determine whether the query lexicon contains the first query statement; The second acquisition module 52 is used to 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 when the query vocabulary contains the first query statement; rewrite the first query statement using a pre-trained online query statement rewriting model to obtain an online rewritten second query statement when the query vocabulary does not contain the first query statement; 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; 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.

[0104] Optionally, the device further comprises: A third acquisition module is configured to acquire first sample data before acquiring the pre-generated query vocabulary and document vocabulary in response to querying the document using the first query statement; the first sample data includes: a sample original query statement and a sample rewritten query statement corresponding to the sample original query statement; 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 statement rewriting model and the online query statement rewriting model.

[0105] Optionally, the sample original query statement includes a first original query statement; the sample rewritten query statement includes a first rewritten query statement; When acquiring the first sample data, the third acquisition module performs the following steps: Obtaining a user session click graph within a first historical period based on the historical query records; the user session click graph includes: query statement information input by the user and document information clicked by the user; Constructing a query-document association graph based on the query statement information and the document information; 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.

[0106] Optionally, the sample original query statement includes a core entity in a document title; the sample rewritten query statement includes a second rewritten query statement; When acquiring the first sample data, the third acquisition module performs the following steps: Acquire historical query statements and historical documents associated with the historical query statements within a second historical period according to the historical query records; Extracting core entities from the document titles of the historical documents based on the query intent expressed by the historical query sentences; The core entity is expanded to obtain the second rewritten query statement.

[0107] Optionally, the device further comprises: a calculation module, configured to calculate the semantic similarity between the sample original query statement and the sample rewritten query statement after obtaining the first sample data; The screening module is configured to screen out the sample rewritten query statements according to the semantic similarity, so that the semantic similarity corresponding to the sample rewritten query statements retained after screening is higher than or equal to a preset threshold.

[0108] Optionally, the device further comprises: a second rewriting module configured to input the first sample data into a large language model to be trained for model training, obtain the offline query statement rewriting model and the online query statement rewriting model, and then rewrite the second original query statement using the offline query statement rewriting model to obtain a third rewritten query statement; A collection module, configured to collect query-document pairs corresponding to the third rewritten query statement; the query-document pairs are used to represent documents retrieved based on the third rewritten query statement; An optimization module is used to optimize the offline query statement rewriting model and / or the online query statement rewriting model according to the click rate of the query document pair.

[0109] Optionally, the device further comprises: a fourth acquisition module, configured to acquire second sample data before acquiring the pre-generated query vocabulary and document vocabulary in response to querying the document using the first query statement; the second sample data comprising: the sample image information and the sample text information; the sample text information comprising: a sample document title associated with the sample image information, object attribute information of the sample query object, and sample rewriting information; The second training module is used to input the second sample data into the multimodal language model to be trained to perform model training to obtain the multimodal document rewriting model.

[0110] Optionally, the fourth acquisition module performs the following steps when acquiring the second sample data: The sample image information, the sample document title and the object attribute information are input into an artificial intelligence model for rewriting to obtain the sample rewritten information.

[0111] Optionally, the device further comprises: An adding module, configured to add the second query statement to the query vocabulary; An establishing module is used to establish an association relationship between the second query statement and the second target document.

[0112] According to an embodiment of the present application, when searching for documents using a first query statement, the device obtains a pre-generated query lexicon and document library, and then matches the first query statement with the query lexicon to determine whether the query lexicon contains the first query statement. Because the query lexicon includes the original query statement and rewritten query statements obtained by rewriting the original query statement using a pre-trained offline query rewriting model, such as synonyms and synonyms of the original query statement, the matching success rate of the first query statement can be improved. Furthermore, if the query lexicon 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. Because the document library includes the original documents associated with each query statement and 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 targets, thereby improving the success rate of matching the first query statement to documents. It can be seen that by rewriting both the query and document sides simultaneously, document information can be greatly enriched, enhancing the query system's (such as a search engine's) ability to process complex query statements. Furthermore, when the query vocabulary 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 an online rewritten second query statement. This 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. Since online rewriting can expand the query statement from a semantic dimension, matching documents using online rewritten query statements greatly improves the success rate of document matching. Furthermore, by performing document queries from both offline and online dimensions, the document recall dimension is significantly expanded, optimizing query effectiveness.

[0113] The functions of each module in each device in the embodiments of the present application can be found in the corresponding description in the above method, and have corresponding beneficial effects, which will not be repeated here.

[0114] Figure 6 A block diagram of an electronic device for implementing the embodiments of the present application. Figure 6 As shown, the electronic device includes a memory 601 and a processor 602. The memory 601 stores a computer program executable by the processor 602. When the processor 602 executes the computer program, the method described in the above embodiment is implemented. The number of the memory 601 and the processor 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.

[0115] In a specific implementation, if the memory 601, processor 602, and communication interface 603 are implemented independently, the memory 601, processor 602, and communication interface 603 can be connected to each other via a bus and communicate with each other. The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0116] Optionally, in a specific implementation, if the memory 601 , the processor 602 , and the communication interface 603 are integrated on a chip, the memory 601 , the processor 602 , and the communication interface 603 may communicate with each other through an internal interface.

[0117] An embodiment of the present application provides a computer-readable storage medium storing a computer program, which implements the method provided in the embodiment of the present application when the program is executed by a processor.

[0118] An embodiment of the present application provides a computer program product, including a computer program, which implements the method provided in the embodiment of the present application when executed by a processor.

[0119] An embodiment of the present application also provides a chip, which includes a processor for calling and executing instructions stored in the memory from the memory, so that a communication device equipped with the chip executes the method provided in the embodiment of the present application.

[0120] An embodiment of the present application also provides a chip, including: an input interface, an output interface, a processor and a memory. The input interface, the output interface, the processor and the memory are connected through an internal connection path. The processor is used to execute the code in the memory. When the code is executed, the processor is used to execute the method provided in the embodiment of the application.

[0121] It should be understood that the processor described above may 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 device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor may be a microprocessor or any conventional processor. It is worth noting that the processor may be a processor that supports the Advanced RISC Machine (ARM) architecture.

[0122] Furthermore, 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 volatile and non-volatile memory. 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 memory. By way of example and not limitation, many forms of RAM are available. For example, static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM) and direct memory bus random access memory (DR RAM).

[0123] In the above embodiments, all or part of the embodiments may be implemented using software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of 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, the processes or functions according to the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another.

[0124] In the description of this specification, the reference terms "one embodiment," "some embodiments," "example," "specific example," or "some examples" mean that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials, or characteristics described may be combined in any appropriate manner in any one or more embodiments or examples. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification, as well as features of different embodiments or examples, unless they are mutually inconsistent.

[0125] 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 being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. Throughout the description of this application, "plurality" means two or more, unless otherwise specifically defined.

[0126] Any process or method described in the flowchart or otherwise described herein can be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a specific logical function or process. The scope of the preferred embodiments of the present application includes other implementations in which the functions may be performed in a different order than shown or discussed, including performing the functions substantially simultaneously or in reverse order depending on the functions involved.

[0127] The logic and / or steps described in the flowchart or otherwise described 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 an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions from and execute instructions on an instruction execution system, apparatus or device), or used in conjunction with such instruction execution systems, apparatuses or devices.

[0128] It should be understood that various parts of the present 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 a memory and executed by a suitable instruction execution system. All or part of the steps of the above embodiment method can be completed by instructing the relevant hardware through a program, which can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.

[0129] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing module, or each unit may exist physically separately, or two or more units may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or in the form of software functional modules. If the aforementioned integrated modules are implemented in the form of software functional modules and sold or used as independent products, they may also be stored in a computer-readable storage medium. The storage medium may be a read-only memory, a magnetic disk, or an optical disk, etc.

[0130] The above is merely an exemplary embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various modifications or substitutions within the technical scope described in this application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A query method, characterized in that: include: In response to querying a document using a first query statement, obtaining a pre-generated query word library and document library; The query vocabulary 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, wherein the second sample data includes sample image information related to a sample query object and / or sample text information corresponding to the sample image information; Matching the first query statement with the query lexicon to determine whether the query lexicon contains the first query statement; In a case where the query word library includes the first query statement, querying 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 lexicon does not include the first query statement, rewrite the first query statement using a pre-trained online query statement rewriting model to obtain an online rewritten second query statement; Querying 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; 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 less than the model parameters of the offline query statement rewriting model.

2. The method according to claim 1, characterized in that Before obtaining the pre-generated query vocabulary and document vocabulary in response to querying the document using the first query statement, the method further includes: Acquire first sample data; the first sample data includes: a sample original query statement and a sample rewritten query statement corresponding to the sample original query statement; The first sample data is input into a large language model to be trained for model training to obtain the offline query statement rewriting model and the online query statement rewriting model.

3. The method according to claim 2, characterized in that The sample original query statement includes a first original query statement; the sample rewritten query statement includes a first rewritten query statement; The obtaining of the first sample data includes: Obtaining a user session click graph within a first historical period based on the historical query records; the user session click graph includes: query statement information input by the user and document information clicked by the user; Constructing a query-document association graph based on the query statement information and the document information; 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 sample original query sentence includes the core entity in the document title; The sample rewritten query statement includes a second rewritten query statement; The obtaining of the first sample data includes: Acquire historical query statements and historical documents associated with the historical query statements within a second historical period according to the historical query records; Extracting core entities from the document titles of the historical documents based on the query intent expressed by the historical query sentences; 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 method further includes: Calculating the semantic similarity between the sample original query statement and the sample rewritten query statement; The sample rewritten query statements are screened out according to the semantic similarity, so that the semantic similarity corresponding to the sample rewritten query statements retained after screening out 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 to obtain the offline query statement rewriting model and the online query statement rewriting model, the method further includes: Rewriting the second original query statement using the offline query statement rewriting model to obtain a third rewritten query statement; Collecting query-document pairs corresponding to the third rewritten query statement; the query-document pairs are used to represent documents found based on the third rewritten query statement; The offline query statement rewriting model and / or the online query statement rewriting model are optimized according to the click rate of the query document pair.

7. The method according to claim 1, characterized in that Before obtaining the pre-generated query vocabulary and document vocabulary in response to querying the document using the first query statement, the method further includes: Acquire second sample data; the second sample data includes: the sample image information and the sample text information; the sample text information includes: a sample document title associated with the sample image information, object attribute information of the sample query object, and sample rewriting information; The second sample data is input into the multimodal language model to be trained for model training to obtain the multimodal document rewriting model.

8. The method according to claim 7, characterized in that The obtaining of the second sample data includes: The sample image information, the sample document title and the object attribute information are input into an artificial intelligence model for rewriting to obtain the sample rewritten information.

9. The method according to claim 1, characterized in that Also includes: adding the second query statement to the query vocabulary; An association relationship is established between the second query statement and the second target document.

10. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory, wherein the processor implements the method according to any one of claims 1 to 9 when executing the computer program.

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

  • Text rewriting method, model training method, query method and related devices

    CN119558282A

  • Query rewriting method and query rewriting device

    CN119577119A

  • Question-answer corpus generation method and device based on text generation model

    WO2022095368A1