Training methods and reordering methods for reordering models

By training a large generative re-ranking model to obtain a teacher model, filtering and calculating the matching reliability difference between positive and negative sample documents, and training a lightweight ranking model, the problem of balancing accuracy and efficiency in the re-ranking model is solved, achieving efficient and accurate retrieval ranking.

CN122491401APending Publication Date: 2026-07-31转转一零二四(北京)科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
转转一零二四(北京)科技有限公司
Filing Date
2026-04-29
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing reordering models fall short in balancing accuracy and inference efficiency. Lightweight models have limited ranking accuracy, while generative large models consume high resources when deployed online, failing to meet the requirements for efficient deployment.

Method used

The teacher model is obtained by training a large generative re-ranking model, positive and negative sample documents are selected and the matching reliability difference is calculated. These reliability differences are used to train a lightweight ranking model, which focuses on learning the relative matching priority differences of different documents under the same query. Combined with the lightweight structure of the lightweight ranking model, the high-precision ranking capability of the generative model is transferred.

Benefits of technology

While maintaining the efficient inference performance of the lightweight model, the accuracy and generalization ability of the re-ranking model are improved, enabling more accurate retrieval ranking results to be output in online high-concurrency deployments, thus optimizing the overall retrieval ranking performance and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122491401A_ABST
    Figure CN122491401A_ABST
Patent Text Reader

Abstract

This application provides a training method and a re-ranking method for a re-ranking model. The method includes: training a generative re-ranking model based on an initial training dataset to obtain a teacher model; wherein the initial training dataset contains multiple queries and corresponding documents for each query; using the teacher model, processing each query and corresponding document in the initial training data to obtain the matching confidence of each query-document pair output by the teacher model; for each query, filtering positive and negative sample documents corresponding to the query based on the matching confidence of the query-document pair, and determining the difference in matching confidence output by the teacher model; and training a lightweight ranking model based on the query, the positive sample documents, the negative sample documents, and the difference in matching confidence output by the teacher model to obtain a target re-ranking model. This method aims to achieve a balance between re-ranking accuracy and inference efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a training method and a reordering method for a reordering model. Background Technology

[0002] In scenarios such as information retrieval, e-commerce search, and intelligent question answering, re-ranking models are core components for improving the accuracy of search results. Their main function is to perform secondary ranking on the candidate documents retrieved in the initial search, and filter out the content that best matches the user's query, thereby improving the user experience.

[0003] Currently, the models widely used in re-ranking tasks are lightweight ranking models such as cross-encoders and large generative re-ranking models. Among them, lightweight ranking models such as cross-encoders have the advantages of lightweight structure, fast inference speed, and low resource consumption, making them suitable for online high-concurrency scenarios. However, the model's expressive power is limited, and the judgment of the matching relationship between queries and documents is not accurate enough, resulting in lower re-ranking accuracy. On the other hand, large generative re-ranking models have stronger semantic understanding and matching capabilities, and the re-ranking effect is significantly better. However, due to their large model size and large computational load, direct online deployment will lead to high consumption of graphics processing unit (GPU) resources and large inference latency, which cannot meet the requirements of efficient deployment.

[0004] Therefore, there is an urgent need for a reordering scheme that balances reordering accuracy and inference efficiency. Summary of the Invention

[0005] The training method and reordering method of the reordering model provided in this application embodiment are used to achieve the effect of balancing reordering accuracy and inference efficiency.

[0006] In a first aspect, embodiments of this application provide a method for training a reordering model, comprising:

[0007] Based on the initial training dataset, a generative re-ranking model is trained to obtain a teacher model; wherein, the initial training dataset contains multiple queries and the documents corresponding to each query;

[0008] Using the teacher model, each query and its corresponding document in the initial training data are processed to obtain the matching confidence of each query-document pair output by the teacher model;

[0009] For each query, based on the matching confidence of the query-document pair, the positive and negative sample documents corresponding to the query are filtered out, and the matching confidence difference output by the teacher model is determined; wherein, the matching confidence difference represents the difference between the matching confidence of the positive sample document and the matching confidence of the negative sample document under the same query;

[0010] Based on the query, the positive sample documents, the negative sample documents, and the difference in matching confidence output by the teacher model, the lightweight ranking model is trained to obtain the target re-ranking model.

[0011] In one possible implementation, the step of filtering out positive and negative sample documents corresponding to the query based on the matching confidence of the query-document pair includes:

[0012] Based on the matching confidence of the query-document pair, the documents corresponding to the query are sorted in descending order to obtain the sorted documents;

[0013] The first k documents in the sorted documents are taken as the positive sample documents corresponding to the query; k is an integer greater than 1.

[0014] For each positive sample document, select n documents from the remaining documents of the sorted documents excluding the positive sample document as negative sample documents for the positive sample document; n is an integer greater than 1.

