Query processing method, electronic equipment and storage medium
By combining the target query rewriting model with multi-source feedback data to rewrite and analyze the initial query request, the problem of high manual annotation cost in retrieval enhancement generation is solved, and the retrieval effect and user experience are improved.
Patent Information
- Application Number
- CN202410304083.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-15
- Publication Date
- 2025-09-16
AI Technical Summary
In the prior art, the manual annotation cost of rewriting user query requests during the search enhancement generation process is high, resulting in poor search results and poor user experience.
The target query rewriting model is used to rewrite and analyze the initial query request and historical conversation records, and the model trained with multi-source feedback data is used to generate the target query request, reducing the cost of manual labeling and improving the retrieval generation effect.
By reducing the cost of manual annotation, the accuracy of retrieval generation and user experience are improved, and more accurate query results are generated.
Smart Images

Figure CN120653723A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to large model technology and data processing fields, and specifically to a query processing method, electronic device, and storage medium. Background Art
[0002] Retrieval-Augmented Generation (RAG) is a technology that combines information retrieval and text generation. Its goal is to enable large language models (LLMs) to obtain additional information from external knowledge sources, thereby generating more accurate and contextually appropriate answers and reducing the generation of erroneous information. Therefore, RAG has been widely used in numerous LLM-related products. In scenarios involving multi-round conversational interactions with users, search engines are often unable to directly process user queries and conversation histories. Therefore, in the RAG process, understanding and rewriting user queries by integrating conversation histories is crucial. Related technologies can rewrite queries using supervised fine-tuning (SFT) or using rewriting preference feedback from a single source. However, existing rewriting methods require a large amount of manually annotated data, resulting in high manual annotation costs, which in turn affects RAG's retrieval performance, generation quality, and user experience.
[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention
[0004] The embodiments of the present application provide a query processing method, an electronic device, and a storage medium to at least solve the technical problems of high manual annotation costs and poor retrieval generation effects in the related art of rewriting user query requests during retrieval enhancement generation.
[0005] According to one aspect of an embodiment of the present application, a query processing method is provided, including: obtaining an initial query request and historical conversation records associated with the initial query request; using a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, and rewrite the initial query request into a target query request, wherein the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process; and generating a target query answer based on the target query request.
[0006] According to another aspect of an embodiment of the present application, a query processing method is also provided, including: obtaining an initial query sample and a sample conversation record corresponding to the initial query sample; using an initial query rewriting model to rewrite and analyze the initial query sample and the sample conversation record, and rewrite the initial query sample into a target query sample; using the target query sample to obtain multi-source feedback data, wherein the multi-source feedback data is multiple types of query quality assessment data obtained in the process of training the initial query rewriting model; updating the model parameters of the initial query rewriting model based on the multi-source feedback data, and generating a target query rewriting model, wherein the target query rewriting model is used to rewrite and analyze the initial query request and the historical conversation record associated with the initial query request, and rewrite the initial query request into a target query request to generate a target query answer.
[0007] According to another aspect of an embodiment of the present application, a query processing method is also provided, including: obtaining an initial query request through a first application programming interface; returning a target query response through a second application programming interface; wherein the response data carried in the target query response includes: query answer content, the query answer content is generated based on the target query request, the target query request is obtained by rewriting and analyzing the initial query request and the historical conversation records associated with the initial query request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process.
[0008] According to another aspect of an embodiment of the present application, a query processing method is also provided, including: obtaining a currently input query dialogue request; returning a query dialogue reply in response to the query dialogue request, wherein the information carried in the query dialogue reply includes: query answer content, the query answer content is generated based on a target query request, the target query request is obtained by rewriting and analyzing the query dialogue request and historical dialogue records associated with the query dialogue request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is multiple types of query quality assessment data obtained by the target query rewriting model during the model training process; and the query answer content is displayed in a graphical user interface.
[0009] According to another aspect of the embodiments of the present application, an electronic device is further provided, including: a memory storing an executable program; and a processor for running the program, wherein when the program runs, the query processing method of any one of the embodiments of the present application is executed.
[0010] According to another aspect of an embodiment of the present application, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored executable program, wherein when the executable program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the query processing methods in the embodiments of the present application.
[0011] According to another aspect of the embodiments of the present application, a computer program product is further provided, including a computer program, which implements the query processing method of any one of the embodiments of the present application when executed by a processor.
[0012] In an embodiment of the present application, by obtaining an initial query request and historical conversation records associated with the initial query request, and then using a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, the initial query request is rewritten into a target query request, and finally a target query answer is generated based on the target query request, thereby achieving the purpose of accurately obtaining the query result corresponding to the initial query request, thereby achieving the technical effect of reducing manual annotation costs and improving retrieval generation effects, and thus solving the technical problems of high manual annotation costs and poor retrieval generation effects in related technologies for rewriting user query requests in the process of retrieval enhancement generation.
[0013] It is easy to notice that the above general description and the following detailed description are merely for the purpose of exemplifying and explaining the present application, and do not constitute a limitation of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0015] Figure 1 This is a schematic diagram of an application scenario of a query processing method according to Example 1 of the present application;
[0016] Figure 2 is a flowchart of a query processing method according to Example 1 of the present application;
[0017] Figure 3 is a schematic diagram of a query processing method according to Example 1 of the present application;
[0018] Figure 4 is a flowchart of a query processing method according to Example 2 of the present application;
[0019] Figure 5 is a flowchart of a query processing method according to Example 3 of the present application;
[0020] Figure 6is a flowchart of a query processing method according to Example 4 of the present application;
[0021] Figure 7 is a structural block diagram of a query processing device according to embodiment 5 of the present application;
[0022] Figure 8 is a structural block diagram of another query processing device according to embodiment 5 of the present application;
[0023] Figure 9 is a structural block diagram of another query processing device according to embodiment 5 of the present application;
[0024] Figure 10 is a structural block diagram of another query processing device according to embodiment 5 of the present application;
[0025] Figure 11 This is a structural block diagram of a computer terminal according to Example 1 of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] The technical solution provided in this application is mainly implemented using large-scale model technology. The large model here refers to a deep learning model with large-scale model parameters, which can usually contain hundreds of millions, tens of billions, hundreds of billions, trillions, or even more than ten trillion model parameters. The large model can also be called a cornerstone model / foundation model. It is pre-trained by using large-scale unlabeled corpus to produce a pre-trained model with more than 100 million parameters. This model can adapt to a wide range of downstream tasks and has good generalization capabilities, such as LLM and multi-modal pre-training model.
[0029] It should be noted that when the large model is actually applied, the pre-trained model can be fine-tuned through a small number of samples, so that the large model can be applied to different tasks. For example, the large model can be widely used in natural language processing (NLP), computer vision, speech processing and other fields. Specifically, it can be applied to computer vision tasks such as visual question answering (VQA), image caption (IC), image generation, etc. It can also be widely used in natural language processing tasks such as text-based sentiment classification, text summary generation, and machine translation. Therefore, the main application scenarios of the large model include but are not limited to digital assistants, intelligent robots, search, online education, office software, e-commerce, intelligent design, etc. In the embodiment of the present application, data processing through the target query rewriting model in the query scenario is taken as an example for explanation,
[0030] First, some nouns or terms that appear in the description of the embodiments of the present application are subject to the following interpretations:
[0031] Retrieval-enhanced generation: Combine generation with retrieval to enhance the capabilities of the LLM model by plugging in other data sources.
[0032] Information Retrieval: Technology for quickly finding relevant documents from large unstructured document collections.
[0033] Multi-round query rewriting: This is mainly used in dialogue systems. Its core is to decompose the intent of the current query, resolve references, and complete omissions. The hope is that the rewritten statement can express more complete semantic information and transform the multi-round query into one or more queries that are more suitable for retrieval systems (such as search engines).
[0034] Supervised fine-tuning: refers to using labeled data to adjust a pre-trained LLM to make it more suitable for a specific task.
[0035] Reinforcement Learning from Human Feedback (RLHF) language model: It is an LLM training method that combines reinforcement learning with human feedback.
[0036] Example 1
[0037] According to an embodiment of the present application, a query processing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0038] Considering the huge number of model parameters of large models and the limited computing resources of mobile terminals, the query processing method provided in the embodiment of the present application can be applied to Figure 1 The application scenarios shown are not limited to this. Figure 1 In the illustrated application scenario, the large model is deployed on a server 10. The server 10 can be connected to one or more client devices 20 via a local area network, a wide area network, the Internet, or other types of data networks. The client devices 20 herein may include, but are not limited to, smartphones, tablet computers, laptops, PDAs, personal computers, smart home devices, and in-vehicle devices. The client devices 20 can interact with users via a graphical user interface to access the large model and thereby implement the methods provided in the embodiments of the present application.
[0039] In an embodiment of the present application, a system consisting of a client device and a server may perform the following steps: the server receives a currently input query dialog request from the client device, then, in response to the query dialog request, returns a query dialog reply to the client device and displays the query answer content in the client device's graphical user interface. The query dialog reply carries information including query answer content, which is generated based on a target query request generated by rewriting and analyzing the query dialog request and historical conversation records associated with the query dialog request using a target query rewriting model. The target query rewriting model is trained based on multi-source feedback data, which is multiple types of query quality assessment data acquired during the target query rewriting model training process.
[0040] It should be noted that, when the operating resources of the client device can meet the deployment and operating conditions of the large model, the embodiments of the present application can be carried out in the client device.
[0041] Under the above operating environment, this application provides Figure 2 The query processing method shown. Figure 2 This is a flow chart of a query processing method according to Example 1 of the present application. Figure 2 As shown, the method may include the following steps:
[0042] Step S21, obtaining an initial query request and historical conversation records associated with the initial query request;
[0043] Step S22: Using a target query rewriting model to rewrite and analyze the initial query request and historical conversation records, rewriting the initial query request into a target query request. The target query rewriting model is trained based on multi-source feedback data, which is various types of query quality assessment data obtained by the target query rewriting model during model training.
[0044] Step S23: Generate a target query answer based on the target query request.
[0045] The initial query request mentioned above can be the query entered by the current user. The initial query request can be a request for specific information, a request to perform a specific operation, or a request to ask a specific question. The historical conversation records associated with the initial query request refer to all interaction records in the conversation in which the query request occurs, including all conversation content and information exchanged between the user and the system. Obtaining the initial query request and its associated historical conversation records can help the system understand the user's needs and background information, thereby better providing services and solving problems for the user.
[0046] For example, the initial query request can be obtained through user input, system triggering, or other channels. The initial query request can be a question or request posed by the user to the system, or a query request automatically triggered by the system. After receiving the initial query request, the historical conversation history related to the initial query request will be recorded, including information such as the content of the communication between the user and the system, the system's response, and the user's feedback.
[0047] The above-mentioned target query rewriting model is a model that uses natural language processing technology to rewrite and analyze the initial query request with historical conversation records, thereby generating a more accurate target query request. Specifically, the target query rewriting model can be a multi-round query rewriting model. The goal of the multi-round query rewriting model is to perform intent decomposition, reference resolution, and omission completion on the current user query based on historical conversation records to generate one or more queries with more complete semantics. The rewritten query enables the retrieval module to retrieve relevant information more accurately, thereby improving the accuracy of the LLM's answers. The target query rewriting model can also be used as a rewriting module embedded in the LLM, so that the LLM generates more accurate and more contextual answers.
[0048] For example, when using a target query rewriting model to rewrite and analyze the initial query request and historical conversation records, the target query rewriting model can identify any inaccurate, ambiguous, or incomplete information that may exist in the initial query request by analyzing and comparing the historical conversation records with the initial query request, and rewrite it into a more accurate, clear, and complete target query request. The difference between the target query request and the initial query request is that after the rewriting analysis, the target query request will contain more precise information, clearer expression, and more complete content. The rewritten target query request can better meet the user's needs and provide more accurate search results or information.
[0049] The target query rewriting model is trained based on multi-source feedback data. The multi-source feedback data refers to various types of query quality assessment data obtained by the target query rewriting model during the model training process. The multi-source feedback data includes but is not limited to rewriting quality feedback data, retrieval quality feedback data, and question and answer quality feedback data. Rewriting quality feedback data refers to data on users' evaluation of the quality of the rewritten target query request, including users' evaluation of the fluency, accuracy, grammar, and spelling of the target query request. Retrieval quality feedback data refers to data on users' evaluation of the quality of the retrieval results, including users' evaluation of the relevance, accuracy, and completeness of the retrieval results. Question and answer quality feedback data refers to data on users' evaluation of the quality of the question and answer service, including users' evaluation of the accuracy, clarity, and practicality of the answers.
[0050] The above-mentioned target query answers are results or suggestions that meet the target requirements, obtained through analysis and screening based on the information and conditions in the target query request. Target query answers may include specific action steps, solutions, suggested implementation methods, etc. to help answer the user's question. For example, if the target query request is about how to improve sales performance, the target query answer may include suggestions and methods in market research, marketing strategies, customer relationship management, etc. The process of generating target query answers based on target query requests generally requires comprehensive consideration of the target's background information, current situation, and conditions to provide the most appropriate solution.
[0051] For example, in the implementation process of generating a target query answer based on a target query request, the specific content and requirements of the target query request must first be clarified, including information such as the query subject, scope, and time. Then, based on the target query request, various relevant information and data are collected, including literature, statistical data, expert opinions, etc. The collected information and data are then analyzed and organized, and content relevant to the target query request is screened out and comprehensively analyzed. Finally, based on the query request and the analysis results, combined with professional knowledge and experience, target query answer content that meets the requirements is generated. Furthermore, the generated answer content can be proofread and modified to ensure that the information is accurate, clear, and meets the requirements of the query request. When the generated target query answer content is output, it can be in the form of written text, reports, charts, presentations, etc., to meet the needs of the inquirer. It should be noted that the above is a basic implementation method, and the specific operations can be appropriately adjusted and supplemented according to the specific query request and requirements, and the embodiments of this application are not limited thereto.
[0052] Based on the above steps S21 to S23, by obtaining the initial query request and the historical conversation records associated with the initial query request, and then using the target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, the initial query request is rewritten into a target query request, and finally a target query answer is generated based on the target query request, thereby achieving the purpose of accurately obtaining the query result corresponding to the initial query request, thereby achieving the technical effect of reducing the manual annotation cost and improving the retrieval generation effect, and thus solving the technical problem of high manual annotation cost and poor retrieval generation effect in the related technology of rewriting user query requests in the process of retrieval enhancement generation.
[0053] The query processing method in the embodiment of the present application is further introduced below.
[0054] In an optional embodiment, the query processing method in the embodiment of the present application further includes:
[0055] Step S201: obtaining an initial query sample and a sample conversation record corresponding to the initial query sample;
[0056] Step S202: Using the initial query rewriting model, rewriting and analyzing the initial query sample and the sample conversation record, rewriting the initial query sample into a target query sample;
[0057] Step S203, using the target query sample to obtain multi-source feedback data;
[0058] Step S204 : updating the model parameters of the initial query rewriting model based on the multi-source feedback data to generate a target query rewriting model.
[0059] The initial query samples mentioned above can be training datasets for multi-round query rewriting models. Initial query samples can be user requests for specific information, requests to perform specific operations, or requests to ask specific questions. The sample conversation records associated with the initial query samples refer to all interaction records in the conversation containing the query request, including all conversation content and information exchanged between the user and the system. Obtaining the initial query samples and their associated sample conversation records helps the system understand the user's needs and background information, thereby better providing services and resolving problems for the user.
[0060] The aforementioned initial query rewriting model can rewrite and analyze initial query samples and sample conversation records, thereby rewriting the initial query samples into more accurate target query samples. Using the target query samples, it acquires multi-source feedback data and updates the model parameters of the initial query rewriting model based on this multi-source feedback data. This allows the initial query rewriting model to better adapt to user needs and context, improving its usability and adaptability. By acquiring and analyzing multi-source feedback data, data-driven decision-making and model optimization can be achieved, enhancing the system's intelligence and adaptability. This allows for the development of a high-performance target query rewriting model, enabling users to obtain more accurate and tailored query results, improving user experience and satisfaction.
[0061] Based on the above optional embodiment, by obtaining the initial query sample and the sample conversation record corresponding to the initial query sample, and then using the initial query rewriting model to rewrite and analyze the initial query sample and the sample conversation record, the initial query sample is rewritten into a target query sample, and then the target query sample is used to obtain multi-source feedback data, and finally the model parameters of the initial query rewriting model are updated based on the multi-source feedback data, so that the target query rewriting model with improved performance can be quickly obtained, thereby further improving the model training efficiency and retrieval generation effect.
[0062] In an optional embodiment, in step S202, rewriting analysis of the initial query sample and the sample conversation record using the initial query rewriting model includes at least one of the following: in the initial query rewriting model, performing intent decomposition on the initial query sample based on the sample conversation record; in the initial query rewriting model, performing reference resolution on the initial query sample based on the sample conversation record; in the initial query rewriting model, performing omission completion on the initial query sample based on the sample conversation record.
[0063] Specifically, the initial query rewriting model can be a multi-round query rewriting model. The goal of the multi-round query rewriting model is to perform intent decomposition, coreference resolution, and omission completion on the current user's query based on sample conversation records to generate one or more queries with more complete semantics. The rewritten queries enable the retrieval module to more accurately retrieve relevant information, thereby improving the accuracy of the LLM's answers. The initial query rewriting model can also serve as a rewriting module embedded in the LLM, enabling the LLM to generate more precise and contextually appropriate answers.
[0064] Intent decomposition is a method of operating on initial query samples. Through intent decomposition, complex initial query samples can be broken down into more specific sub-query samples, thereby more accurately understanding user intent. In the initial query rewriting model, intent decomposition can be used to break down the user's overall query into multiple specific sub-queries based on sample conversation records, thereby better understanding the user's needs. This intention decomposition operation can improve the model's understanding and recognition of user intent, thereby more accurately matching user needs and providing users with more precise search results or suggestions, greatly improving the model's technical performance, enabling it to better meet user needs and enhance the user experience.
[0065] Co-reference resolution is achieved by identifying and understanding the specific objects or concepts referred to by pronouns in a conversation, thereby making the initial query sample clearer and more accurate. In the initial query rewriting model, performing co-reference resolution on the initial query sample based on sample conversation records can improve the model's understanding and expression of the conversation content, thereby enhancing the model's natural language processing technology. Through co-reference resolution, the initial query rewriting model can more accurately understand the objects referred to by pronouns in the conversation, thereby better understanding the conversation content, accurately identifying important information in the conversation, and better preserving the context and meaning of the conversation when rewriting the query sample. This can improve the model's performance in natural language processing tasks and make the text generated by the model more accurate, natural, and contextual.
[0066] Omission completion uses existing conversation records to infer and complete information that may have been omitted from the initial query. The initial query rewriting model uses sample conversation records to perform omission completion on initial query samples, improving query accuracy and completeness. By analyzing conversation records, the initial query rewriting model can identify and complete potentially omitted information, making query results more comprehensive and accurate. This helps users find the information they need faster, improving search efficiency and user satisfaction.
[0067] For example, the initial query sample is "How do I purchase service A, and what are its advantages?" After intent decomposition, the initial query sample needs to be split into "How do I purchase service A?" and "What are the advantages of service A?". Another example is that in the initial query sample, the user first asks "How do I purchase service A, and what are its advantages?" and then asks "How much does one instance cost?" After reference resolution, the initial query sample needs to refer to "one instance," thus rewriting the initial query sample to "How much does one instance of service A cost?". Another example is that in the initial query sample, the user first asks "How do I purchase service A, and what are its advantages?" and then asks "What about service B?" After omission completion, the initial query sample needs to be rewritten to "How do I purchase service B, and what are its advantages?".
[0068] Based on the above optional embodiment, by performing at least one of intent decomposition, reference resolution, and omission completion on the initial query sample based on the sample conversation record in the initial query rewriting model, the flexibility and generation efficiency of the rewriting analysis are further improved, and the retrieval generation effect is further improved.
[0069] In an optional embodiment, in step S203, obtaining multi-source feedback data using the target query sample includes:
[0070] Step S2031: using the target query sample to obtain multi-source processing results, wherein the multi-source processing results are used to determine the processing results sequentially generated by the initial query rewriting model in multiple query answering processing stages;
[0071] Step S2032: Determine multi-source feedback data based on the multi-source processing result.
[0072] The multiple query answer processing stages mentioned above may include, but are not limited to, a query rewriting stage, a rewriting recall stage, and a retrieval generation stage. In each of these query answer processing stages, the initial query rewriting model may sequentially generate processing results to meet the user's query requirements. The multi-source processing results mentioned above may include, but are not limited to, query rewriting results, rewriting recall results corresponding to the query rewriting results, and query answer results corresponding to the rewriting recall results.
[0073] In the query rewriting phase, natural language processing technology and semantic understanding algorithms can be used to perform semantic analysis and understanding on the initial query sample. This generates a rewritten query result that is similar in meaning to the initial query sample but more suitable for retrieval. In the rewriting recall phase, the rewritten query result can be applied to the information retrieval system. The rewritten query is used to search the index library to obtain documents related to the rewritten query and recall them to obtain the rewritten recall result. In the retrieval generation phase, the recall results obtained by the information retrieval system are used to rank and filter the documents to generate the final query response result, along with the corresponding relevant information and answers.
[0074] By using the target query sample to obtain multi-source processing results, more comprehensive and accurate data can be obtained. Determining multi-source feedback data through multi-source processing results can improve data quality and reliability and reduce errors and biases.
[0075] Based on the above optional embodiment, by using target query samples to obtain multi-source processing results and then determining multi-source feedback data based on the multi-source processing results, the accuracy of data analysis and decision-making can be further improved, thereby enhancing work efficiency and effectiveness. Furthermore, the multi-source feedback data can also be used to verify and calibrate the model, thereby improving the predictive power and applicability of the initial query rewriting model.
[0076] In an optional embodiment, in step S2032, multi-source feedback data is determined based on the multi-source processing results to include at least part of the following: in response to the multi-source processing results containing a query rewriting result, rewriting quality feedback data is determined based on the query rewriting result; in response to the multi-source processing results containing a rewriting recall result corresponding to the query rewriting result, retrieval quality feedback data is determined based on the rewriting recall result; in response to the multi-source processing results containing a query answer result corresponding to the rewriting recall result, question and answer quality feedback data is determined based on the query answer result.
[0077] If the multi-source processing results include query rewriting results, rewriting quality feedback data is determined based on the query rewriting results. The rewriting quality feedback data refers to the data in which the user evaluates the quality of the rewritten target query sample, including the user's evaluation of the target query sample's fluency, accuracy, grammar, and spelling.
[0078] Exemplarily, determining the rewriting quality feedback data based on the query rewriting results can be achieved by at least one of the following methods: manual evaluation, automatic evaluation, user feedback, and A / B testing. Among them, manual evaluation is to manually evaluate the query rewriting results, and score or provide feedback based on grammar, semantics, fluency and other aspects. Automatic evaluation is to use natural language processing technology to design evaluation indicators and models, automatically evaluate the query rewriting results, and generate quality feedback data. User feedback is to provide query rewriting results to users and collect user feedback and scores as feedback data on rewriting quality. A / B testing is to compare the effects of different rewriting versions, evaluate the rewriting quality through data indicators such as user click-through rate and conversion rate, and use them as feedback data. It should be noted that the above methods can be used in combination to obtain comprehensive rewriting quality feedback data, so as to continuously optimize the rewriting algorithm and improve the rewriting quality. The embodiment of this application only provides an example, but does not constitute a specific limitation.
[0079] If the multi-source processing result includes a rewritten recall result corresponding to the query rewriting result, the retrieval quality feedback data is determined based on the rewritten recall result. The retrieval quality feedback data refers to the data on the user's evaluation of the quality of the retrieval result, including the user's evaluation of the relevance, accuracy, completeness and other aspects of the retrieval result.
[0080] For example, in the process of determining retrieval quality feedback data based on rewritten recall results, the search engine can first collect user feedback data on search results by collecting user behaviors such as clicking, browsing, collecting, and sharing search results. This data can help determine which search results are more valuable to users and which search results need improvement. Furthermore, by analyzing the collected user feedback data, users' preferences and needs for search results can be determined. For example, the search results clicked by users can be analyzed to understand which results are more popular and indicators such as the length of time users stay, thereby determining the quality of the search results. Finally, based on the user feedback data and analysis results, the search engine can generate a feedback report to evaluate and organize the quality of the search results.
[0081] If the multi-source processing result includes the query answer result corresponding to the rewritten recall result, the question and answer quality feedback data is determined based on the query answer result. The question and answer quality feedback data refers to the data on the user's evaluation of the quality of the question and answer service, including the user's evaluation of the accuracy, clarity, practicality and other aspects of the answer.
[0082] For example, determining Q&A quality feedback data based on query answer results can be achieved through the following methods: user surveys, data analysis, expert evaluation, and automated evaluation. User surveys involve sending questionnaires or conducting user interviews to collect user satisfaction and feedback on the query answer results. By analyzing user feedback, we can understand user evaluations and suggestions on the quality of the query answer. Data analysis involves collecting user click behavior data, browsing time data, and other data to analyze user interest and satisfaction with the query answer. Combining user behavior data with the query answer results allows us to assess the quality of the Q&A and implement improvements. Expert evaluation involves inviting domain experts to evaluate the query answer results and provide feedback and suggestions from a professional perspective. Expert evaluation can help identify errors and shortcomings in the query answer and propose improvement solutions. Automated evaluation utilizes machine learning and natural language processing technologies to build models for automated evaluation of query answer results. Through model training, we can identify and evaluate metrics such as the accuracy, completeness, and credibility of the query answer. Combining these methods, we can collect and analyze user feedback and behavior data, as well as expert evaluations, to determine Q&A quality feedback data, providing effective reference and guidance for improving query answer quality.
[0083] In an optional embodiment, in step S204, updating the model parameters of the initial query rewriting model based on the multi-source feedback data to generate the target query rewriting model includes:
[0084] Step S2041, determining a target reward function based on multi-source feedback data through reinforcement learning;
[0085] Step S2042 : updating the model parameters of the initial query rewriting model based on the target reward function to generate a target query rewriting model.
[0086] This reinforcement learning approach can be RLHF, which incorporates human feedback into the reinforcement learning process, helping the initial query rewriting model to more quickly learn effective strategies. Humans can provide timely guidance on the learning process of the initial query rewriting model by providing rewards or penalties, thereby accelerating the learning process of the initial query rewriting model and achieving better performance in certain retrieval and generation tasks.
[0087] The target reward function described above is used in reinforcement learning to measure the performance of the initial query rewriting model. By evaluating the initial query rewriting model's behavior and the state of the environment, the target reward function provides corresponding rewards or penalties to the initial query rewriting model, encouraging it to adopt good behaviors and avoid bad ones. The target reward function is determined based on feedback data from multiple sources and can be designed and optimized using various methods and techniques to ensure that the initial query rewriting model maximizes its long-term returns.
[0088] For example, in the process of updating the model parameters of the initial query rewriting model based on the target reward function, a target reward function is first defined based on multi-source feedback data to measure whether the rewriting results generated by the initial query rewriting model meet expectations. The target reward function can be defined based on the specific requirements of the task, such as the relevance, fluency, and information content of the rewriting results. Based on the target reward function, a reinforcement learning algorithm can be used to update the model parameters of the initial query rewriting model. Specifically, an optimization algorithm such as gradient descent can be used to update the model parameters through the target reward function, so that the initial query rewriting model can generate query rewriting results that are more in line with expectations, thereby obtaining a trained target query rewriting model.
[0089] Based on the above optional embodiment, the model parameters of the initial query rewriting model can be updated based on the target reward function to generate a target query rewriting model, so as to better meet the needs of specific tasks and improve the effect and efficiency of query rewriting.
[0090] In an optional embodiment, in step S2041, determining the target reward function based on multi-source feedback data through reinforcement learning includes: determining the target reward based on multi-source feedback data through reinforcement learning; generating a target reward function based on the target reward and a target divergence, wherein the target divergence is the divergence between the initial query rewriting model and a preset reference model, and the preset reference model is a reward model obtained by fine-tuning the model parameters of the initial query rewriting model, or the preset reference model is a reward model trained based on preset preference data.
[0091] Specifically, the target reward is the final reward (Reward), using the final Reward and target divergence D KL Generate target reward function, target divergence D KL The divergence between the initial query rewriting model and the preset reference model. The preset reference model can be a language model (LM) that fine-tunes the model parameters of the initial query rewriting model, or a LM trained from scratch based on preset preference data.
[0092] In an optional embodiment, determining the target reward based on multi-source feedback data through reinforcement learning includes: determining a first reward value corresponding to the rewriting quality feedback data, a second reward value corresponding to the retrieval quality feedback data, and a third reward value corresponding to the question and answer quality feedback data through reinforcement learning, wherein the first reward value is used to evaluate the accuracy of the query rewriting result, the second reward value is used to evaluate the relevance of the rewriting recall result, and the third reward value is used to evaluate whether the query answer result is correct; determining the target reward based on the first reward value, the second reward value, and the third reward value.
[0093] Specifically, through reinforcement learning, the first reward value r corresponding to the rewriting quality feedback data is determined respectively. rewrite , the second reward value r corresponding to the retrieval quality feedback data retrieve , and the third reward value r corresponding to the question-answering quality feedback data answer .
[0094] The first reward value r rewrite The accuracy of the query rewriting results can be directly evaluated. For example, if the query information is correctly completed, positive feedback will be obtained. rewrite >0; if wrong information is introduced or information is omitted, negative feedback r will be obtained rewrite <0.
[0095] The second reward value r retrieve The relevance of the rewritten recall result can be evaluated. For example, if relevant documents are recalled, then positive feedback r is obtained. retrieve >0; if irrelevant documents are recalled, negative feedback r will be obtained retrieve <0.
[0096] The third reward value r answer It is possible to evaluate whether the LLM correctly answers the user's query. For example, if the answer is correct, then positive feedback r will be obtained. answer >0; if the answer is wrong, you will get negative feedback r answer <0.
[0097] Based on the first reward value r rewrite , the second reward value r retrieve and the third reward value r answer Determine the final Reward, which is defined as:
[0098] r=r rewrite +r retrieve +r answer
[0099] In an optional embodiment, generating a target reward function based on the target reward and the target divergence includes: obtaining an average expected value of the target reward and a product result between the target divergence and a preset hyperparameter; and generating the target reward function based on the average expected value and the product result.
[0100] Specifically, through RLHF, the objective reward function of the multi-round query rewriting model is defined as:
[0101] argmaxE[r]-βD KL
[0102] Where E(r) is the average expected value of the target reward, and β is the preset hyperparameter.
[0103] Figure 3 is a schematic diagram of a query processing method according to Example 1 of the present application, such as Figure 3 As shown, the initial query request and the historical conversation record associated with the initial query request are obtained, wherein the current question input by the user in the initial query request is "What about service B?", and the user asks in the historical conversation record "How to purchase service A and what are its advantages?", and the service provider responds with "The steps to purchase service A are as follows: 1, ...; 2, ...; the advantages of service A include: ......"
[0104] A target query rewriting model is used to rewrite and analyze the initial query request and historical conversation records, rewriting the initial query request into a target query request. The target query rewriting model is trained based on multi-source feedback data, which consists of various types of query quality assessment data acquired during the training process. This multi-source feedback data includes rewriting quality feedback, retrieval quality feedback, and question-and-answer quality feedback. After decomposing the initial query intent, it can be split into "How to purchase Service B" and "What are the advantages of Service B?" Based on the target query request, a target query answer is generated: "The steps to purchase Service B are as follows: 1. ...; 2. ...; The advantages of Service B include: ...."
[0105] In this embodiment, a multi-source feedback strategy is used to expand the training dataset for multi-round query rewriting. Leveraging retrieval quality feedback and question-answer quality feedback, the multi-round query rewriting module can receive feedback signals from the backend, thereby generating more accurate rewriting results. Furthermore, through system click logs, large-scale retrieval quality feedback data and question-answer quality feedback data are collected, effectively reducing the cost of manual annotation.
[0106] It should be noted that 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 relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0107] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0109] Example 2
[0110] According to an embodiment of the present application, a query processing method is also provided. Figure 4 This is a flow chart of a query processing method according to Example 2 of the present application. Figure 4 As shown, the method may include the following steps:
[0111] Step S41, obtaining an initial query sample and a sample conversation record corresponding to the initial query sample;
[0112] Step S42: Using the initial query rewriting model, rewriting and analyzing the initial query sample and the sample conversation record, and rewriting the initial query sample into a target query sample;
[0113] Step S43: using the target query sample to obtain multi-source feedback data, wherein the multi-source feedback data is various types of query quality assessment data obtained during the process of training the initial query rewriting model;
[0114] In step S44, the model parameters of the initial query rewriting model are updated based on the multi-source feedback data to generate a target query rewriting model, wherein the target query rewriting model is used to rewrite and analyze the initial query request and the historical conversation records associated with the initial query request, and rewrite the initial query request into a target query request to generate a target query answer.
[0115] Based on the above steps S41 to S44, by obtaining the initial query sample and the sample conversation record corresponding to the initial query sample, the initial query sample and the sample conversation record are rewritten and analyzed using the initial query rewriting model, and the initial query sample is rewritten into a target query sample. Subsequently, the target query sample is used to obtain multi-source feedback data, and finally, the model parameters of the initial query rewriting model are updated based on the multi-source feedback data to generate a target query rewriting model, thereby achieving the purpose of quickly generating the target query rewriting model, thereby achieving the technical effect of reducing the manual labeling cost and improving the retrieval generation effect, and thus solving the technical problem of high manual labeling cost and poor retrieval generation effect in the related technology of rewriting user query requests in the process of retrieval enhancement generation.
[0116] For the parts not described in detail in the above embodiments of the present application, please refer to the relevant description of Example 1 and will not be repeated here.
[0117] Example 3
[0118] According to an embodiment of the present application, a query processing method is also provided. Figure 5 This is a flow chart of a query processing method according to Example 3 of the present application. Figure 5 As shown, the method may include the following steps:
[0119] Step S51, obtaining an initial query request through a first application programming interface;
[0120] Step S52: Return the target query response through the second application programming interface; wherein the response data carried in the target query response includes: query answer content, the query answer content is generated based on the target query request, the target query request is obtained by rewriting and analyzing the initial query request and the historical conversation records associated with the initial query request using the target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process.
[0121] Based on the above steps S51 to S52, the initial query request is obtained through the first application programming interface, and the target query response is returned through the second application programming interface, so as to achieve the purpose of accurately obtaining the query result corresponding to the initial query request, thereby realizing the technical effect of reducing the manual annotation cost and improving the retrieval generation effect, and further solving the technical problem of high manual annotation cost and poor retrieval generation effect of the related technology in the process of retrieval enhancement generation when rewriting the user query request.
[0122] For the parts not described in detail in the above embodiments of the present application, please refer to the relevant description of Example 1 and will not be repeated here.
[0123] Example 4
[0124] According to an embodiment of the present application, a query processing method is also provided. Figure 6 This is a flow chart of a query processing method according to Example 4 of the present application. Figure 6 As shown, the method may include the following steps:
[0125] Step S61, obtaining the currently input query dialogue request;
[0126] Step S62: Returning a query dialogue reply in response to the query dialogue request, wherein the query dialogue reply carries information including query answer content, the query answer content being generated based on the target query request, the target query request being obtained by rewriting and analyzing the query dialogue request and historical dialogue records associated with the query dialogue request using a target query rewriting model, the target query rewriting model being trained based on multi-source feedback data, the multi-source feedback data being various types of query quality assessment data acquired during the training process of the target query rewriting model;
[0127] Step S63: Display the query answer content in the graphical user interface.
[0128] Based on the above steps S61 to S63, by obtaining the currently input query dialogue request, responding to the query dialogue request, returning the query dialogue reply, and finally displaying the query answer content in the graphical user interface, the purpose of accurately obtaining the query result corresponding to the initial query request is achieved, thereby achieving the technical effect of reducing manual annotation costs and improving retrieval generation effects, and thus solving the technical problems of high manual annotation costs and poor retrieval generation effects in related technologies when rewriting user query requests in the process of retrieval enhancement generation.
[0129] For the parts not described in detail in the above embodiments of the present application, please refer to the relevant description of Example 1 and will not be repeated here.
[0130] Example 5
[0131] According to an embodiment of the present application, a query processing device for implementing the above query processing method is also provided. Figure 7 is a structural block diagram of a query processing device according to embodiment 5 of the present application, such as Figure 7 As shown, the device includes:
[0132] An acquisition module 701 is configured to acquire an initial query request and historical conversation records associated with the initial query request;
[0133] Processing module 702 is configured to perform rewriting analysis on the initial query request and historical conversation records using a target query rewriting model to rewrite the initial query request into a target query request. The target query rewriting model is trained based on multi-source feedback data, which is various types of query quality assessment data obtained during the target query rewriting model training process.
[0134] The generating module 703 is configured to generate a target query answer based on the target query request.
[0135] Optionally, the acquisition module 701 is also used to obtain the initial query sample and the sample conversation record corresponding to the initial query sample; the processing module 702 is also used to use the initial query rewriting model to rewrite the initial query sample and the sample conversation record, and rewrite the initial query sample into a target query sample; the acquisition module 701 is also used to use the target query sample to obtain multi-source feedback data; the generation module 703 is also used to update the model parameters of the initial query rewriting model based on the multi-source feedback data, and generate a target query rewriting model.
[0136] Optionally, the processing module 702 is also used to: in the initial query rewriting model, perform intent decomposition on the initial query sample based on the sample conversation record; in the initial query rewriting model, perform reference resolution on the initial query sample based on the sample conversation record; in the initial query rewriting model, perform omission completion on the initial query sample based on the sample conversation record.
[0137] Optionally, the acquisition module 701 is also used to: obtain multi-source processing results using the target query sample, wherein the multi-source processing results are used to determine the processing results generated in sequence by the initial query rewriting model in multiple query answer processing links; and determine multi-source feedback data based on the multi-source processing results.
[0138] Optionally, the acquisition module 701 is also used to: in response to the multi-source processing results containing a query rewriting result, determine rewriting quality feedback data based on the query rewriting result; in response to the multi-source processing results containing a rewriting recall result corresponding to the query rewriting result, determine retrieval quality feedback data based on the rewriting recall result; in response to the multi-source processing results containing a query answer result corresponding to the rewriting recall result, determine question and answer quality feedback data based on the query answer result.
[0139] Optionally, the generation module 703 is further configured to: determine a target reward function based on multi-source feedback data by reinforcement learning; and update model parameters of the initial query rewriting model based on the target reward function to generate a target query rewriting model.
[0140] Optionally, the generation module 703 is also used to: determine the target reward based on multi-source feedback data through reinforcement learning; generate a target reward function based on the target reward and the target divergence, wherein the target divergence is the divergence between the initial query rewriting model and the preset reference model, and the preset reference model is a reward model obtained by fine-tuning the model parameters of the initial query rewriting model, or the preset reference model is a reward model obtained by training based on preset preference data.
[0141] Optionally, the generation module 703 is also used to: determine, through reinforcement learning, a first reward value corresponding to the rewriting quality feedback data, a second reward value corresponding to the retrieval quality feedback data, and a third reward value corresponding to the question and answer quality feedback data, wherein the first reward value is used to evaluate the accuracy of the query rewriting result, the second reward value is used to evaluate the relevance of the rewriting recall result, and the third reward value is used to evaluate whether the query answer result is correct; and determine the target reward based on the first reward value, the second reward value and the third reward value.
[0142] Optionally, the generation module 703 is further configured to: obtain an average expected value of the target reward and a product result between the target divergence and a preset hyperparameter; and generate a target reward function based on the average expected value and the product result.
[0143] It should be noted that the acquisition module 701, processing module 702, and generation module 703 correspond to steps S21 to S23 in Example 1. The examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 1. It should be noted that the modules or units can be hardware components or software components stored in a memory and processed by one or more processors. The modules can also be part of the device and can be run in a provided computer terminal.
[0144] In an embodiment of the present application, by obtaining an initial query request and historical conversation records associated with the initial query request, and then using a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, the initial query request is rewritten into a target query request, and finally a target query answer is generated based on the target query request, thereby achieving the purpose of accurately obtaining the query result corresponding to the initial query request, thereby achieving the technical effect of reducing manual annotation costs and improving retrieval generation effects, and thus solving the technical problems of high manual annotation costs and poor retrieval generation effects in related technologies for rewriting user query requests in the process of retrieval enhancement generation.
[0145] According to an embodiment of the present application, a query processing device for implementing the above query processing method is also provided. Figure 8 is a structural block diagram of another query processing device according to embodiment 5 of the present application, such as Figure 8 As shown, the device includes:
[0146] The first acquisition module 801 is used to obtain an initial query sample and a sample conversation record corresponding to the initial query sample;
[0147] Processing module 802, configured to perform rewriting analysis on the initial query sample and the sample conversation record using the initial query rewriting model, and rewrite the initial query sample into a target query sample;
[0148] The second acquisition module 803 is configured to acquire multi-source feedback data using the target query sample, wherein the multi-source feedback data is multiple types of query quality assessment data acquired during the model training of the initial query rewriting model;
[0149] Generation module 804 is used to update the model parameters of the initial query rewriting model based on multi-source feedback data to generate a target query rewriting model, wherein the target query rewriting model is used to rewrite the initial query request and the historical conversation records associated with the initial query request, rewrite the initial query request into a target query request, and generate a target query answer.
[0150] It should be noted that the first acquisition module 801, processing module 802, second acquisition module 803, and generation module 804 described above correspond to steps S41 to S44 in Example 2. The examples and application scenarios implemented by the four modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 2. It should be noted that the above modules or units can be hardware components or software components stored in a memory and processed by one or more processors. The above modules can also be run in a provided computer terminal as part of the device.
[0151] In an embodiment of the present application, an initial query sample and a sample conversation record corresponding to the initial query sample are obtained, and then an initial query rewriting model is used to rewrite and analyze the initial query sample and the sample conversation record, and the initial query sample is rewritten into a target query sample. Subsequently, the target query sample is used to obtain multi-source feedback data, and finally, the model parameters of the initial query rewriting model are updated based on the multi-source feedback data to generate a target query rewriting model, thereby achieving the purpose of quickly generating a target query rewriting model, thereby achieving the technical effect of reducing manual labeling costs and improving retrieval generation effects, and thus solving the technical problems of high manual labeling costs and poor retrieval generation effects in related technologies for rewriting user query requests in the process of retrieval enhancement generation.
[0152] According to an embodiment of the present application, a query processing device for implementing the above query processing method is also provided. Figure 9 is a structural block diagram of another query processing device according to embodiment 5 of the present application, such as Figure 9 As shown, the device includes:
[0153] An acquisition module 901 is configured to acquire an initial query request through a first application programming interface;
[0154] A returning module 902 is configured to return a target query response via a second application programming interface;
[0155] Among them, the response data carried in the target query response includes: query answer content, which is generated based on the target query request. The target query request is obtained by rewriting and analyzing the initial query request and the historical conversation records associated with the initial query request using the target query rewriting model. The target query rewriting model is trained based on multi-source feedback data. The multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process.
[0156] It should be noted that the acquisition module 901 and the return module 902 correspond to steps S51 to S52 in Example 3. The examples and application scenarios implemented by the two modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned Example 3. It should be noted that the above-mentioned modules or units can be hardware components or software components stored in a memory and processed by one or more processors. The above-mentioned modules can also be run in a provided computer terminal as part of the device.
[0157] In an embodiment of the present application, an initial query request is obtained through a first application programming interface, and a target query response is returned through a second application programming interface, thereby achieving the purpose of accurately obtaining the query result corresponding to the initial query request, thereby realizing the technical effect of reducing manual annotation costs and improving retrieval generation effects, and further solving the technical problems of high manual annotation costs and poor retrieval generation effects in related technologies for rewriting user query requests during retrieval enhancement generation.
[0158] According to an embodiment of the present application, a query processing device for implementing the above query processing method is also provided. Figure 10 is a structural block diagram of another query processing device according to embodiment 5 of the present application, such as Figure 10 As shown, the device includes:
[0159] The acquisition module 1001 is used to acquire the query dialogue request currently input;
[0160] Return module 1002 is configured to return a query dialogue reply in response to the query dialogue request, wherein the query dialogue reply carries information including query answer content, the query answer content being generated based on a target query request, the target query request being obtained by rewriting and analyzing the query dialogue request and historical dialogue records associated with the query dialogue request using a target query rewriting model, the target query rewriting model being trained based on multi-source feedback data, the multi-source feedback data being various types of query quality assessment data acquired during the training process of the target query rewriting model;
[0161] The display module 1003 is used to display the query answer content in the graphical user interface.
[0162] It should be noted that the acquisition module 1001, return module 1002, and display module 1003 correspond to steps S61 to S63 in Example 4. The examples and application scenarios implemented by the three modules and the corresponding steps are the same, but are not limited to the contents disclosed in Example 4. It should be noted that the modules or units can be hardware components or software components stored in a memory and processed by one or more processors. The modules can also be part of the device and can be run in a provided computer terminal.
[0163] In an embodiment of the present application, by obtaining the currently input query dialogue request, responding to the query dialogue request, returning the query dialogue reply, and finally displaying the query answer content in the graphical user interface, the purpose of accurately obtaining the query result corresponding to the initial query request is achieved, thereby achieving the technical effect of reducing manual annotation costs and improving retrieval generation effects, and thus solving the technical problems of high manual annotation costs and poor retrieval generation effects in related technologies for rewriting user query requests during retrieval enhancement generation.
[0164] It should be noted that the preferred implementation scheme involved in the above embodiments of this application is the same as the scheme provided in Example 1, as well as the application scenario and implementation process, but is not limited to the scheme provided in Example 1.
[0165] Example 6
[0166] The embodiment of the present application can provide a computer terminal, which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal can also be replaced by a terminal device such as a mobile terminal.
[0167] Optionally, in this embodiment, the computer terminal may be located in at least one network device among a plurality of network devices of a computer network.
[0168] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the query processing method: obtaining an initial query request and historical conversation records associated with the initial query request; using a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, and rewrite the initial query request into a target query request, wherein the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process; generating a target query answer based on the target query request.
[0169] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the query processing method: obtaining an initial query sample and a sample conversation record corresponding to the initial query sample; using an initial query rewriting model to rewrite and analyze the initial query sample and the sample conversation record, and rewrite the initial query sample into a target query sample; using the target query sample to obtain multi-source feedback data, wherein the multi-source feedback data is multiple types of query quality assessment data obtained in the process of training the initial query rewriting model; updating the model parameters of the initial query rewriting model based on the multi-source feedback data, and generating a target query rewriting model, wherein the target query rewriting model is used to rewrite and analyze the initial query request and the historical conversation record associated with the initial query request, and rewrite the initial query request into a target query request to generate a target query answer.
[0170] In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the query processing method: obtaining an initial query request through a first application programming interface; returning a target query response through a second application programming interface; wherein the response data carried in the target query response includes: query answer content, the query answer content is generated based on the target query request, the target query request is obtained by rewriting and analyzing the initial query request and the historical conversation records associated with the initial query request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is multiple types of query quality assessment data obtained by the target query rewriting model during the model training process.
[0171] In this embodiment, the computer terminal may execute program code for the following steps in the query processing method: obtaining a currently input query dialogue request; returning a query dialogue reply in response to the query dialogue request, wherein the information carried in the query dialogue reply includes query answer content, the query answer content being generated based on a target query request, the target query request being obtained by rewriting and analyzing the query dialogue request and historical dialogue records associated with the query dialogue request using a target query rewriting model, the target query rewriting model being trained based on multi-source feedback data, the multi-source feedback data being multiple types of query quality assessment data obtained by the target query rewriting model during the model training process; and displaying the query answer content in a graphical user interface.
[0172] Optionally, Figure 11 The following is a block diagram of a computer terminal according to an embodiment of the present application. As shown in the figure, the computer terminal may include: one or more (only one is shown in the figure) processors 112, a memory 114, a storage controller, and a peripheral interface, wherein the peripheral interface is connected to a radio frequency module, an audio module, and a display.
[0173] Among them, the memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the query processing method and device in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned query processing method. The memory may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories can be connected to the computer terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0174] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: obtain an initial query request and historical conversation records associated with the initial query request; use a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, and rewrite the initial query request into a target query request, wherein the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process; generate a target query answer based on the target query request.
[0175] Optionally, the processor may also execute the program code for the following steps: obtaining an initial query sample and a sample conversation record corresponding to the initial query sample; performing rewriting analysis on the initial query sample and the sample conversation record using an initial query rewriting model, and rewriting the initial query sample into a target query sample; obtaining multi-source feedback data using the target query sample; and updating the model parameters of the initial query rewriting model based on the multi-source feedback data to generate a target query rewriting model.
[0176] Optionally, the processor may also execute the program code of the following steps: in the initial query rewriting model, performing intent decomposition on the initial query sample based on the sample conversation record; in the initial query rewriting model, performing reference resolution on the initial query sample based on the sample conversation record; in the initial query rewriting model, performing omission completion on the initial query sample based on the sample conversation record.
[0177] Optionally, the processor may also execute the program code of the following steps: obtaining multi-source processing results using the target query sample, wherein the multi-source processing results are used to determine the processing results generated sequentially by the initial query rewriting model in multiple query answer processing links; and determining multi-source feedback data based on the multi-source processing results.
[0178] Optionally, the processor may also execute the program code for the following steps: in response to the multi-source processing results including a query rewriting result, determining rewriting quality feedback data based on the query rewriting result; in response to the multi-source processing results including a rewriting recall result corresponding to the query rewriting result, determining retrieval quality feedback data based on the rewriting recall result; in response to the multi-source processing results including a query answer result corresponding to the rewriting recall result, determining question and answer quality feedback data based on the query answer result.
[0179] Optionally, the processor may also execute the program code of the following steps: determining a target reward function based on multi-source feedback data through reinforcement learning; updating the model parameters of the initial query rewriting model based on the target reward function to generate a target query rewriting model.
[0180] Optionally, the processor may also execute the program code of the following steps: determining the target reward based on multi-source feedback data through reinforcement learning; generating a target reward function based on the target reward and the target divergence, wherein the target divergence is the divergence between the initial query rewriting model and the preset reference model, and the preset reference model is a reward model obtained by fine-tuning the model parameters of the initial query rewriting model, or the preset reference model is a reward model obtained by training based on preset preference data.
[0181] Optionally, the processor may also execute the program code of the following steps: determining, by reinforcement learning, a first reward value corresponding to the rewriting quality feedback data, a second reward value corresponding to the retrieval quality feedback data, and a third reward value corresponding to the question and answer quality feedback data, wherein the first reward value is used to evaluate the accuracy of the query rewriting result, the second reward value is used to evaluate the relevance of the rewriting recall result, and the third reward value is used to evaluate whether the query answer result is correct; and determining the target reward based on the first reward value, the second reward value, and the third reward value.
[0182] Optionally, the processor may further execute program code of the following steps: obtaining an average expected value of the target reward and a product result between the target divergence and a preset hyperparameter; and generating a target reward function based on the average expected value and the product result.
[0183] Optionally, the processor may also execute program code for the following steps: obtaining an initial query sample and a sample conversation record corresponding to the initial query sample; performing a rewriting analysis on the initial query sample and the sample conversation record using an initial query rewriting model, and rewriting the initial query sample into a target query sample; obtaining multi-source feedback data using the target query sample, wherein the multi-source feedback data is multiple types of query quality assessment data obtained during model training of the initial query rewriting model; updating the model parameters of the initial query rewriting model based on the multi-source feedback data, and generating a target query rewriting model, wherein the target query rewriting model is used to rewrite and analyze the initial query request and the historical conversation record associated with the initial query request, and rewrite the initial query request into a target query request to generate a target query answer.
[0184] Optionally, the processor may also execute the program code of the following steps: obtaining an initial query request through a first application programming interface; returning a target query response through a second application programming interface; wherein the response data carried in the target query response includes: query answer content, the query answer content is generated based on the target query request, the target query request is obtained by rewriting and analyzing the initial query request and the historical conversation records associated with the initial query request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process.
[0185] Optionally, the processor may also execute program code for the following steps: obtaining a currently input query dialogue request; returning a query dialogue reply in response to the query dialogue request, wherein the information carried in the query dialogue reply includes: query answer content, the query answer content is generated based on a target query request, the target query request is obtained by rewriting and analyzing the query dialogue request and historical dialogue records associated with the query dialogue request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is multiple types of query quality assessment data obtained by the target query rewriting model during the model training process; and displaying the query answer content in a graphical user interface.
[0186] By adopting the embodiment of the present application, by obtaining the initial query request and the historical conversation records associated with the initial query request, and then using the target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, the initial query request is rewritten into a target query request, and finally a target query answer is generated based on the target query request, thereby achieving the purpose of accurately obtaining the query result corresponding to the initial query request, thereby achieving the technical effect of reducing the manual annotation cost and improving the retrieval generation effect, and thus solving the technical problem of high manual annotation cost and poor retrieval generation effect in the related technology of rewriting user query requests in the process of retrieval enhancement generation.
[0187] Those skilled in the art will appreciate that the structure shown in the figure is for illustration only, and the computer terminal may also be a smart phone (such as an Android phone, iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, or other terminal devices. Figure 11 It does not limit the structure of the above electronic device. For example, the computer terminal may also include Figure 11 More or fewer components (such as network interfaces, display devices, etc.) shown in, or with Figure 11 Different configurations shown.
[0188] A person skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0189] Example 7
[0190] The embodiment of the present application further provides a computer-readable storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the query processing method provided in the first embodiment.
[0191] Optionally, in this embodiment, the storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0192] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining an initial query request and historical conversation records associated with the initial query request; using a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, and rewrite the initial query request into a target query request, wherein the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process; and generating a target query answer based on the target query request.
[0193] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining an initial query sample and a sample conversation record corresponding to the initial query sample; using an initial query rewriting model to rewrite and analyze the initial query sample and the sample conversation record, and rewrite the initial query sample into a target query sample; using the target query sample to obtain multi-source feedback data; updating the model parameters of the initial query rewriting model based on the multi-source feedback data to generate a target query rewriting model.
[0194] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: in the initial query rewriting model, performing intent decomposition on the initial query sample based on the sample conversation record; in the initial query rewriting model, performing reference resolution on the initial query sample based on the sample conversation record; in the initial query rewriting model, performing omission completion on the initial query sample based on the sample conversation record.
[0195] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining multi-source processing results using a target query sample, wherein the multi-source processing results are used to determine the processing results generated sequentially by the initial query rewriting model in multiple query answer processing links; and determining multi-source feedback data based on the multi-source processing results.
[0196] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: in response to the multi-source processing results containing a query rewriting result, determining rewriting quality feedback data based on the query rewriting result; in response to the multi-source processing results containing a rewriting recall result corresponding to the query rewriting result, determining retrieval quality feedback data based on the rewriting recall result; in response to the multi-source processing results containing a query answer result corresponding to the rewriting recall result, determining question and answer quality feedback data based on the query answer result.
[0197] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: determining a target reward function based on multi-source feedback data through reinforcement learning; updating model parameters of the initial query rewriting model based on the target reward function to generate a target query rewriting model.
[0198] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: determining a target reward based on multi-source feedback data through reinforcement learning; generating a target reward function based on the target reward and a target divergence, wherein the target divergence is the divergence between the initial query rewriting model and a preset reference model, and the preset reference model is a reward model obtained by fine-tuning the model parameters of the initial query rewriting model, or the preset reference model is a reward model trained based on preset preference data.
[0199] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: determining, by reinforcement learning, a first reward value corresponding to the rewriting quality feedback data, a second reward value corresponding to the retrieval quality feedback data, and a third reward value corresponding to the question and answer quality feedback data, respectively, wherein the first reward value is used to evaluate the accuracy of the query rewriting result, the second reward value is used to evaluate the relevance of the rewriting recall result, and the third reward value is used to evaluate whether the query answer result is correct; determining the target reward based on the first reward value, the second reward value and the third reward value.
[0200] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining an average expected value of the target reward and a product result between the target divergence and a preset hyperparameter; and generating a target reward function based on the average expected value and the product result.
[0201] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining an initial query sample and a sample conversation record corresponding to the initial query sample; using an initial query rewriting model to rewrite and analyze the initial query sample and the sample conversation record, and rewrite the initial query sample into a target query sample; using the target query sample to obtain multi-source feedback data, wherein the multi-source feedback data is multiple types of query quality assessment data obtained in the process of training the initial query rewriting model; updating the model parameters of the initial query rewriting model based on the multi-source feedback data, and generating a target query rewriting model, wherein the target query rewriting model is used to rewrite and analyze the initial query request and the historical conversation record associated with the initial query request, and rewrite the initial query request into a target query request to generate a target query answer.
[0202] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining an initial query request through a first application programming interface; returning a target query response through a second application programming interface; wherein the response data carried in the target query response includes: query answer content, the query answer content is generated based on the target query request, the target query request is obtained by rewriting and analyzing the initial query request and the historical conversation records associated with the initial query request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process.
[0203] Optionally, in this embodiment, the storage medium is configured to store program code for executing the following steps: obtaining a currently input query dialogue request; returning a query dialogue reply in response to the query dialogue request, wherein the information carried in the query dialogue reply includes: query answer content, the query answer content is generated based on a target query request, the target query request is obtained by rewriting and analyzing the query dialogue request and historical dialogue records associated with the query dialogue request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is multiple types of query quality assessment data obtained by the target query rewriting model during the model training process; and displaying the query answer content in a graphical user interface.
[0204] In an embodiment of the present application, by obtaining an initial query request and historical conversation records associated with the initial query request, and then using a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, the initial query request is rewritten into a target query request, and finally a target query answer is generated based on the target query request, thereby achieving the purpose of accurately obtaining the query result corresponding to the initial query request, thereby achieving the technical effect of reducing manual annotation costs and improving retrieval generation effects, and thus solving the technical problems of high manual annotation costs and poor retrieval generation effects in related technologies for rewriting user query requests in the process of retrieval enhancement generation.
[0205] Example 8
[0206] The embodiment of the present application further provides a computer program product. Optionally, in this embodiment, the computer program product may include a computer program, and when the computer program is executed by a processor, the method provided in the embodiment is implemented.
[0207] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: obtain an initial query request and historical conversation records associated with the initial query request; use a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, and rewrite the initial query request into a target query request, wherein the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process; generate a target query answer based on the target query request.
[0208] Optionally, the computer program included in the above-mentioned computer program product is used by a processor to execute the following steps: obtain an initial query sample and a sample conversation record corresponding to the initial query sample; use an initial query rewriting model to rewrite and analyze the initial query sample and the sample conversation record, and rewrite the initial query sample into a target query sample; use the target query sample to obtain multi-source feedback data; update the model parameters of the initial query rewriting model based on the multi-source feedback data to generate a target query rewriting model.
[0209] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: in the initial query rewriting model, the initial query sample is subjected to intention decomposition based on the sample conversation record; in the initial query rewriting model, the initial query sample is subjected to reference resolution based on the sample conversation record; in the initial query rewriting model, the initial query sample is subjected to omission completion based on the sample conversation record.
[0210] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: obtain multi-source processing results using the target query sample, wherein the multi-source processing results are used to determine the processing results generated in sequence by the initial query rewriting model in multiple query answer processing links; and determine multi-source feedback data based on the multi-source processing results.
[0211] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: in response to the multi-source processing results containing a query rewriting result, determining rewriting quality feedback data based on the query rewriting result; in response to the multi-source processing results containing a rewriting recall result corresponding to the query rewriting result, determining retrieval quality feedback data based on the rewriting recall result; in response to the multi-source processing results containing a query answer result corresponding to the rewriting recall result, determining question and answer quality feedback data based on the query answer result.
[0212] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: determining a target reward function based on multi-source feedback data through reinforcement learning; updating model parameters of the initial query rewriting model based on the target reward function to generate a target query rewriting model.
[0213] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: determining the target reward based on multi-source feedback data through reinforcement learning; generating a target reward function based on the target reward and the target divergence, wherein the target divergence is the divergence between the initial query rewriting model and the preset reference model, and the preset reference model is a reward model obtained by fine-tuning the model parameters of the initial query rewriting model, or the preset reference model is a reward model obtained by training based on preset preference data.
[0214] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: through reinforcement learning, determine the first reward value corresponding to the rewriting quality feedback data, the second reward value corresponding to the retrieval quality feedback data, and the third reward value corresponding to the question and answer quality feedback data, wherein the first reward value is used to evaluate the accuracy of the query rewriting result, the second reward value is used to evaluate the relevance of the rewriting recall result, and the third reward value is used to evaluate whether the query answer result is correct; determine the target reward based on the first reward value, the second reward value and the third reward value.
[0215] Optionally, the computer program included in the above-mentioned computer program product is used by a processor to execute the following steps: obtaining an average expected value of the target reward and a product result between the target divergence and a preset hyperparameter; and generating a target reward function based on the average expected value and the product result.
[0216] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: obtain an initial query sample and a sample conversation record corresponding to the initial query sample; use the initial query rewriting model to rewrite and analyze the initial query sample and the sample conversation record, and rewrite the initial query sample into a target query sample; use the target query sample to obtain multi-source feedback data, wherein the multi-source feedback data is multiple types of query quality assessment data obtained in the process of training the initial query rewriting model; update the model parameters of the initial query rewriting model based on the multi-source feedback data, and generate a target query rewriting model, wherein the target query rewriting model is used to rewrite and analyze the initial query request and the historical conversation record associated with the initial query request, and rewrite the initial query request into a target query request to generate a target query answer.
[0217] Optionally, the computer program included in the above-mentioned computer program product is used by the processor to execute the following steps: obtain an initial query request through a first application programming interface; return a target query response through a second application programming interface; wherein the response data carried in the target query response includes: query answer content, the query answer content is generated based on the target query request, the target query request is obtained by rewriting and analyzing the initial query request and the historical conversation records associated with the initial query request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process.
[0218] Optionally, the computer program included in the above-mentioned computer program product is used by a processor to execute the following steps: obtaining a currently input query dialogue request; returning a query dialogue reply in response to the query dialogue request, wherein the information carried in the query dialogue reply includes: query answer content, the query answer content is generated based on a target query request, the target query request is obtained by rewriting and analyzing the query dialogue request and historical dialogue records associated with the query dialogue request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is multiple types of query quality assessment data obtained by the target query rewriting model during the model training process; and displaying the query answer content in a graphical user interface.
[0219] In an embodiment of the present application, by obtaining an initial query request and historical conversation records associated with the initial query request, and then using a target query rewriting model to rewrite and analyze the initial query request and the historical conversation records, the initial query request is rewritten into a target query request, and finally a target query answer is generated based on the target query request, thereby achieving the purpose of accurately obtaining the query result corresponding to the initial query request, thereby achieving the technical effect of reducing manual annotation costs and improving retrieval generation effects, and thus solving the technical problems of high manual annotation costs and poor retrieval generation effects in related technologies for rewriting user query requests in the process of retrieval enhancement generation.
[0220] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0221] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0222] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0223] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0224] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0225] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0226] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A query processing method, characterized in that: include: Obtaining an initial query request and historical conversation records associated with the initial query request; A target query rewriting model is used to rewrite and analyze the initial query request and the historical conversation record, and rewrite the initial query request into a target query request, wherein the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is multiple types of query quality assessment data obtained by the target query rewriting model during the model training process; A target query answer is generated based on the target query request.
2. The query processing method according to claim 1, characterized in that: The query processing method further includes: Obtaining an initial query sample and a sample conversation record corresponding to the initial query sample; Using an initial query rewriting model to perform rewriting analysis on the initial query sample and the sample conversation record, and rewriting the initial query sample into a target query sample; Acquiring the multi-source feedback data using the target query sample; The model parameters of the initial query rewriting model are updated based on the multi-source feedback data to generate the target query rewriting model.
3. The query processing method according to claim 2, wherein: Performing rewriting analysis on the initial query sample and the sample conversation record using the initial query rewriting model includes at least one of the following: In the initial query rewriting model, performing intent decomposition on the initial query sample based on the sample conversation record; In the initial query rewriting model, performing reference resolution on the initial query sample based on the sample conversation record; In the initial query rewriting model, the initial query sample is omitted and completed based on the sample conversation record.
4. The query processing method according to claim 2, wherein: Acquiring the multi-source feedback data using the target query sample includes: Obtaining multi-source processing results using the target query sample, wherein the multi-source processing results are used to determine processing results sequentially generated by the initial query rewriting model in multiple query answering processing links; The multi-source feedback data is determined based on the multi-source processing result.
5. The query processing method according to claim 4, characterized in that: Determining the multi-source feedback data based on the multi-source processing result includes at least part of the following: In response to the multi-source processing result including a query rewriting result, determining rewriting quality feedback data based on the query rewriting result; In response to the multi-source processing result including a rewritten recall result corresponding to the query rewriting result, determining retrieval quality feedback data based on the rewritten recall result; In response to the multi-source processing result including a query answer result corresponding to the rewritten recall result, question and answer quality feedback data is determined based on the query answer result.
6. The query processing method according to claim 5, characterized in that: Updating the model parameters of the initial query rewriting model based on the multi-source feedback data to generate the target query rewriting model includes: Determining a target reward function based on the multi-source feedback data by reinforcement learning; The model parameters of the initial query rewriting model are updated based on the target reward function to generate the target query rewriting model.
7. The query processing method according to claim 6, characterized in that: Determining the target reward function according to the multi-source feedback data through the reinforcement learning method includes: Determining a target reward based on the multi-source feedback data using the reinforcement learning method; The target reward function is generated based on the target reward and the target divergence, wherein the target divergence is the divergence between the initial query rewriting model and a preset reference model, and the preset reference model is a reward model obtained by fine-tuning the model parameters of the initial query rewriting model, or the preset reference model is a reward model obtained by training based on preset preference data.
8. The query processing method according to claim 7, characterized in that: Determining the target reward according to the multi-source feedback data through the reinforcement learning method includes: Determining, by the reinforcement learning method, a first reward value corresponding to the rewriting quality feedback data, a second reward value corresponding to the retrieval quality feedback data, and a third reward value corresponding to the question-answer quality feedback data, respectively, wherein the first reward value is used to evaluate the accuracy of the query rewriting result, the second reward value is used to evaluate the relevance of the rewriting recall result, and the third reward value is used to evaluate whether the query answer result is correct; The target reward is determined based on the first reward value, the second reward value, and the third reward value.
9. The query processing method according to claim 7, characterized in that: Generating the target reward function based on the target reward and the target divergence includes: Obtaining an average expected value of the target reward and a product result of the target divergence and a preset hyperparameter; The target reward function is generated based on the average expected value and the product result.
10. A query processing method, characterized in that: include: Obtaining an initial query sample and a sample conversation record corresponding to the initial query sample; Using an initial query rewriting model to perform rewriting analysis on the initial query sample and the sample conversation record, and rewriting the initial query sample into a target query sample; Acquiring multi-source feedback data using the target query sample, wherein the multi-source feedback data is multiple types of query quality assessment data acquired during the process of training the initial query rewriting model; The model parameters of the initial query rewriting model are updated based on the multi-source feedback data to generate the target query rewriting model, wherein the target query rewriting model is used to rewrite and analyze the initial query request and the historical conversation record associated with the initial query request, rewrite the initial query request into a target query request, and generate a target query answer.
11. A query processing method, characterized in that: include: obtaining an initial query request through a first application programming interface; returning a target query response via a second application programming interface; Among them, the response data carried in the target query response includes: query answer content, the query answer content is generated based on the target query request, the target query request is obtained by rewriting and analyzing the initial query request and the historical conversation records associated with the initial query request using a target query rewriting model, the target query rewriting model is trained based on multi-source feedback data, and the multi-source feedback data is various types of query quality assessment data obtained by the target query rewriting model during the model training process.
12. An electronic device, characterized in that: include: a memory storing an executable program; A processor is used to run the program, wherein the program executes the query processing method according to any one of claims 1 to 11 when running.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium includes a stored executable program, wherein when the executable program is run, the device where the computer-readable storage medium is located is controlled to execute the query processing method according to any one of claims 1 to 11.
14. A computer program product, characterized in that The computer program comprises a computer program which, when executed by a processor, implements the query processing method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Query rewriting method and device
CN115705331A
Intelligent conversation privacy protection method and device, equipment and storage medium
CN116775837A
Query rewriting service optimization method and related device
CN116955410A
Information search method and device, electronic equipment, storage medium and program product
CN117009621A
Method and device for training dialogue query generation model based on reply enhancement
CN117591871A