[0015] In one possible implementation, training the lightweight ranking model based on the query, the positive sample documents, the negative sample documents, and the matching confidence difference output by the teacher model to obtain the target re-ranking model includes:

[0016] The query and the positive sample documents are processed using a lightweight ranking model to obtain the matching confidence of the positive sample documents output by the lightweight ranking model.

[0017] The query and the negative sample documents are processed using a lightweight ranking model to obtain the matching confidence of the negative sample documents output by the lightweight ranking model.

[0018] Based on the matching confidence scores of the positive sample documents output by the lightweight ranking model, the matching confidence scores of the negative sample documents output by the lightweight ranking model, and the difference in matching confidence scores output by the teacher model, the lightweight ranking model is optimized to obtain the target re-ranking model.

[0019] In one possible implementation, optimizing the lightweight ranking model based on the matching confidence scores of positive sample documents output by the lightweight ranking model, the matching confidence scores of negative sample documents output by the lightweight ranking model, and the difference in matching confidence scores output by the teacher model to obtain the target re-ranking model includes:

[0020] The difference in matching confidence scores output by the lightweight ranking model is determined based on the matching confidence scores of the positive sample documents output by the lightweight ranking model and the matching confidence scores of the negative sample documents output by the lightweight ranking model.

[0021] Based on the matching confidence difference output by the lightweight ranking model, the matching confidence difference output by the teacher model, and a preset loss function, the model parameters of the lightweight ranking model are updated to obtain the target re-ranking model; wherein, the loss function is used to measure the error between the matching confidence difference output by the lightweight ranking model and the confidence difference output by the teacher model.

[0022] In one possible implementation, the loss function is the square of the difference between the matching confidence difference output by the teacher model and the matching confidence difference output by the lightweight ranking model.

[0023] Secondly, embodiments of this application provide a reordering method, including:

[0024] Receive the target query input by the user;

[0025] Retrieve the documents that match the target query;

[0026] The target query and the document are input into the target re-ranking model to obtain the ranking result of the document; wherein the target re-ranking model is the target re-ranking model described in any one of the first aspects.

[0027] In one possible implementation, the method includes:

[0028] Based on the sorting results of the documents, determine the documents to be displayed;

[0029] Display the document to be displayed.

[0030] Thirdly, embodiments of this application provide a training apparatus for a reordering model, comprising:

[0031] The first training module is used to train the generative re-ranking model based on the initial training dataset to obtain the teacher model; wherein, the initial training dataset contains multiple queries and the documents corresponding to each query;

[0032] The processing module is used to process each query and its corresponding document in the initial training data using the teacher model, and to obtain the matching confidence of each query-document pair output by the teacher model.

[0033] The filtering module is used to filter out positive and negative sample documents corresponding to each query based on the matching confidence of the query-document pair, and determine the matching confidence difference output by the teacher model; wherein, the matching confidence difference represents the difference between the matching confidence of positive sample documents and the matching confidence of negative sample documents under the same query.

[0034] The second training module is used to train the lightweight ranking model based on the query, the positive sample documents, the negative sample documents, and the matching confidence difference output by the teacher model, so as to obtain the target re-ranking model.

[0035] Fourthly, embodiments of this application provide a reordering apparatus, comprising:

[0036] The receiving module is used to receive the target query input by the user;

[0037] The acquisition module is used to acquire the documents that match the target query;

[0038] A sorting module is used to input the target query and the document into a target re-sorting model to obtain a sorting result for the document; wherein the target re-sorting model is the target re-sorting model described in any one of the first aspects.

[0039] Fifthly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0040] The memory stores computer-executed instructions;

[0041] The processor executes computer execution instructions stored in the memory, causing the processor to perform various possible implementations of the first and / or second aspects described above.

[0042] In a sixth aspect, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement various possible implementations of the first and / or second aspects described above.

[0043] In a seventh aspect, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements various possible implementations of the first and / or second aspects described above.

[0044] The training and re-ranking methods for the re-ranking model provided in this application first train a generative re-ranking model based on an initial training dataset to obtain a teacher model. Then, the matching confidence between the query and the document is obtained through the teacher model. Positive and negative sample documents are then selected, and the difference in matching confidence between the positive and negative sample documents is calculated. Finally, a lightweight ranking model is trained using the difference in matching confidence, the query, and the positive and negative sample documents to obtain the target re-ranking model. This allows the target re-ranking model to focus on learning the relative matching priority differences of different documents under the same query, rather than imitating the absolute matching confidence of the teacher model. While retaining the advantages of the lightweight ranking model, such as lightweight design, high inference efficiency, and low hardware resource consumption, it effectively transfers the high-precision ranking capability of the generative re-ranking model. This solves the technical problem that existing re-ranking techniques cannot balance ranking accuracy and inference efficiency, improves the training effect and generalization ability of the re-ranking model, and enables the final target re-ranking model to output more accurate retrieval ranking results while adapting to the requirements of high-concurrency online deployment, thus optimizing the overall performance and experience of retrieval ranking. Attached Figure Description

[0045] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0046] Figure 1 A flowchart illustrating the training method for the reordering model provided in this application. Figure 1 ;

[0047] Figure 2 A flowchart illustrating the training method for the reordering model provided in this application. Figure 2 ;

[0048] Figure 3 A schematic diagram illustrating one application scenario provided in this application;

[0049] Figure 4 Flowchart of the reordering method provided in this application Figure 1 ;

[0050] Figure 5 A schematic diagram of the training device for the reordering model provided in this application;

[0051] Figure 6 A schematic diagram of the reordering device provided in this application;

[0052] Figure 7 A schematic diagram of the structure of the electronic device provided in this application.

[0053] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation

[0054] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0055] When faced with the challenge of balancing accuracy and inference efficiency in re-ranking techniques, the inventors recognized that lightweight ranking models such as cross-encoders are lightweight and highly efficient to deploy, but have limited ranking accuracy. Generative re-ranking models, on the other hand, offer excellent accuracy but are difficult to deploy online. The inventors found that by transferring the ranking knowledge of large models to lightweight ranking models, the advantages of both could be achieved. Furthermore, they discovered that the core of re-ranking lies in distinguishing the relative matching priorities of different documents under the same query, rather than fitting the absolute confidence scores output by the teacher model. Directly using absolute scores for training would cause lightweight ranking models to overemphasize the numerical values ​​themselves, making learning more difficult and prone to deviating from the core goal of re-ranking. Therefore, the inventors proposed using matching confidence differences for training, focusing on the relative score differences between positive and negative sample documents under the same query. This allows the lightweight ranking model to concentrate on learning the teacher model's judgment logic for document matching priorities, rather than imitating absolute scores. This approach more efficiently transfers high-precision ranking knowledge while adapting to the lightweight structure of lightweight ranking models, ultimately resulting in a target re-ranking model that combines excellent ranking accuracy with efficient inference capabilities, thus resolving the contradiction between accuracy and efficiency in existing re-ranking techniques.

[0056] The execution subject of this application embodiment can be an electronic device with processing capabilities, such as a computer, server, etc., and this application embodiment is not limited thereto.

[0057] It should be noted that the user information and user data involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with relevant laws, regulations and standards, and provide corresponding operation entry points for users to choose to authorize or refuse.

[0058] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0059] Figure 1 A flowchart illustrating the training method for the reordering model provided in this application. Figure 1 ,like Figure 1 As shown, the method includes:

[0060] S101. Based on the initial training dataset, train the generative re-ranking large model to obtain the teacher model.

[0061] For example, the initial training dataset is a sample set used for supervised model training, containing multiple queries and corresponding documents, as well as labels representing whether the queries match the documents. Here, a query is the user-initiated search request text, and a document is the content to be retrieved that matches the query. It should be noted that the content of the queries and documents is not limited in this embodiment; for example, a query could be a product model, and a document could be product information.

[0062] Generative reranking large models are large parameter ranking models with powerful semantic understanding and matching judgment capabilities. This application does not limit the type of generative reranking large models, such as the Qwen3-Reranker-8B model.

[0063] The teacher model is a benchmark model that has undergone specialized training and is used to transfer professional ranking knowledge to the lightweight model.

[0064] In one example, an electronic device can input an initial training dataset, including queries and corresponding documents, into a large generative reranking model. The model parameters are iteratively optimized using supervised fine-tuning (SFT) to adapt the model to the matching logic of the retrieval scenario, thus training a teacher model. For instance, based on the initial training dataset, the Qwen3-Reranker-8B generative reranking model can be fully parameterized and fine-tuned using the Swift framework to obtain the teacher model. The Swift framework is an efficient fine-tuning framework for large language models, supporting fast and stable model training. Fully parameterized and supervised fine-tuning refers to fine-tuning all parameters of the model during training, maximizing its adaptation to the ranking logic of the business scenario.

[0065] S102. Using the teacher model, process each query and its corresponding document in the initial training data to obtain the matching confidence of each query-document pair output by the teacher model.

[0066] For example, a query-document pair is a matching unit formed by combining a single query with a single document under that query.

[0067] Match confidence is a quantitative value output by the teacher model, used to characterize the degree of matching between the query and the corresponding document. The higher the value, the higher the degree of matching. It's important to understand that this match confidence is an unnormalized value, i.e., the raw logistic score (logits) output by the model.

[0068] In one example, each set of queries and corresponding documents in the initial training dataset are sequentially input into the trained teacher model. The teacher model then performs inference calculations on the semantic association of each query-document pair and outputs the matching confidence of each query-document pair.

[0069] Specifically, each query and its corresponding document are input into the teacher model. Through forward inference, the original logits score corresponding to the yes token output by the model is extracted as the matching confidence of the query-document pair. After traversing and completing the inference calculation of all query-document pairs, the matching confidence of all documents corresponding to each query is obtained.

[0070] S103. For each query, based on the matching confidence of the query-document pair, filter out the positive and negative sample documents corresponding to the query, and determine the difference in matching confidence output by the teacher model.

[0071] For example, a positive sample document is a document whose matching degree with the query is greater than or equal to a preset threshold under the same query, and a negative sample document is a document whose matching degree with the query is less than the matching confidence of the positive sample document under the same query.

[0072] The match confidence difference represents the difference between the match confidence of positive sample documents and the match confidence of negative sample documents under the same query. In other words, the match confidence difference is used to represent the numerical difference between the match confidence of the query with positive sample documents and the match confidence of the query with negative sample documents under the same query.

[0073] In one example, for all documents corresponding to a single query, they are sorted in descending order of matching confidence from high to low. A preset number of documents at the top of the sorted list are selected as positive sample documents, and a corresponding number of documents are selected from the remaining documents as negative sample documents. The difference in matching confidence for each group of positive and negative sample documents is then calculated by numerical difference.

[0074] S104. Based on the difference in matching confidence scores between the query, positive sample documents, negative sample documents, and the teacher model output, the lightweight ranking model is trained to obtain the target re-ranking model.

[0075] For example, the lightweight ranking model is a lightweight re-ranking model with lightweight structure, fast inference speed and low resource consumption, which is suitable for online high-concurrency deployment scenarios. For example, it can be a cross-encoder model, BERT-based Contextualized Late Interaction over BERT (COLBERT), etc. The embodiments of this application are not limited here.

[0076] The target reordering model is a final application model that, after being trained by distillation, possesses both high-precision sorting capabilities and efficient inference performance.

[0077] In one example, the cross-encoder model is trained using a query, positive sample documents, and negative sample documents as training inputs, and the difference in matching confidence output by the teacher model as a supervision signal. This allows the model to learn the ranking logic of the teacher model, and the target re-ranking model is obtained after iteratively optimizing the parameters.

[0078] It is understandable that the entire distillation process described above does not rely on online real-time retrieval services or follow real-time user requests. Instead, all distillation data construction and lightweight ranking model training are completed in advance, in batches, and all at once in the training environment before the model is deployed online, to obtain the target re-ranking model.

[0079] The training method for the re-ranking model provided in this application first trains a generative re-ranking model based on an initial training dataset to obtain a teacher model. Then, the teacher model is used to obtain the matching confidence between the query and the document. Positive and negative sample documents are then selected and the difference in matching confidence between the positive and negative sample documents is calculated. Finally, a lightweight ranking model is trained using the difference in matching confidence, the query, and the positive and negative sample documents to obtain the target re-ranking model. This allows the target re-ranking model to focus on learning the relative matching priority differences of different documents under the same query, rather than imitating the absolute matching confidence of the teacher model. While retaining the advantages of the lightweight ranking model, such as lightweight design, high inference efficiency, and low hardware resource consumption, it effectively transfers the high-precision ranking capability of the generative re-ranking model. This solves the technical problem that existing re-ranking techniques cannot balance ranking accuracy and inference efficiency, improves the training effect and generalization ability of the re-ranking model, and enables the final target re-ranking model to output more accurate retrieval ranking results while adapting to the requirements of high-concurrency online deployment, thus optimizing the overall retrieval ranking performance and experience.

[0080] Figure 2 A flowchart illustrating the training method for the reordering model provided in this application. Figure 2 , Figure 3 A schematic diagram illustrating an application scenario provided in this application, such as... Figure 2 and Figure 3 As shown, in this embodiment... Figure 1 Based on the examples, the training method of the reordering model is described in detail, which includes:

[0081] S201. Based on the initial training dataset, train the generative re-ranking large model to obtain the teacher model.

[0082] It should be noted that this step is similar to the aforementioned step S101, and will not be repeated here. The initial training dataset can be represented as shown in Table 1.

[0083] Table 1 Initial Training Dataset

[0084]

[0085] S202. Using the teacher model, process each query and its corresponding document in the initial training data to obtain the matching confidence of each query-document pair output by the teacher model.

[0086] For example, each query and its corresponding document from the initial training dataset is input into the teacher model. Through forward inference, the raw logits score corresponding to the yes token output by the model is extracted as the matching confidence of the query-document pair. For example, the matching confidence of the query-document pair can be represented as shown in Table 2.

[0087] Table 2 Query - Document Pair Matching Confidence

[0088]

[0089] S203. Sort the documents corresponding to the query in descending order according to the matching confidence of the query-document pair to obtain the sorted documents.

[0090] For example, descending sorting refers to the process of arranging numerical values ​​in descending order.

[0091] Sorted documents refer to the collection of all documents under the same query, arranged according to their matching confidence scores.

[0092] In one example, all documents corresponding to a single query are sorted from highest to lowest based on their matching confidence scores, resulting in a sorted list of documents.

[0093] S204. Take the top k documents from the sorted documents as the positive sample documents corresponding to this query.

[0094] For example, positive sample documents refer to document samples that match the query highly under the same query. k is a preset parameter for the number of positive samples to be selected, and its value is an integer greater than 1.

[0095] In one example, k is set to 4, and the top 4 documents with the highest confidence after sorting are identified as the positive sample documents for the query.

[0096] S205. For each positive sample document, select n documents from the remaining documents after sorting (excluding the positive sample document) as negative sample documents for that positive sample document.

[0097] For example, a negative sample document refers to a document sample that matches the query less than the matching confidence of a positive sample document under the same query.

[0098] n is a preset parameter for the number of negative samples to be selected, and its value is an integer greater than 1.

[0099] In one example, taking n=2 as an example, for each positive sample document, the two documents immediately following it in the sorted documents are selected as the negative sample documents corresponding to the positive sample document. Alternatively, two documents from the sorted documents other than the positive sample documents can be randomly selected as the negative sample documents corresponding to the positive sample document.

[0100] S206. Determine the difference in matching confidence scores between the teacher model outputs.

[0101] In one example, the difference in matching confidence scores between the positive sample documents and the negative sample documents is calculated using the matching confidence scores from the teacher model's output. .

[0102] Through the above steps, for each query, multiple sets of matching confidence differences can be obtained (query, positive sample documents, negative sample documents, and the teacher model output). The distillation data, totaling k×n records, is used to obtain the distillation training dataset. For example, the distillation training dataset can be represented as shown in Table 3.

[0103] Table 3 Distillation Training Dataset

[0104]

[0105] S207. Using a lightweight ranking model, process the query and positive sample documents to obtain the matching confidence of the positive sample documents output by the lightweight ranking model.

[0106] For example, a query from a set of distillation data and a positive sample document are input into a lightweight ranking model. The model's forward inference yields the matching confidence score of the positive sample document. It should be noted that the matching confidence score of the positive sample document output by the lightweight ranking model is the original logistic score (logits), which can be referred to in the preceding steps and will not be repeated here.

[0107] S208. Using a lightweight ranking model, process the query and negative sample documents to obtain the matching confidence of the negative sample documents output by the lightweight ranking model.

[0108] For example, the queries and negative sample documents in this set of distillation data are input into a lightweight ranking model, and the matching confidence of the negative sample document is obtained through forward inference of the model. It should be noted that the matching confidence of the negative sample document output by the lightweight ranking model is the original logistic score (logits), which can be referred to the explanation in the previous steps, and will not be repeated here.

[0109] S209. Based on the matching confidence of positive sample documents output by the lightweight ranking model, the matching confidence of negative sample documents output by the lightweight ranking model, and the difference in matching confidence of the teacher model, the lightweight ranking model is optimized to obtain the target re-ranking model.

[0110] For example, optimization processing refers to the training process of updating model parameters based on the loss function.

[0111] In one example, the electronic device can calculate the difference in matching confidence output by the lightweight ranking model for each set of distillation data in the distillation dataset, based on the matching confidence of positive sample documents output by the lightweight ranking model and the matching confidence of negative sample documents output by the lightweight ranking model. The difference in matching confidence output by the teacher model is used as a supervision signal, and the model parameters of the lightweight ranking model are updated using a preset loss function. After training, the target re-ranking model is obtained.

[0112] Specifically, based on the matching confidence scores of positive sample documents and negative sample documents output by the lightweight ranking model, the difference in matching confidence scores output by the lightweight ranking model is determined. Based on the difference in matching confidence scores output by the lightweight ranking model, the difference in matching confidence scores output by the teacher model, and the preset loss function, the model parameters of the lightweight ranking model are updated to obtain the target re-ranking model.

[0113] The matching confidence difference output by the lightweight ranking model refers to the numerical difference between the two matching confidence scores obtained by the lightweight ranking model after reasoning about the positive and negative sample documents under the same query. It is used to reflect the lightweight model's judgment result on the document matching priority.

[0114] The predefined loss function measures the difference in matching confidence between the output of the lightweight ranking model and the output of the teacher model. For example, this loss function could be the Margin Mean Squared Error (MarginMSE).

[0115] Model parameter update refers to the optimization process of iteratively adjusting the weight parameters of a lightweight ranking model based on the error feedback of the loss function.

[0116] For example, first subtract the matching confidence score of the negative sample documents from the matching confidence score of the positive sample documents output by the lightweight ranking model to obtain the matching confidence score difference output by the lightweight ranking model, and then use the matching confidence score difference output by the teacher model. As a supervisory label, the model error is calculated according to the preset loss function. All parameters of the lightweight ranking model are updated through error backpropagation. The model is continuously iterated and trained until it converges, and finally the optimized target re-ranking model is obtained.

[0117] Optionally, the loss function can be the square of the difference between the matching confidence difference output by the teacher model and the matching confidence difference output by the lightweight ranking model. For example, this loss function can be expressed as: .

[0118] in, This represents the value of the loss function, i.e., the error; This represents the difference in matching confidence scores output by the teacher model. , This represents the query q-positive sample document output by the teacher model. Match confidence, This represents the query q-negative sample document output by the teacher model. The matching confidence level.

[0119] This represents the difference in matching confidence output by the lightweight ranking model. , This represents the query-positive sample document matching confidence score output by the lightweight ranking model. This represents the match confidence of the query-negative sample documents output by the lightweight ranking model.

[0120] To verify the effectiveness of the method in this application, a comparative experiment was conducted on mobile phone quality inspection data. The initial training dataset used in the experiment consisted of 108,356 records, and the distillation training dataset consisted of 91,336 records. Two control groups were set up: the first group used the method provided in this application to fine-tune the cross-encoder, and the second group directly used the initial training dataset to fine-tune the cross-encoder. The experimental results in Table 4 show that, compared to the control group, the target re-ranking model optimized by the method provided in this application effectively improved all relevance evaluation indicators. Specifically, the Mean Reciprocal Rank (MRR)@20, MRR@10, and MRR@5 improved by 3.76%, 3.72%, and 3.91%, respectively, and the Normalized Discounted Cumulative Gain (NDCCG) also improved significantly. Gain (NDCG)@20, NDCG@10, and NDCG@5 improved by 0.0247%, 0.028%, and 0.0457%, respectively, fully demonstrating that the method provided in this application embodiment can significantly improve the ranking accuracy of the re-ranking model. Here, Recall is the recall rate.

[0121] Table 4 Experimental Results

[0122]

[0123] The training method for the re-ranking model provided in this application involves training a generative re-ranking model using an initial training dataset to obtain a teacher model. The teacher model generates matching confidence scores between queries and documents. After sorting the documents in descending order, a specified number of positive and negative samples are selected. The difference in matching confidence scores output by the teacher model is calculated. Then, a lightweight ranking model is used to infer the matching confidence scores of the positive and negative samples respectively. Finally, the model is optimized based on the matching confidence scores and the difference in matching confidence scores to obtain the target re-ranking model. This method focuses on learning the relative matching differences of documents under the same query rather than absolute scores. While retaining the advantages of lightweight ranking models—lightweight, efficient inference, and low resource consumption—it accurately transfers the high-precision ranking capabilities of generative re-ranking models. This effectively solves the core problem that existing re-ranking technologies cannot balance ranking accuracy and inference efficiency, improving the scenario adaptability and generalization of the re-ranking model. This allows the target re-ranking model to output more accurate retrieval ranking results while meeting the requirements of high-concurrency online deployment, comprehensively optimizing the overall performance and user experience of information retrieval.

[0124] Figure 4 Flowchart of the reordering method provided in this application Figure 1 ,like Figure 4 As shown, the method includes:

[0125] S301, Receive the target query input by the user.

[0126] For example, a target query is a search requirement entered by the user, which expresses the core intent of the user to find the content, such as keywords, short sentences, or questions.

[0127] In one example, the electronic device retrieves the text content entered by the user in the input box through a retrieval interface to obtain the target query.

[0128] S302. Retrieve the document that matches the target query.

[0129] For example, the matched documents refer to the set of candidate documents retrieved from the document library through a primary retrieval method that have content or semantic association with the target query, and are the objects of subsequent fine-grained re-ranking.

[0130] In one example, an electronic device can use vector retrieval or keyword matching to filter out multiple candidate documents related to the target query from a pre-defined document library, and obtain the document that matches the target query.

[0131] S303. Input the target query and documents into the target re-ranking model to obtain the document ranking results.

[0132] For example, the target reordering model is an optimized lightweight sorting model that is trained by the aforementioned knowledge distillation method and has both efficient reasoning performance and high-precision sorting capability.

[0133] The sorting result is a sequence of documents arranged from highest to lowest degree of matching between the documents and the target query.

[0134] In one example, the target query and the recalled matching documents are input into the target re-ranking model, which scores and ranks the matching degree of each document, and finally outputs an ordered document ranking result.

[0135] Optionally, based on the document sorting results, determine the documents to be displayed; display the documents to be displayed.

[0136] The documents to be displayed are a subset of documents selected from the sorted results of these documents and intended for presentation to the user. For example, documents with higher matching priority can be selected to ensure a better browsing experience for the user.

[0137] For example, based on a preset number of page views, a fixed number of top-ranked documents are selected from the document sorting results and designated as the final documents to be displayed. The relevant content of these documents is then displayed sequentially on the search results page according to their sorting order, completing the visual presentation of the filtered documents. Leveraging the efficient reasoning and high-precision sorting advantages of the target re-ranking model, while ensuring retrieval response speed, the matching degree between displayed content and user search needs is significantly improved. This allows users to quickly locate highly relevant documents, simplifies the information retrieval and browsing process, and effectively enhances the overall smoothness of the search service and the user experience.

[0138] The re-ranking method provided in this application receives a target query input by the user, obtains documents that match the target query, and then inputs the target query and matching documents into a distilled and optimized target re-ranking model for inference and ranking, finally obtaining the document ranking result. In this way, relying on the characteristics of the target re-ranking model that take into account both inference efficiency and ranking accuracy, it can significantly improve the accuracy of matching and ranking between documents and user queries while ensuring retrieval response speed and adapting to online high-concurrency usage scenarios. It can push content that is more in line with the user's retrieval needs and effectively optimize the overall information retrieval user experience.

[0139] Figure 5 A schematic diagram of the training device for the reordering model provided in this application is shown below. Figure 5 As shown, the training device 400 for the reordering model provided in this embodiment includes:

[0140] The first training module 401 is used to train the generative re-ranking large model based on the initial training dataset to obtain the teacher model; wherein, the initial training dataset contains multiple queries and the documents corresponding to each query;

[0141] Processing module 402 is used to process each query and its corresponding document in the initial training data using the teacher model, and to obtain the matching confidence of each query-document pair output by the teacher model.

[0142] The filtering module 403 is used to filter out the positive and negative sample documents corresponding to each query based on the matching confidence of the query-document pair, and determine the matching confidence difference output by the teacher model; wherein, the matching confidence difference represents the difference between the matching confidence of the positive sample documents and the matching confidence of the negative sample documents under the same query.

[0143] The second training module 404 is used to train the lightweight ranking model based on the query, positive sample documents, negative sample documents and the matching confidence difference output by the teacher model, so as to obtain the target re-ranking model.

[0144] In one possible implementation, the filtering module 403 is used for:

[0145] Based on the matching confidence of the query-document pairs, the documents corresponding to the query are sorted in descending order to obtain the sorted documents;

[0146] The first k documents in the sorted documents are used as the positive sample documents for this query; k is an integer greater than 1.

[0147] For each positive sample document, select n documents from the remaining documents after sorting (excluding the positive sample document) as negative sample documents for that positive sample document; n is an integer greater than 1.

[0148] In one possible implementation, the second training module 404 is used for:

[0149] Using a lightweight ranking model, the query and positive sample documents are processed to obtain the matching confidence of the positive sample documents output by the lightweight ranking model.

[0150] Using a lightweight ranking model, the query and negative sample documents are processed to obtain the matching confidence of the negative sample documents output by the lightweight ranking model.

[0151] Based on the matching confidence scores of positive sample documents output by the lightweight ranking model, the matching confidence scores of negative sample documents output by the lightweight ranking model, and the difference in matching confidence scores output by the teacher model, the lightweight ranking model is optimized to obtain the target re-ranking model.

[0152] In one possible implementation, the second training module 404 is used for:

[0153] The difference in matching confidence between the positive sample documents and the negative sample documents output by the lightweight ranking model is determined.

[0154] Based on the matching confidence difference output by the lightweight ranking model, the matching confidence difference output by the teacher model, and the preset loss function, the model parameters of the lightweight ranking model are updated to obtain the target re-ranking model; whereby the loss function is used to measure the error between the matching confidence difference output by the lightweight ranking model and the confidence difference output by the teacher model.

[0155] In one possible implementation, the loss function is the square of the difference between the matching confidence difference output by the teacher model and the matching confidence difference output by the lightweight ranking model.

[0156] The training device for the reordering model provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0157] Figure 6 A schematic diagram of the reordering device provided in this application is shown below. Figure 6 As shown, the reordering device 500 provided in this embodiment includes:

[0158] The receiving module 501 is used to receive the target query input by the user;

[0159] Module 502 is used to retrieve documents that match the target query;

[0160] The sorting module 503 is used to input the target query and documents into the target re-sorting model to obtain the sorting results of the documents.

[0161] In one possible implementation, the device further includes a display module for:

[0162] Based on the document sorting results, determine the documents to be displayed;

[0163] Display the document to be displayed.

[0164] The reordering device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0165] Figure 7 A schematic diagram of the structure of the electronic device provided in this application. Figure 7 As shown, the electronic device 600 provided in this embodiment includes at least one processor 601 and a memory 602. Optionally, the electronic device 600 further includes a communication component 603. The processor 601, memory 602, and communication component 603 are connected via a bus.

[0166] In a specific implementation, at least one processor 601 executes computer execution instructions stored in memory 602, causing at least one processor 601 to perform the above-described method.

[0167] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0168] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0169] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0170] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0171] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0172] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0173] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0174] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0175] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0176] The units described as separate components may or may not be physically separate. 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 the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0177] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0178] If a function is implemented as 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 this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0179] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0180] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A training method for a reordering model, characterized in that, include: Based on the initial training dataset, a generative re-ranking model is trained to obtain a teacher model; wherein, the initial training dataset contains multiple queries and the documents corresponding to each query; Using the teacher model, each query and its corresponding document in the initial training data are processed to obtain the matching confidence of each query-document pair output by the teacher model; For each query, based on the matching confidence of the query-document pair, the positive and negative sample documents corresponding to the query are filtered out, and the matching confidence difference output by the teacher model is determined; wherein, the matching confidence difference represents the difference between the matching confidence of the positive sample document and the matching confidence of the negative sample document under the same query; Based on the query, the positive sample documents, the negative sample documents, and the difference in matching confidence output by the teacher model, the lightweight ranking model is trained to obtain the target re-ranking model.

2. The method according to claim 1, characterized in that, The step of filtering out positive and negative sample documents corresponding to the query based on the matching confidence of the query-document pair includes: Based on the matching confidence of the query-document pair, the documents corresponding to the query are sorted in descending order to obtain the sorted documents; The first k documents in the sorted documents are taken as the positive sample documents corresponding to the query; k is an integer greater than 1. For each positive sample document, select n documents from the remaining documents of the sorted documents excluding the positive sample document as negative sample documents for the positive sample document; n is an integer greater than 1.

3. The method according to claim 1, characterized in that, The lightweight ranking model is trained based on the query, the positive sample documents, the negative sample documents, and the difference in matching confidence output by the teacher model to obtain the target re-ranking model, including: Using the lightweight ranking model, the query and the positive sample documents are processed to obtain the matching confidence of the positive sample documents output by the lightweight ranking model; Using the lightweight ranking model, the query and the negative sample documents are processed to obtain the matching confidence of the negative sample documents output by the lightweight ranking model; Based on the matching confidence scores of the positive sample documents output by the lightweight ranking model, the matching confidence scores of the negative sample documents output by the lightweight ranking model, and the difference in matching confidence scores output by the teacher model, the lightweight ranking model is optimized to obtain the target re-ranking model.

4. The method according to claim 3, characterized in that, The step of optimizing the lightweight ranking model based on the matching confidence scores of positive sample documents output by the lightweight ranking model, the matching confidence scores of negative sample documents output by the lightweight ranking model, and the difference in matching confidence scores output by the teacher model, to obtain the target re-ranking model, includes: The difference in matching confidence scores output by the lightweight ranking model is determined based on the matching confidence scores of the positive sample documents output by the lightweight ranking model and the matching confidence scores of the negative sample documents output by the lightweight ranking model. Based on the matching confidence difference output by the lightweight ranking model, the matching confidence difference output by the teacher model, and a preset loss function, the model parameters of the lightweight ranking model are updated to obtain the target re-ranking model; wherein, the loss function is used to measure the error between the matching confidence difference output by the lightweight ranking model and the confidence difference output by the teacher model.

5. The method according to claim 4, characterized in that, The loss function is the square of the difference between the matching confidence difference output by the teacher model and the matching confidence difference output by the lightweight ranking model.

6. A reordering method, characterized in that, include: Receive the target query input by the user; Retrieve the documents that match the target query; The target query and the document are input into the target re-ranking model to obtain the ranking result of the document; wherein the target re-ranking model is the target re-ranking model of any one of claims 1-5.

7. The method according to claim 6, characterized in that, The method includes: Based on the sorting results of the documents, determine the documents to be displayed; Display the document to be displayed.

8. A training apparatus for a reordering model, characterized in that, include: The first training module is used to train the generative re-ranking model based on the initial training dataset to obtain the teacher model; wherein, the initial training dataset contains multiple queries and the documents corresponding to each query; The processing module is used to process each query and its corresponding document in the initial training data using the teacher model, and to obtain the matching confidence of each query-document pair output by the teacher model. The filtering module is used to filter out positive and negative sample documents corresponding to each query based on the matching confidence of the query-document pair, and determine the matching confidence difference output by the teacher model; wherein, the matching confidence difference represents the difference between the matching confidence of positive sample documents and the matching confidence of negative sample documents under the same query. The second training module is used to train the lightweight ranking model based on the query, the positive sample documents, the negative sample documents, and the matching confidence difference output by the teacher model, so as to obtain the target re-ranking model.

9. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.