Data processing method and device and model training method and device
By employing a parallel prediction method based on a diffusion language model, the latency and error accumulation issues of autoregressive models in reordering tasks are addressed, thereby improving the efficiency and accuracy of document sorting.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ALIBABA (CHINA) CO LTD
- Filing Date
- 2026-02-13
- Publication Date
- 2026-05-15
AI Technical Summary
Existing autoregressive models suffer from high inference latency, error accumulation, and lack of bidirectional context in reordering tasks, making them unable to process large-scale document sets in parallel, resulting in low reordering efficiency.
A diffusion language model is used to generate mask tags by obtaining query text, candidate documents and ranking strategies. Parallel prediction is performed using a document processing model, and the mask prediction results are output to determine the document ranking results.
It achieves efficient parallel prediction, avoids the serial bottleneck and error accumulation of autoregressive models, and improves the efficiency and accuracy of reordering.
Smart Images

Figure CN122045407A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and in particular to data processing methods. One or more embodiments of this specification also relate to a data processing apparatus, a model training method, a model training apparatus, a computing device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] With the development of large-scale language models, generative re-ranking methods have become a new paradigm in the field of information retrieval. Most current re-ranking models are based on autoregressive architectures, which construct a document ranking list by generating document identifiers one by one through prompt words-driven models (one document identifier corresponds to one candidate document, and the generation order is the ranking order).
[0003] Although autoregressive models perform well in semantic understanding, they have a fundamental flaw in reordering tasks. That is, autoregressive models need to generate document identifiers one by one, which cannot be processed in parallel, and the pressure on real-time reordering of large-scale document sets is extremely high. Summary of the Invention
[0004] In view of this, embodiments of this specification provide a data processing method. One or more embodiments of this specification also relate to a data processing apparatus, a model training method, a model training apparatus, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.
[0005] According to a first aspect of the embodiments of this specification, a data processing method is provided, comprising: Obtain the query text, at least two candidate documents, and a sorting strategy for the candidate documents; determine the target prompt text based on the sorting strategy; and determine the mask marker for each candidate document. The text to be processed is generated based on the query text, the at least two candidate documents, and the mask markers of each candidate document; The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, and the document sorting results of the at least two candidate documents are obtained based on each mask prediction result.
[0006] According to a second aspect of the embodiments of this specification, a data processing apparatus is provided, comprising: The acquisition module is configured to acquire the query statement text, at least two candidate documents, and a sorting strategy for the candidate documents, determine the target prompt text according to the sorting strategy, and determine the mask marker for each candidate document. The generation module is configured to generate text to be processed based on the query text, the at least two candidate documents, and the mask markers of each candidate document; The sorting module is configured to input the text to be processed, the sorting strategy, and the target prompt text into the document processing model, obtain the mask prediction results corresponding to each mask marker, and obtain the document sorting results of the at least two candidate documents based on each mask prediction result.
[0007] According to a third aspect of the embodiments of this specification, a model training method is provided, comprising: Obtain the query text, at least two candidate documents, the arrangement identifiers of the at least two candidate documents, and the sorting strategy; determine the target prompt text based on the sorting strategy. The target arrangement identifier of the target candidate document among the at least two candidate documents is masked to obtain the mask mark of the target candidate document; The text to be processed is generated based on the query text, the at least two candidate documents, the arrangement identifiers of the candidate documents, and the mask marker of the target candidate document; The text to be processed, the sorting strategy, and the target prompt text are input into the data processing model to obtain the mask prediction result corresponding to the mask mark. Based on the mask prediction results and the target arrangement identifiers, the data processing model is trained to obtain the document processing model.
[0008] According to a fourth aspect of the embodiments of this specification, a model training apparatus is provided, comprising: The acquisition module is configured to acquire the query statement text, at least two candidate documents, the arrangement identifiers of the at least two candidate documents, and a sorting strategy, and determine the target prompt text based on the sorting strategy; The masking module is configured to perform masking processing on the target arrangement identifier of the target candidate document among the at least two candidate documents to obtain the mask mark of the target candidate document; The generation module is configured to generate text to be processed based on the query text, the at least two candidate documents, the arrangement identifiers of the candidate documents, and the mask marker of the target candidate document; The prediction module is configured to input the text to be processed, the sorting strategy, and the target prompt text into the data processing model to obtain the mask prediction result corresponding to the mask marker; The training module is configured to train the data processing model based on the mask prediction results and the target arrangement identifiers to obtain the document processing model.
[0009] According to a fifth aspect of the embodiments of this specification, another data processing method is provided, including: In response to a document sorting request sent by a client, the system obtains the query text, at least two candidate documents, and a sorting strategy for the candidate documents, and determines the target prompt text based on the sorting strategy. The text to be processed is generated based on the query text, the at least two candidate documents, and the mask markers of each candidate document; The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker. Based on each mask prediction result, the document sorting results of the at least two candidate documents are obtained, and the document sorting results are returned to the client.
[0010] According to a sixth aspect of the embodiments of this specification, a computing device is provided, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, they implement the steps of the above-mentioned data processing method and model training method.
[0011] According to a seventh aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores a computer program / instructions, which, when executed by a processor, implement the steps of the above-described data processing method and model training method.
[0012] According to an eighth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described data processing method and model training method.
[0013] This specification provides a data processing method in one embodiment, which obtains query text, multiple candidate documents, and corresponding sorting strategies. Based on the sorting strategies, it determines target hint text and obtains mask markers for each candidate document. The query text, candidate documents, and mask markers are concatenated to form the text to be processed, thereby integrating previously scattered information into a context, providing a structured input for parallel prediction of the document processing model. The text to be processed, the sorting strategy, and the target hint text are input into the document processing model, which predicts the mask markers and directly outputs the mask prediction results corresponding to each mask marker. Based on the mask prediction results, the order of each candidate document is determined, resulting in a document sorting result. By using mask prediction in the document processing model, the sequential bottleneck and error accumulation inherent in autoregressive models can be avoided, improving both re-sorting efficiency and sorting accuracy. Attached Figure Description
[0014] Figure 1 This is a schematic diagram illustrating a data processing method provided in one embodiment of this specification. Figure 2 This is a flowchart illustrating a data processing method provided in one embodiment of this specification; Figure 3 This is a flowchart illustrating a model training method provided in one embodiment of this specification; Figure 4 This is a schematic diagram illustrating the processing procedure of a sorting strategy in a data processing method provided in one embodiment of this specification; Figure 5 This is a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this specification; Figure 6 This is a schematic diagram of the structure of a model training device provided in one embodiment of this specification; Figure 7 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0015] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0016] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0017] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0018] Furthermore, 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 one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0019] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0020] Diffusion Language Models (dLLMs): A non-autoregressive generative language model that models text generation as an iterative process of gradually denoising random noise and restoring it to clear text by simulating the physical diffusion process.
[0021] Document reranking: A key step in information retrieval systems, aiming to refine the ranking of candidate documents retrieved in the coarse-sorting stage in order to improve the relevance of search results.
[0022] Autoregressive model: A model that generates sequences one token at a time, where the output of each step depends on the tokens generated previously.
[0023] Pointwise reordering: Independently evaluates the relevance score of each query text-candidate document pair.
[0024] Listwise: This method takes multiple candidate documents as input, uses a model to capture the relationships between these documents, and directly outputs the ranking results or the relevance probability distribution.
[0025] Logits: The unnormalized output values of the model, reflecting the model's confidence in predicting a specific label.
[0026] The Hungarian Algorithm is a combinatorial optimization algorithm that solves the assignment problem in polynomial time.
[0027] With the development of large-scale language models, generative re-ranking methods have become a new paradigm in information retrieval, widely applied in information retrieval and search enhancement. Most current re-ranking models are based on autoregressive architectures, which use prompt words to drive the model to generate document identifiers one by one to construct the ranking list. Although autoregressive models perform well in semantic understanding, they suffer from high inference latency, error accumulation, poor output controllability, and lack of bidirectional context in re-ranking tasks.
[0028] Therefore, this specification provides a reordering method based on a diffusion language model to solve the above problems.
[0029] This specification provides two data processing methods, and also relates to a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0030] See Figure 1 , Figure 1 This diagram illustrates a scenario of a data processing method provided in one embodiment of this specification.
[0031] For example, the data processing method is applied to a data processing system, which includes an end-side device 102 and a server 104. The end-side device 102 is used to send a document sorting request to the server 104. The request carries a query statement text, at least two candidate documents, and a sorting strategy for the candidate documents.
[0032] A document processing model is trained in server 104. In response to a document sorting request sent by end device 102 (i.e., client), server 104 obtains the query text, at least two candidate documents, and a sorting strategy for the candidate documents. Based on the sorting strategy, it determines the target prompt text and the mask marker for each candidate document. Based on the query text, the at least two candidate documents, and the mask marker for each candidate document, it generates text to be processed. The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker. Based on the mask prediction results, the document sorting results of the at least two candidate documents are obtained, and the document sorting results are returned to end device 102.
[0033] The edge device 102 may include a browser, an app (application), or a web application such as an H5 (Hypertext Markup Language 5) application, a lightweight application (also known as a mini-program), or a cloud application. The edge device can be developed based on a software development kit (SDK) provided by the server, such as a real-time communication (RTC) SDK. The edge device can be deployed in an electronic device and depends on the device's operation or certain apps within the device to run. The electronic device may have a display screen and support information browsing, such as a personal mobile terminal like a mobile phone, tablet, or personal computer. Various other types of applications can also be configured in the electronic device, such as human-computer interaction applications, model training applications, data processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social media platform software.
[0034] Server 104 can be understood as a server providing various services, including physical servers and cloud servers. Examples include servers providing communication services to multiple clients, servers supporting backend training of models used on clients, and servers processing data sent by clients. It's important to note that Server 104 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. Server 104 can also be a server in a distributed system, or a server integrated with blockchain. Server 104 can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.
[0035] It is worth noting that the data processing method provided in the embodiments of this specification can be executed by the server 104. In other embodiments of this specification, the document processing model can be deployed in the terminal device 102, so that the terminal device 102 can also have similar functions to the server 104, thereby executing the data processing method provided in the embodiments of this specification. In other embodiments, the data processing method provided in the embodiments of this specification can also be jointly executed by the terminal device 102 and the server 104.
[0036] See Figure 2 , Figure 2A flowchart of a data processing method provided in one embodiment of this specification is shown, which specifically includes the following steps.
[0037] Step 202: Obtain the query text, at least two candidate documents, and a sorting strategy for the candidate documents; determine the target prompt text based on the sorting strategy; and determine the mask marker for each candidate document.
[0038] In this context, the query text can be understood as the text content provided by the user or other servers for retrieving information; the candidate documents can be understood as documents retrieved based on the query text and awaiting further sorting; the sorting strategy can be understood as a pre-defined method or rule for guiding the sequential arrangement of documents, such as point-to-point reordering, list reordering, etc.; the target hint text can be understood as the hint text used to guide the model to reorder the candidate text, and this target hint text is related to the sorting strategy; the mask token can be understood as a special token used to cover specific locations, and the model needs to predict the covered content at these locations. In this embodiment, the mask token (i.e., the mask token) is represented by [M].
[0039] For example, a document sorting request sent by a client is received, which carries a query text, at least two candidate documents related to the query text, and, in the case of reordering the candidate documents, also carries a sorting strategy for the candidate documents.
[0040] The system generates corresponding target suggestion text based on the selected sorting strategy and adds mask markers to the end of each candidate document. By concatenating and combining the query text, at least two candidate documents, and the mask markers for each candidate document according to the sorting strategy requirements, it provides structured input for the subsequent document processing model.
[0041] Step 204: Generate the text to be processed based on the query text, the at least two candidate documents, and the mask markers of each candidate document.
[0042] The text to be processed can be understood as text that has been concatenated and meets the input format requirements of the document processing model; concatenation can be understood as combining multiple text fragments into a continuous, structured, and complete text sequence according to a preset order, format, and delimiters.
[0043] For example, the scattered query text, at least two candidate documents, and corresponding mask tags are concatenated according to the concatenation format specified by the sorting strategy to form the text to be processed, thereby providing a standard format input for the document processing model.
[0044] Step 206: Input the text to be processed, the sorting strategy, and the target prompt text into the document processing model to obtain the mask prediction results corresponding to each mask marker, and obtain the document sorting results of the at least two candidate documents based on each mask prediction result.
[0045] The document processing model can be understood as a machine learning model for reordering text. In the embodiments of this specification, the document processing model is a diffusion language model, which has the ability to perform parallel denoising and mask prediction. The mask prediction result can be understood as the prediction information output by the document processing model for the mask mark position. The mask prediction result can be the probability distribution of the relevance value (i.e., relevance score) or the prediction confidence of the document identifier (used to identify candidate documents). The document ranking result can be understood as a document ranking list that reflects the strength of the relevance between the candidate documents and the query text, obtained by sorting or sequence generation based on each mask prediction result.
[0046] For example, the document processing model receives the text to be processed, the target prompt text, and an explicit ranking strategy. Utilizing the denoising and bidirectional attention mechanisms of the document processing model, it predicts the content at the mask marker positions in parallel during one or more forward propagations. In specific implementations, depending on the selected ranking strategy, the mask prediction result can be a document relevance score, which can be used for candidate document ranking, or it can directly generate the complete document ranking result.
[0047] For example, if the query text is q, and there are at least two candidate documents including documents d1, d2, and d3, and the sorting strategy is "point-to-point reordering," then based on the point-to-point reordering strategy, the target prompt text is generated: "Determine whether each document is relevant to the query; the relevance score should be between 0 (irrelevant) and 1 (relevant)." With masking tags added to each candidate document, we obtain d1, [M]; d2, [M]; d3, [M]. Each [M] corresponds to a masking tag for a candidate document, and the model will predict the relevance score at these masking tag positions during forward computation.
[0048] Based on the query text q, documents d1, d2, d3 and the mask markers of each candidate document, generate the text to be processed: q, d1, [M]; d2, [M]; d3, [M].
[0049] The document processing model is input with the text to be processed, a sorting strategy, and target hint text. Based on the sorting strategy and target hint text, the model predicts mask markers in the text. Specifically, it calculates the logical value of each candidate document corresponding to a mask marker position and obtains a relevance score for each candidate document using these logical values. Based on the relevance scores, multiple candidate documents are sorted to obtain the document sorting result. Alternatively, in this embodiment, multiple mask markers can be combined into a mask marker sequence to predict the candidate document corresponding to each mask marker position in the sequence. For example, the document processing model can directly output the document identifier corresponding to each position in the mask marker sequence. For instance, the document processing model might output a sequence like "[M1]:d1,[M2]:d3,[M3]:d2", which means that at the first position of the mask marker sequence, the predicted candidate text is candidate document d1, the second position is candidate document d3, and the third position is candidate document d2. Based on this output sequence, the document sorting result is d1-d3-d2.
[0050] By uniformly inputting structured input and policy information into the diffusion language model (i.e., the document processing model), efficient parallel prediction of mask marker positions can be achieved, avoiding the delay and error accumulation caused by the autoregressive model generating each document individually. Furthermore, it can directly output comparable relevance scores or document order based on different ranking strategies, thereby significantly improving the inference efficiency and reliability of re-ranking while ensuring high accuracy.
[0051] For ease of understanding, the embodiments of the above data processing method are further explained and described in the following manner.
[0052] Step 202: Obtain the query text, at least two candidate documents, and a sorting strategy for the candidate documents; determine the target prompt text based on the sorting strategy; and determine the mask marker for each candidate document.
[0053] In one or more embodiments of this specification, candidate documents can be obtained through retrieval or directly from a preset knowledge base; no limitation is made here. Specific implementation methods are as follows: Retrieve the query text and at least two candidate documents, including: Based on the query text, at least two candidate documents are retrieved, or at least two candidate documents are obtained from a preset knowledge base.
[0054] Among them, retrieval can be understood as a way to quickly find and return relevant documents from a large-scale document collection based on the query text, usually achieved based on keyword retrieval, vector retrieval and other technologies; the preset knowledge base can be understood as a pre-built and stored data set, which can serve as a source of candidate documents, such as an enterprise document library or a database for a specific field.
[0055] For example, when receiving a query text submitted by a user or other server, at least two candidate documents can be obtained through real-time retrieval and recall, or candidate documents can be extracted directly from a pre-set knowledge base in the local area or cloud, without limitation.
[0056] For example, if a user enters the query "applications of artificial intelligence" (i.e., the query text), the system can use a retrieval module (such as BM25 or a dense search engine) to retrieve 50 relevant documents from the internet in real time as candidate documents. Alternatively, the system can retrieve 100 relevant documents stored in a pre-defined knowledge base (such as an enterprise document library) as candidate documents.
[0057] The data processing method provided in the embodiments of this specification supports two methods of obtaining candidate documents: retrieval recall and preset knowledge base. While ensuring the relevance between candidate documents and query text, it enhances the adaptability of the system in different application scenarios and provides reliable data support for subsequent text reordering.
[0058] In one or more embodiments of this specification, a target prompt text corresponding to the selected sorting strategy is constructed. For example, when the sorting strategy is a first relevance strategy, the target prompt text is a first prompt text used to calculate relevance; when the sorting strategy is a second arrangement strategy, the target prompt text is a second prompt text used to generate document arrangement. Specific implementation methods are described below: The sorting strategy includes a first relevance strategy and a second permutation strategy; The target prompt text is determined according to the sorting strategy, including: Based on the first relevance strategy, a first prompt text is constructed for calculating relevance.
[0059] Based on the second arrangement strategy, construct a second prompt text for document arrangement.
[0060] The first relevance strategy can be understood as a strategy to rank candidate texts by evaluating the relevance between the query text and each candidate document; the first prompt text can be understood as a prompt text designed for the first relevance strategy, which is used to guide the document processing model to calculate the relevance between the query text and the candidate documents at the mask mark position; the second arrangement strategy can be understood as a strategy to directly sort or generate a sequence of at least two candidate documents; the second prompt text can be understood as a prompt text designed for the second arrangement strategy, which is used to guide the document processing model to generate a sequence of at least two candidate documents.
[0061] For example, different prompt texts are constructed for different sorting strategies. Under the first relevance strategy, the first prompt text is used to guide the document processing model to calculate the relevance between the query text and the candidate documents. The mask mark position is used to output the relevance score of the corresponding candidate document. For example, the first prompt text can be "Determine whether each candidate document is relevant to the query text. The relevance score is between 0 (irrelevant) and 1 (relevant)".
[0062] Under the second sorting strategy, the second prompt text guides the document processing model to calculate the joint encoding of at least two candidate documents and the query text. The mask marker positions are used to generate the sorting order of at least two candidate documents. For example, the second prompt text could be: "Given a query text and multiple candidate documents indicated by document identifiers, sort the candidate documents from highest to lowest relevance to the query text. Specifically, output the sorting results of the document identifiers, arranged from highest to lowest relevance, with each document identifier separated by a space." In other words, the second prompt text can sort the text identifiers of multiple candidate documents, achieving a reordering of multiple candidate documents.
[0063] For example, when using the first relevance strategy, the document processing model is input with the query text q, candidate documents d1, d2, d3, the mask markers for each candidate document, the first relevance strategy, and the corresponding first prompt text. The document processing model then calculates the logical value of the mask marker position for each candidate document based on the first relevance strategy and the first prompt text, and obtains the relevance score for each candidate document through these logical values. For instance, candidate document d1 has a relevance score of 0.9, candidate document d2 has a relevance score of 0.7, and candidate document d3 has a relevance score of 0.3. Based on the relevance scores, the candidate documents are sorted in descending order, resulting in a document ranking of d1-d2-d3.
[0064] When employing the second sorting strategy, the document processing model is input with the query text q, candidate documents d1, d2, and d3, mask markers for each candidate document, the second sorting strategy, and the corresponding second prompt text. Based on the second sorting strategy and the second prompt text, the document processing model determines the document prediction result for each mask marker position. In practical applications, when using the second sorting strategy, multiple mask markers form a mask marker sequence. The document processing model uses this sequence to predict the candidate document corresponding to each position in the mask marker sequence. For example, the document processing model may directly output the document identifier corresponding to each position in the mask marker sequence. Specifically, the document processing model might output a sequence such as "[M1]:d1,[M2]:d3,[M3]:d2", which means that at the first position of the mask marker sequence, the predicted candidate document is candidate document d1; at the second position, candidate document d3; and at the third position, candidate document d2, resulting in a document sorting result of d1-d3-d2.
[0065] The data processing method provided in the embodiments of this specification can dynamically construct differentiated target prompt text according to different sorting strategies. The target prompt text provides clear and explicit guidance for subsequent processing in the model, enabling the same document processing model to flexibly support multiple reordering methods based on different sorting strategies. Furthermore, when users can choose multiple different sorting strategies, it enhances the applicability of the model and improves the user experience.
[0066] Step 204: Generate the text to be processed based on the query text, the at least two candidate documents, and the mask markers of each candidate document.
[0067] In the embodiments of this specification, the first relevance strategy includes a point-to-point reordering strategy. Under the point-to-point reordering strategy, the relevance of the query text and each candidate document is required to be calculated independently. Therefore, for each candidate text, a text to be processed corresponding to each candidate document is formed. At this time, the text to be processed corresponding to each candidate document is composed of the query text, the candidate document, and the corresponding mask mark. Exemplarily, the implementation method is as follows: Based on the query text, the at least two candidate documents, and the mask markers of each candidate document, generate the text to be processed, including: For any one of the at least two candidate documents, the query text, the candidate document, and the mask mark of the candidate document are concatenated to obtain the text to be processed corresponding to each candidate document.
[0068] The text to be processed for each candidate document can be understood as a complete text sequence generated independently for each candidate document, containing the query text, the candidate document and its mask tag. These text sequences can be used as independent or combined inputs to the document processing model.
[0069] For example, the specific implementation of the point-to-point re-ranking strategy is as follows: a mask token is added to the end of each candidate document. After single-step denoising, the logical values from "1" (relevant) to "0" (irrelevant) at the mask token position are extracted (the relevance score between the query text and the candidate documents can be obtained through the logical values). After obtaining the relevance score of each candidate document, the multiple candidate documents are sorted based on the relevance score to obtain the document ranking result.
[0070] In practice, when the ranking strategy is a point-to-point re-ranking strategy, it is necessary to evaluate the relevance of each candidate document to the query text individually. This ensures that the evaluation context of each candidate document is independent and complete. Therefore, a structured text to be processed is constructed for each candidate document by independently concatenating each candidate document. The text to be processed for each candidate document begins with the same query text, followed by the corresponding candidate document, and a mask marker is inserted at the end of the candidate document.
[0071] For example, given the query text q, candidate documents include documents d1, d2, and d3. For document d1, the concatenated text to be processed is "q, d1, [M]", and similarly, for document d2, the concatenated text to be processed is "q, d2, [M]", and for document d3, the concatenated text to be processed is "q, d3, [M]", where [M] is the mask marker for the corresponding candidate document.
[0072] The data processing method provided in the embodiments of this specification generates text to be processed independently for each candidate document under a point-to-point reordering strategy, ensuring the independence of the relevance judgment of each candidate document, and also providing a consistent input format for the batch parallel computation that the subsequent document processing model may perform, effectively improving processing efficiency.
[0073] Step 206: Input the text to be processed, the sorting strategy, and the target prompt text into the document processing model to obtain the mask prediction results corresponding to each mask marker, and obtain the document sorting results of the at least two candidate documents based on each mask prediction result.
[0074] In one or more embodiments of this specification, when employing a first relevance strategy, the document processing model predicts the relevance of the query text and candidate documents to obtain the relevance prediction results corresponding to the mask markers. Specific implementation methods are as follows: The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: When the sorting strategy is the first relevance strategy, the text to be processed, the first relevance strategy, and the first prompt text are input into the document processing model; Based on the document processing model, the correlation between the query text and each candidate document is calculated to obtain the correlation prediction results corresponding to each mask tag.
[0075] The relevant prediction result can be understood as the predicted value output by the document processing model at the mask mark position, which represents the degree of relevance between the query text and the corresponding candidate document. The relevant prediction result is usually expressed as the probability score of the "relevant" and "irrelevant" categories. The relevant prediction result is the relevance score in the above implementation.
[0076] For example, when the sorting strategy is selected as the first relevance strategy, the text to be processed, the first relevance strategy, and the first prompt text are input into the document processing model. The document processing model uses the first prompt text to predict the mask mark positions in each text to be processed based on the guidance of the first prompt text. Specifically, the document processing model calculates the relevance probability between the query text and each candidate document through the bidirectional attention mechanism of the cross encoder, and outputs the logical value representing the relevance at each mask mark position to obtain the relevance score, i.e., the relevance prediction result.
[0077] For example, given the query text q, candidate document d1, and the mask marker [M] corresponding to candidate document 1, the document processing model, upon receiving q, d1, [M], the first relevance strategy, and the first prompt text, calculates and outputs the logical values of markers "1" (relevant) and "0" (irrelevant) at the mask marker [M]. For instance, the logical value of "1" is 2.5, and the logical value of "0" is -1.0. After softmax calculation (to convert the logical values into probabilities), the relevance probability is obtained as 0.97 (i.e., the relevance score). This relevance score is the relevance prediction result corresponding to the mask marker.
[0078] The data processing method provided in the embodiments of this specification, when adopting a first relevance strategy, transforms the document sorting task into the prediction of mask tags by the document processing model, and based on the first prompt text, effectively guides the document processing model to efficiently calculate the deep semantic relevance between each candidate document and the query statement text, and obtains the relevance prediction results corresponding to each mask tag, thus providing a reliable data basis for subsequent document sorting based on the relevance prediction results.
[0079] In one or more embodiments of this specification, the first relevance strategy includes a point-to-point re-ranking strategy; under the point-to-point re-ranking strategy, the relevance scores of the query text and each candidate document are calculated independently. Specific implementation methods are as follows: The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: The text to be processed corresponding to each candidate document, the point-to-point reordering strategy, and the first prompt document input document processing model; The correlation between the query semantic document and the target candidate document is calculated based on the document processing model to obtain the correlation prediction result of the mask tag corresponding to the target candidate document, wherein the target candidate document is determined from the at least two candidate documents; Continue executing the steps of calculating the relevance between the query semantic document and the target candidate document based on the document processing model, and obtaining the relevance prediction results of the mask tags corresponding to the target candidate documents, until the relevance prediction results of the mask tags corresponding to each candidate document are obtained.
[0080] Among them, the point-to-point re-ranking strategy is a strategy that independently evaluates the relevance between each candidate document and the query text, and ranks the documents according to the relevance score; the target candidate document can be understood as the candidate document that is selected and relevance evaluated in the current calculation round.
[0081] For example, when using a point-to-point reordering strategy, each candidate document is processed one by one. In the above embodiment, the text to be processed for each candidate document includes the query text q, the candidate document d, and the mask marker [M] of the candidate document, and is organized in the form of q, d, [M].
[0082] For each document identified as a target candidate document, its corresponding text to be processed, point-to-point reordering strategy, and first prompt text are input into the document processing model. Based on this input, the document processing model calculates the semantic relevance between the query text and the current target candidate document, and outputs the relevant prediction result at the corresponding mask marker position of the target candidate document. This process is repeated until all candidate documents have been processed, thereby obtaining an independent relevant prediction result for each candidate document.
[0083] Continuing with the previous example, the query text is q, and the candidate documents include documents d1, d2, and d3. First, document d1 is identified as the target candidate document, and its text to be processed, "q, d1, [M]", along with the point-to-point reordering strategy and the first prompt text, are input. The document processing model outputs a probability of "1" (relevance) at the mask marker position with a value of 0.9. Next, the target candidate document is changed to document d2, and the text to be processed is now "q, d2, [M]". The document processing model outputs a relevance probability of 0.7 at the corresponding mask marker position. Finally, document d3 is processed, and the text to be processed is now "q, d3, [M]". The document processing model outputs a relevance probability of 0.6 at the corresponding mask marker position. After the loop, the relevance prediction results for candidate documents d1, d2, and d3 are 0.9, 0.7, and 0.6, respectively.
[0084] The data processing method provided in the embodiments of this specification, under the point-to-point re-sorting strategy, realizes the independent evaluation of the relevance between each candidate document and the query statement text. This document-by-document processing method ensures that the relevance evaluation of each candidate document is not interfered with by other documents, providing data support for accurate and reliable document sorting.
[0085] In one or more embodiments of this specification, the first relevance strategy includes a list reordering strategy. Under the list reordering strategy, the document processing model can obtain similarity prediction results corresponding to at least two mask tags through a single forward computation. This not only improves computational efficiency but also allows for direct comparison under a unified benchmark since all relevance scores are calculated in the same semantic space. Specific implementation methods are described below: The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: Input the text to be processed, the list reordering strategy, and the first prompt text into the document processing model; Based on the document processing model, in one forward computation, the relevance between the query text and the at least two candidate documents is calculated to obtain similarity prediction results corresponding to at least two mask tags.
[0086] The list reordering strategy can be understood as evaluating the relevance of all candidate documents to the query text in parallel through a single model inference, thus considering the sorting method of at least two candidate documents simultaneously; a single forward computation can be understood as the document processing model completing the relevance calculation of all candidate documents in a complete input-to-output propagation process without loops or iterations, thereby fully utilizing the parallel processing capability of the document processing model.
[0087] For example, when a list reordering strategy is adopted, the relevance of at least two candidate texts to the query text can be evaluated simultaneously. Therefore, when the query text q, at least two candidate documents (e.g., d1-dN), and at least two mask tags are concatenated and organized into the text to be processed, the text to be processed can be obtained as q, d1, d2, d3…dN, [M], [M], [M]…[M], where the number of terms in the at least two mask tags is consistent with the number of documents in the at least two candidate documents.
[0088] The text to be processed, containing all candidate documents and their mask tags, along with the list reordering strategy and the corresponding first prompt text, is input into the document processing model. The document processing model utilizes its bidirectional attention mechanism to simultaneously process the interaction information between the query text and all candidate documents in a single forward computation, outputting the relevant prediction results for each mask tag position in parallel, thus obtaining the similarity prediction results for all candidate documents at once.
[0089] In practical applications, when a list reordering strategy is adopted and the text to be processed is q, d1, d2, d3…dN, [M], [M], [M]…[M], the output format of the constrained document processing model is d1: [M], d2: [M], d3: [M]…dN: [M]. Then, when the document processing model obtains the logical values of all mask tags through a single forward computation, the relevance score (i.e., the relevance prediction result) of each candidate document can be obtained. During a single forward computation, candidate documents can interact with each other, ensuring that all relevance scores are generated within the same semantic space, allowing for direct comparison of relevance scores.
[0090] The data processing method provided in the embodiments of this specification achieves efficient parallel computation for evaluating the relevance of multiple candidate documents by combining a list reordering strategy with single forward computation, avoiding time delays caused by loop processing and significantly improving the processing efficiency of reordering.
[0091] In one or more embodiments of this specification, when employing a first relevance strategy, relevance prediction results for each mask marker are obtained, and at least two candidate documents are ranked based on these relevance prediction results to obtain a text ranking result. Specific implementation methods are described below: The document ranking results of the at least two candidate documents are obtained based on the prediction results of each mask, including: The at least two candidate documents are sorted according to the similarity prediction results to obtain the document sorting result.
[0092] The document sorting result can be understood as an ordered list of documents formed after sorting operations, reflecting the degree of relevance between candidate documents and the query text.
[0093] For example, if the similarity prediction results reflect the degree of relevance between each candidate document and the query text, the similarity prediction results (i.e., relevance scores) corresponding to all candidate documents are collected, and then at least two candidate documents are arranged in order of relevance scores from high to low (or from low to high) to generate the final document ranking results.
[0094] For example, given the query text q, three candidate documents A, B, and C are obtained. Through a point-to-point reordering strategy or a list reordering strategy, the document processing model obtains similarity prediction results of 0.9, 0.7, and 0.8 for the three candidate documents A, B, and C, respectively. Based on these similarity prediction results, the three candidate documents A, B, and C are sorted in descending order to obtain the document ranking result ACB.
[0095] The data processing method provided in the embodiments of this specification can accurately rank at least two candidate documents through quantified similarity prediction results, generating text ranking results that are easy to understand and use.
[0096] In one or more embodiments of this specification, under the second ranking strategy, the ranking prediction of each candidate document is achieved by predicting the target prediction document corresponding to each mask marker. Specific implementation methods are described below: The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: When the sorting strategy is the second arrangement strategy, the text to be processed, the second arrangement strategy, and the second prompt document are input into the document processing model to obtain the target predicted document corresponding to each mask mark, wherein at least two mask marks in the text to be processed are arranged into a mask mark sequence.
[0097] The second permutation strategy can be understood as a ranking strategy that directly generates the complete document order (i.e., the document ranking result). This typically includes sequence generation strategies based on constrained sampling or assignment problems (such as the Hungarian algorithm). The mask marker sequence can be understood as a continuous sequence formed by arranging multiple mask markers, used to guide the document processing model to predict the target predicted document corresponding to each mask marker, generating the sequential document ranking result. The target predicted document can be understood as the specific document identifier predicted by the document processing model at each mask marker position; the prediction results at all mask marker positions together constitute a complete document ranking result.
[0098] For example, when the second permutation strategy is adopted, the text to be processed, containing the masked marker sequence, the second permutation strategy, and the corresponding second prompt text are input into the document processing model. Guided by the second prompt text (e.g., "Given a query text and multiple candidate documents indicated by document identifiers, the candidate documents should be sorted from high to low relevance to the query text. Specifically, the sorting result of the document identifiers should be output, arranged from high to low relevance, with each document identifier separated by a space"), the document processing model, through its diffusion denoising and sequence generation capabilities, predicts the document identifier that should be filled in at each masked marker position in the masked marker sequence in one or more iterations, and finally outputs the target predicted document corresponding to all masked marker positions.
[0099] In practical applications, when using the second permutation strategy, the query text q, N candidate documents (e.g., d1-dN, where N is greater than or equal to 2), and N mask markers are concatenated to form the text to be processed: q, d1, d2, d3…dN, [M1], [M2], [M3]…[MN]. In this case, “[M1], [M2], [M3]…[MN]” in the text to be processed is the mask marker sequence. The number of mask markers in the mask marker sequence is the same as the number of candidate documents, which is N.
[0100] The document processing model is constrained to predict at the mask marker positions in the mask marker sequence. For example, the output format of the document processing model is constrained to be [M1], [M2], [M3]...[MN], so that the document processing model predicts which candidate document each mask marker position is most likely to correspond to. In the embodiments of this specification, the mask markers are denoised by iterative denoising or global matching, and the document identifiers corresponding to the mask markers are predicted. For example, the document processing model may predict that the mask marker position [M1] corresponds to candidate document d2, [M2] corresponds to candidate document d1, [M3] corresponds to candidate document d4, and so on. At this time, the mask prediction result at each mask marker position is the target predicted document corresponding to it. According to the order of the mask marker sequence, the document arrangement order of N candidate documents can be determined.
[0101] The data processing method provided in the embodiments of this specification uses a masked label sequence to guide the document processing model to directly generate complete text sorting results under the second sorting strategy. Compared with the first relevant strategy of "scoring-sorting" two-stage processing, the end-to-end sequence generation can efficiently generate document sorting results and significantly improve the inference efficiency of document re-sorting.
[0102] In one or more embodiments of this specification, the second sorting strategy includes a sorting strategy based on restricted sampling. Under the sorting strategy based on restricted sampling, each candidate document can be constrained to be determined as a target prediction document once, and each mask marker corresponds to one target prediction document, thus avoiding duplicate candidate documents or omissions in the generated text sorting results. Specific implementation methods are as follows: The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: The text to be processed, the arrangement strategy based on restricted sampling, and the second prompt text are input into the document processing model; Based on the document processing model, in each denoising time step, the prediction confidence of each mask tag for each candidate document is obtained, and a target prediction document is assigned to the target mask tag based on the prediction confidence of each candidate document, until the target prediction document corresponding to each mask tag is obtained. Each candidate document is determined as a target prediction document once, and each mask tag corresponds to a target prediction document.
[0103] The constrained sampling-based permutation strategy can be understood as an iterative denoising sequence generation method. Specifically, in each denoising step of the document processing model, document identifiers are assigned to the mask tags based on the model's predicted probability distribution, combined with constraint mechanisms (such as greedy matching). A denoising time step can be understood as an iterative cycle in which the document processing model gradually recovers from a noisy state. In each denoising time step, the document processing model predicts a clearer document permutation order based on the current state.
[0104] Prediction confidence can be understood as the probability value that the document processing model predicts for each candidate document as the correct filler for the mask marker. It reflects the document processing model's grasp of the degree of matching of each candidate document at the mask marker position. The target mask marker can be understood as the mask marker that is selected and prepared to be assigned a specific document identifier in the current denoising time step. The process of assigning the target prediction document is to uniquely assign a candidate document to a target mask marker as its target prediction document according to the constraint mechanism.
[0105] For example, upon receiving the text to be processed, a permutation strategy based on restricted sampling, and a second prompt text, the document processing model performs multiple rounds of iterative denoising on the masked marker sequence of the full mask. At each denoising time step, the document processing model predicts the prediction confidence of each candidate document at the masked marker position in parallel. Using constraint mechanisms such as greedy matching, and ensuring that each candidate document is assigned only once and each masked marker position receives only one candidate document, the model assigns the most matching candidate document to the masked marker position with the highest prediction confidence, based on the prediction confidence level. It should be noted that the assigned masked marker positions are fixed in subsequent iterations and will no longer participate in model prediction, while unassigned masked marker positions retain their masks for the next round of denoising. Through iterative iteration, all masked markers obtain a unique and non-repeating target predicted document.
[0106] For example, candidate documents include d1, d2, and d3, and the mask label sequence is [M1, M2, M3]. In the first denoising time step, the document processing model predicts the confidence scores of the three candidate documents at position M1 as 0.7 (d2), 0.2 (d1), and 0.1 (d3); the confidence scores of the three candidate documents at position M2 as 0.8 (d1), 0.1 (d3), and 0.1 (d2); and the confidence scores of the three candidate documents at position M3 as 0.75 (d3), 0.15 (d1), and 0.1 (d2). Using a greedy matching algorithm, d1 (with a prediction confidence score of 0.8 for M2 on d1) with the highest current prediction confidence is assigned to M2.
[0107] In the second denoising time step, the document processing model predicts the remaining mask markers M1 and M3. For example, M1 has a prediction confidence of 0.75 for d2 and 0.25 for d3; M3 has a prediction confidence of 0.1 for d2 and 0.9 for d3. At this point, according to greedy matching, d3 with the highest prediction confidence (M3's prediction confidence for d3 is 0.9) is assigned to M3, and the remaining d2 is automatically assigned to M1. After multiple iterations, the final target predicted documents corresponding to each mask marker are M1-d2, M2-d1, and M3-d3.
[0108] The data processing method provided in the embodiments of this specification adds generation constraints to the iterative denoising process of the document processing model through a restricted sampling arrangement strategy, ensuring that each candidate document is assigned only once and that each mask mark position receives only one candidate document, thereby effectively avoiding the problem of duplicate allocation or omission of candidate documents and ensuring the rationality of document sorting.
[0109] In one or more embodiments of this specification, in each denoising time step, a target prediction document is assigned to the target mask marker, and the remaining unassigned mask markers and candidate documents are determined as mask markers to be processed and candidate documents to be processed. This fixes the target mask markers and their corresponding target prediction documents in the next denoising time step, and predictions are performed on the mask markers to be processed and candidate documents to be processed, avoiding the problem of duplicate allocation or omission of candidate documents. Specific implementation methods are described below: Based on the prediction confidence of each candidate document, target prediction documents are assigned to target mask tags until the target prediction documents corresponding to each mask tag are obtained, including: Based on the prediction confidence of each candidate document, a target prediction document is assigned to the target mask label, wherein the target mask label is a mask label with a prediction confidence higher than a preset threshold, and the target prediction document is the candidate document with the highest prediction confidence corresponding to the target mask label; The candidate documents other than the target predicted document among the at least two candidate documents are determined as candidate documents to be processed, and the mask tags other than the target mask tags among the at least two mask tags are determined as mask tags to be processed. Obtain the prediction confidence of each mask tag to be processed for each candidate document to be processed, and assign a target prediction document to the target mask tag based on the prediction confidence of each candidate document to be processed; Continue executing the steps of determining candidate documents other than the target predicted document from the at least two candidate documents as candidate documents to be processed, and determining mask tags other than the target mask tag from the at least two mask tags as mask tags to be processed, until the target predicted document corresponding to each mask tag is obtained.
[0110] The preset threshold can be understood as a pre-defined confidence boundary used to determine whether the prediction result corresponding to the mask marker is reliable enough to be adopted. Prediction confidence scores higher than the prediction threshold can be considered high prediction confidence scores, and the corresponding candidate documents can be identified as target prediction documents. Candidate documents to be processed can be understood as the remaining candidate documents that have not yet been assigned to any mask marker position; mask markers to be processed can be understood as the remaining mask markers that have not yet been assigned to specific candidate documents.
[0111] For example, at each denoising time step, the document processing model predicts the prediction confidence of each candidate document at the mask marker position in parallel. From the current mask marker position, mask markers with a prediction confidence of a certain candidate document higher than a preset threshold are selected as target mask markers, and the candidate document with the highest prediction confidence is selected as the target predicted document of the target mask marker. Subsequently, the assigned candidate documents and mask markers are removed from at least two candidate documents and at least two mask markers to obtain the remaining candidate documents and mask markers to be processed.
[0112] In the next denoising time step, the document processing model recalculates the prediction confidence of the mask markers for the candidate documents to be processed and repeats the above assignment process. That is, it selects mask markers with a prediction confidence of a certain candidate document higher than a preset threshold as target mask markers, and selects the candidate document with the highest prediction confidence as the target predicted document of the target mask marker. This process is iterated until all mask markers are assigned unique and non-repeating target predicted documents.
[0113] Continuing with the previous example, the candidate documents include d1, d2, and d3, and the mask label sequence is [M1, M2, M3]. If the preset threshold is set to 0.7, in the first denoising time step, the document processing model predicts the following confidence levels for the three candidate documents at position M1: 0.7 (d2), 0.2 (d1), and 0.1 (d3); for position M2: 0.8 (d1), 0.1 (d3), and 0.1 (d2); and for position M3: 0.75 (d3), 0.15 (d1), and 0.1 (d2). Since both M2 and M3 have candidate documents with prediction confidence levels higher than the preset threshold, M2 and M3 are determined as target mask labels. The document with the highest prediction confidence for M2 (d1) is taken as its corresponding target predicted document, and the document with the highest prediction confidence for M3 (d3) is taken as its corresponding target predicted document.
[0114] In the second denoising time step, the document processing model predicts the remaining mask markers M1 to be processed. Since d1 and d3 have already been assigned, the candidate document to be processed is d2. The prediction confidence of M1 for d2 is calculated. In practical applications, the remaining d2 can be automatically assigned to M1. After multiple iterations, the target predicted documents corresponding to each mask marker are finally obtained as M1-d2, M2-d1, and M3-d3.
[0115] The data processing method provided in the embodiments of this specification introduces a confidence threshold to prioritize the determination of candidate documents with high prediction confidence during the iterative denoising process. Furthermore, by fixing the target mask mark and target prediction document of the current round, the amount of data to be calculated in the next round is reduced, while ensuring that the allocation process meets the constraint mechanism, thereby achieving efficient and reliable generation of complete document sequence results.
[0116] In one or more embodiments of this specification, the second sorting strategy includes an allocation-based sorting strategy; specifically, the document reordering task is regarded as a bipartite graph allocation task, thereby achieving global optimization of document sorting and avoiding the accumulation of errors that may be caused by iterative generation. Specific implementation methods are as follows: The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: The text to be processed, the allocation-based arrangement strategy, and the second prompt document are input into the document processing model; Based on the document processing model, construct the cost matrix of the at least two candidate documents and their corresponding mask tags; The cost matrix is calculated using a target algorithm to determine the target prediction document corresponding to each mask marker.
[0117] Among them, the allocation-based permutation strategy can be understood as a strategy that transforms the document sorting task into a bipartite graph allocation problem. It usually uses combinatorial optimization algorithms (such as the Hungarian algorithm) to solve for the globally optimal permutation. The cost matrix can be understood as a two-dimensional matrix, where the rows and columns (or columns and rows) correspond to candidate documents and mask marker positions, respectively. Each element value in the matrix represents the cost of assigning a specific candidate document to a specific mask marker position (represented by the negative log-likelihood value). The cost reflects the irrationality or cost of the allocation. The process of solving for the optimal permutation is the process of determining the allocation with the smaller cost.
[0118] The objective algorithm can be understood as an algorithm for solving the optimal allocation problem, such as the Hungarian algorithm, which can find the globally optimal permutation with the maximum total log-likelihood (minimum cost) in polynomial time.
[0119] For example, after the document processing model receives the text to be processed, the allocation-based permutation strategy, and the second prompt text, it utilizes parallel prediction capabilities to calculate an allocation cost for each candidate document-mask marker position pair, typically represented by a negative log-likelihood value. The costs of all candidate document-mask marker position pairs constitute a cost matrix. By invoking objective algorithms such as the Hungarian algorithm, this cost matrix is globally optimized to find a set of one-to-one matching candidate document-mask marker positions where the total cost of all matches is minimized, thereby determining the target predicted document assigned to each mask marker position.
[0120] For example, given candidate documents d1, d2, and d3, they need to be assigned to three mask marker positions M1, M2, and M3 (in order). The cost matrix constructed by the document processing model can be: (smaller values indicate more reasonable allocation) |--| d1| d2| d3| |M1|0.2|1.5|0.8| |M2|1.0|0.3|1.2| |M3|0.9|1.1|0.4| The Hungarian algorithm is used to find the matching scheme with the minimum total cost: d1-M1, d2-M2, d3-M3.
[0121] The data processing method provided in the embodiments of this specification combines parallel prediction and combinatorial optimization algorithms of the document processing model, models the reordering task as a global optimal allocation problem, realizes a global, one-time optimal solution for document arrangement, avoids the accumulation of errors that may be caused by iterative generation, and can maintain high computational efficiency and sorting accuracy when processing a large number of candidate documents.
[0122] In one or more embodiments of this specification, when a corresponding target predicted document is determined for each mask mark in the mask mark sequence, the document identifier of the corresponding target predicted document is replaced with the mask mark to obtain a document ranking result for multiple candidate documents. Specific implementation methods are as follows: The document ranking results of the at least two candidate documents are obtained based on the prediction results of each mask, including: By replacing the corresponding mask markers with the document identifiers of the target predicted documents corresponding to each mask marker, the document ranking results of the at least two candidate documents are obtained.
[0123] Replacement can be understood as the process of replacing the original mask marker (such as [M]) with its corresponding document identifier of the target predicted document in the mask marker sequence.
[0124] For example, after a unique target predicted document is determined for each mask mark in the mask mark sequence, the placeholder [M] at each mask mark position is replaced with the document identifier of the target predicted document assigned to that position. After the replacement is completed, the original sequence containing mask marks is transformed into a list of document identifiers arranged in order, which represents the ranking of candidate documents from most relevant to least relevant.
[0125] For example, if the masked label sequence is "[M1], [M2], [M3]", after the document processing model predicts and assigns, it is determined that M1 corresponds to candidate document d2, M2 corresponds to candidate document d1, and M3 corresponds to candidate document d3. By performing a replacement operation, the masked label sequence is transformed into "d2, d1, d3", which is the document sorting result.
[0126] It should be noted that in language interaction scenarios, after obtaining the document sorting results, the document sorting results can be sent to the language processing model used to generate the response, so that the language processing model can reasonably generate the response corresponding to the query text based on the document sorting results.
[0127] The data processing method provided in the embodiments of this specification efficiently completes the output loop of the re-ranking task by replacing the mask marker with the document identifier of the target predicted document. The generated document ranking results have a clear order and can be directly applied to downstream tasks such as search result display and recommendation list generation, thereby improving the practicality and user experience of the document processing model.
[0128] This specification also provides a data processing method, including: In response to a document sorting request sent by a client, the system obtains the query text, at least two candidate documents, and a sorting strategy for the candidate documents, and determines the target prompt text based on the sorting strategy. The text to be processed is generated based on the query text, the at least two candidate documents, and the mask markers of each candidate document; The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker. Based on each mask prediction result, the document sorting results of the at least two candidate documents are obtained, and the document sorting results are returned to the client.
[0129] For example, a user can send a document sorting request through a client. This request may include not only the query text and at least two candidate documents related to the query text, but also a sorting strategy selected by the user for ranking the candidate documents. After obtaining the document sorting result based on the above data processing method, the document sorting result is returned to the client so that the user can view the document sorting results of at least two candidate documents through the client.
[0130] For specific implementation methods, please refer to the above embodiments, which will not be repeated here.
[0131] See Figure 3 , Figure 3 A flowchart of a model training method provided in one embodiment of this specification is shown; specifically, it includes the following steps.
[0132] Step 302: Obtain the query statement text, at least two candidate documents, the arrangement identifiers of the at least two candidate documents, and the sorting strategy, and determine the target prompt text according to the sorting strategy.
[0133] Step 304: Mask the target arrangement identifier of the target candidate document among the at least two candidate documents to obtain the mask mark of the target candidate document.
[0134] Step 306: Generate the text to be processed based on the query text, the at least two candidate documents, the arrangement identifier of each candidate document, and the mask mark of the target candidate document.
[0135] Step 308: Input the text to be processed, the sorting strategy, and the target prompt text into the data processing model to obtain the mask prediction result corresponding to the mask marker.
[0136] Step 310: Based on the mask prediction result and the target arrangement identifier, train the data processing model to obtain the document processing model.
[0137] For example, the query text, at least two candidate documents, the permutation identifier for each candidate document (such as an identifier representing the relative order of the candidate documents), and the sorting strategy specified for this training are obtained. Based on the sorting strategy, the corresponding target prompt text is determined to guide the data processing model to perform a specific type of sorting task.
[0138] In practice, a target candidate document is selected from the candidate documents, and its corresponding target permutation identifier is masked to generate a mask marker. The query text, multiple candidate documents, and the permutation identifiers of each candidate document (including the masked mask markers) are concatenated into a unified text to be processed. In effect, by randomly masking the permutation identifiers of some candidate documents, the data processing model learns to recover the mask markers using bidirectional context (query text and other candidate documents) given partial permutation identifiers, thereby enhancing its ability to model permutation structures.
[0139] The constructed text to be processed, the sorting strategy, and the target hint text are input together into the data processing model to be trained. The data processing model predicts the mask markers and outputs the mask prediction results. Based on the mask prediction results and the target arrangement indicators before the mask, the loss of the data processing model is calculated, and the model parameters are adjusted according to the calculated loss value to obtain the document processing model.
[0140] In the embodiments of this specification, list distillation loss (such as RankNet or list cross-entropy loss) is introduced to transfer the ranking knowledge of the high-performance teacher model to the document processing model, enabling the document processing model to master the ranking knowledge based on document-level interaction.
[0141] The model training method provided in the embodiments of this specification, through the collaborative training of masked arrangement identifiers and list distillation loss, enables the document processing model to not only learn to recover the position of individual documents, but also to acquire sorting knowledge between documents, thus making it better applicable to document reordering tasks.
[0142] See Figure 4 , Figure 4 This diagram illustrates the processing steps of a sorting strategy in a data processing method provided in one embodiment of this specification.
[0143] The system receives a user query q (i.e., the query text) and a candidate document set D (containing at least two candidate documents). It then performs a structured concatenation of the query q and the candidate documents according to the concatenation method corresponding to the sorting strategy, and inserts the corresponding mask token to form the text to be processed. The text to be processed is then encoded and converted into a tensor format that meets the input requirements of the diffusion language model (i.e., the document processing model).
[0144] In practice, users can choose different sorting strategies based on the trade-off between efficiency and accuracy required in their specific scenarios. If processing efficiency is the priority, a logical value-based reordering strategy (including point-to-point reordering and logical value-based list reordering) can be selected. The logical value-based reordering strategy relies on the bidirectional attention mechanism of the diffusion language model to extract the logical values of all masked positions, obtain the relevance scores of each candidate document, and then sort the documents according to the relevance scores to output the document sorting results. It is suitable for scenarios with high real-time requirements and a large number of candidate documents.
[0145] In specific implementation, when selecting a point-to-point reordering strategy, an input prompt is constructed separately for each candidate document. The query text is concatenated with a single candidate document, and a mask token is added to the end of the candidate document. Specifically, the first prompt text is constructed as "Determine whether each candidate document is related to the query text. The relevance score is between 0 (irrelevant) and 1 (relevant)," and the text to be processed is determined as "q, di, [M]", where q is the query text, di represents the i-th candidate document, and [M] is the mask token. A mask token is added to the end of the candidate document. Through single-step denoising, the logical values of tokens "1" (relevant) and "0" (irrelevant) at the mask position are predicted. The relevance probability s(q, d_i) = p_1 / (p_0+p_1) is calculated using softmax, where s(q, d_i) represents the relevance score between q and di, p_1 is the probability that di is related to q, and p_0 is the probability that di is not related to q. By ranking multiple candidate documents according to their relevance scores, this strategy enables the diffusion language model to act as a bidirectional cross-encoder, focusing on deep semantic matching between the query text and the candidate documents.
[0146] When selecting a list reordering strategy based on logical values (i.e., the list reordering strategy in the first relevance strategy in the above embodiment), the first prompt text is also constructed as "Determine whether each candidate document is relevant to the query text. The relevance score is between 0 (irrelevant) and 1 (relevant)". With the logical values of multiple candidate documents predicted in parallel, the text to be processed is determined to be "q, d1, d2, ..., dN, [M1], [M2]...[MN]". Utilizing the bidirectional attention mechanism of the diffusion language model, the logical values of all masked tags are obtained in a single forward computation, and the relevance score is determined by the logical values. When multiple candidate documents (d1, d2, ..., dN) are input into the diffusion language model simultaneously, the candidate documents can then interact with each other, allowing for direct comparison of relevance scores within the same semantic space.
[0147] If users prioritize sorting accuracy, they can choose list reordering strategies based on permutations and combinations (including permutation strategies based on constrained sampling and permutation strategies based on allocation). When using a permutation strategy based on constrained sampling, document position allocation is determined progressively through multiple rounds of denoising, and the validity of the sequence is ensured in each round through a greedy matching constraint mechanism. When using a permutation strategy based on allocation, the sorting problem is modeled as a bipartite graph matching problem. Specifically, a cost matrix is constructed, and the Hungarian algorithm is used to solve for the optimal permutation in one go, outputting the document sorting result. Both methods directly generate complete document sorting results, avoiding biases that may be introduced by intermediate scoring.
[0148] In specific implementation, when choosing a sorting strategy based on constrained sampling, a second prompt text is constructed: "Given a query text and multiple candidate documents indicated by document identifiers, the candidate documents need to be sorted from high to low relevance to the query text. Specifically, the sorting result of the document identifiers should be output, arranged from high to low relevance, with each document identifier separated by a space." The text to be processed is determined as "q, d1, d2, ..., dN, [M1], [M2]...[MN]". The constrained diffusion language model performs document prediction on the full mask response sequence (i.e., the mask label sequence) r=[M1,M2,...,MN]. At each denoising time step t, the diffusion language model predicts all masked candidate documents (specifically, predicts the document identifiers of the candidate documents). To prevent duplication, a greedy matching constraint mechanism is adopted to ensure that each document identifier is assigned to only one mask label position in the current step, and each mask label position accepts only one document identifier.
[0149] Specifically, candidate documents and mask marker positions already assigned in the current denoising time step will be removed in the next denoising time step. Then, in the next denoising time step, prediction will be made for the remaining unassigned candidate documents and mask marker positions. That is, in the embodiments of this specification, to address the randomness of the diffusion language model, a greedy matching mechanism that dynamically updates the candidate pool ensures that the arrangement of documents generated during the multi-step denoising process always satisfies the uniqueness constraint. For example... Figure 4 In example 3), at the denoising time step t=1, predictions are made for the four mask markers to obtain the denoised B, [M], A, [M]; at the denoising time step t=2, predictions are made for the remaining two mask markers to obtain the document sorting results, B, C, A, D.
[0150] When choosing an assignment-based permutation strategy, a second prompt text is constructed: "Given a query text and multiple candidate documents indicated by document identifiers, the candidate documents should be sorted from highest to lowest relevance to the query text. Specifically, the sorting results of the document identifiers should be output, arranged from highest to lowest relevance, with each document identifier separated by a space." The text to be processed is determined as "q, d1, d2, ..., dN, [M1], [M2]...[MN]". The constrained diffusion language model performs document prediction on the fully masked response sequence (i.e., the masked label sequence) r=[M1,M2,...,MN].
[0151] In practical applications, when choosing an assignment-based permutation strategy, the sorting problem is treated as a bipartite graph matching problem, constructing a cost matrix C_{i,j}=-log P({position}i={d}j), where C_{i,j} represents the cost, specifically the cost corresponding to candidate document j at position i; P({position}i={d}j) represents the probability that candidate document j appears at the i-th masked position in the output sequence. Figure 4 In the example of (4), we construct a cost matrix for candidate documents A, B, C, and D, and positions 1, 2, 3, 4, where 1, 2, 3, 4 represent the sequential positions of the mask markers in the mask marker sequence. Using the Hungarian algorithm, we find the globally optimal permutation with the maximum total log-likelihood (minimum cost) in polynomial time, thus obtaining the document ranking result.
[0152] It should be noted that during the model training phase, the embodiments in this specification design a fine-grained mask training strategy to guide the document processing model to specifically learn the ordering dependencies and structural relationships between documents, rather than learning general language modeling, so that the document processing model can more accurately capture the inherent logic of the reordering task.
[0153] This specification provides various sorting strategies to achieve a dynamic balance between efficiency and accuracy in document reordering tasks. Specific point-to-point reordering strategies offer refined evaluation, logical value-based list reordering strategies ensure efficient parallel processing, and permutation-based list reordering strategies pursue globally optimal structured output. Users can flexibly select or combine suitable strategies according to their application needs, thereby achieving diverse and high-performance document reordering tasks within a unified diffusion language model framework.
[0154] The data processing method provided in the embodiments of this specification systematically constructs a technical route for document re-ranking that replaces the traditional autoregressive model with a diffusion language model. This completely overcomes the generation latency problem. Specifically, through the parallel decoding characteristics of the diffusion language model, the logistic value-based method can obtain the full score in a single forward propagation. Even with a multi-step permutation generation strategy, by setting a small number of denoising steps K (usually K<5), its latency is far lower than the latency of the autoregressive model's token-by-token generation. Furthermore, the diffusion language model can effectively eliminate error accumulation. During the generation process, the prediction of each mask marker position in the diffusion language model can be based on the global context and has the ability to dynamically "modify," meaning that subsequent denoising steps can correct the prediction bias of previous steps, thereby avoiding the problem of error propagation and irreversibility caused by early mislabeling in the autoregressive model. By introducing the Hungarian algorithm and a restricted sampling strategy, common problems such as duplication and omission in document re-ranking are eliminated from the algorithm's underlying layer, eliminating the need for redundant retry mechanisms.
[0155] By adjusting the number of denoising steps K and selecting different reordering strategies (point-to-point or list-based), the system enables users to flexibly configure retrieval efficiency and reordering effects according to actual scenarios within a unified model framework, greatly enhancing practicality and adaptability.
[0156] This specification also provides a data processing system based on a data processing method. This system includes the following functional modules: an input processing module that concatenates the query text (q) and a set of candidate documents (d) according to the concatenation method corresponding to the sorting strategy, generating the text to be processed in a diffusion language model; a diffusion denoising engine that, based on the diffusion language model architecture, predicts probability distributions in parallel at mask marker positions; a reordering strategy execution module that executes Pointwise, Logits-based Listwise, or Permutation-based Listwise strategies according to different application requirements; and a constraint optimization module (used when selecting a permutation-based list reordering strategy), which includes a restricted sampling strategy and the Hungarian algorithm to ensure that the generated permutation results are valid (no duplicates, no omissions). Specific implementation methods can be found in the above embodiments and will not be repeated here.
[0157] Corresponding to the above method embodiments, this specification also provides data processing apparatus embodiments. Figure 5 A schematic diagram of the structure of a data processing apparatus according to one embodiment of this specification is shown. Figure 5 As shown, the device includes: The acquisition module 502 is configured to acquire the query statement text, at least two candidate documents, and a sorting strategy for the candidate documents, determine the target prompt text according to the sorting strategy, and determine the mask marker for each candidate document. The generation module 504 is configured to generate text to be processed based on the query statement text, the at least two candidate documents, and the mask markers of each candidate document; The sorting module 506 is configured to input the text to be processed, the sorting strategy, and the target prompt text into the document processing model to obtain the mask prediction results corresponding to each mask marker, and to obtain the document sorting results of the at least two candidate documents based on each mask prediction result.
[0158] Optionally, the acquisition module 502 is further configured to: Based on the first relevance strategy, construct a first prompt text for calculating relevance; Based on the second arrangement strategy, construct a second prompt text for document arrangement.
[0159] Optionally, the sorting module 506 is further configured to: When the sorting strategy is the first relevance strategy, the text to be processed, the first relevance strategy, and the first prompt text are input into the document processing model; Based on the document processing model, the correlation between the query text and each candidate document is calculated to obtain the correlation prediction results corresponding to each mask tag.
[0160] Optionally, the generation module 504 is further configured to: For any one of the at least two candidate documents, the query text, the candidate document, and the mask mark of the candidate document are concatenated to obtain the text to be processed corresponding to each candidate document.
[0161] Optionally, the sorting module 506 is further configured to: The text to be processed corresponding to each candidate document, the point-to-point reordering strategy, and the first prompt text input document processing model; The correlation between the query semantic document and the target candidate document is calculated based on the document processing model to obtain the correlation prediction result of the mask tag corresponding to the target candidate document, wherein the target candidate document is determined from the at least two candidate documents; Continue executing the steps of calculating the relevance between the query semantic document and the target candidate document based on the document processing model, and obtaining the relevance prediction results of the mask tags corresponding to the target candidate documents, until the relevance prediction results of the mask tags corresponding to each candidate document are obtained.
[0162] Optionally, the sorting module 506 is further configured to: Input the text to be processed, the list reordering strategy, and the first prompt text into the document processing model; Based on the document processing model, in one forward computation, the relevance between the query text and the at least two candidate documents is calculated to obtain the relevance prediction results corresponding to at least two mask tags.
[0163] Optionally, the sorting module 506 is further configured to: The at least two candidate documents are sorted according to the relevant prediction results to obtain the document sorting result.
[0164] Optionally, the sorting module 506 is further configured to: When the sorting strategy is the second arrangement strategy, the text to be processed, the second arrangement strategy, and the second prompt text are input into the document processing model to obtain the target predicted document corresponding to each mask mark, wherein at least two mask marks in the text to be processed are arranged into a mask mark sequence.
[0165] Optionally, the sorting module 506 is further configured to: The text to be processed, the arrangement strategy based on restricted sampling, and the second prompt text are input into the document processing model; Based on the document processing model, in each denoising time step, the prediction confidence of each mask tag for each candidate document is obtained, and a target prediction document is assigned to the target mask tag based on the prediction confidence of each candidate document, until the target prediction document corresponding to each mask tag is obtained. Each candidate document is determined as a target prediction document once, and each mask tag corresponds to a target prediction document.
[0166] Optionally, the sorting module 506 is further configured to: Based on the prediction confidence of each candidate document, a target prediction document is assigned to the target mask label, wherein the target mask label is a mask label with a prediction confidence higher than a preset threshold, and the target prediction document is the candidate document with the highest prediction confidence corresponding to the target mask label; The candidate documents other than the target predicted document among the at least two candidate documents are determined as candidate documents to be processed, and the mask tags other than the target mask tags among the at least two mask tags are determined as mask tags to be processed. Obtain the prediction confidence of each mask tag to be processed for each candidate document to be processed, and assign a target prediction document to the target mask tag based on the prediction confidence of each candidate document to be processed; Continue executing the steps of determining candidate documents other than the target predicted document from the at least two candidate documents as candidate documents to be processed, and determining mask tags other than the target mask tag from the at least two mask tags as mask tags to be processed, until the target predicted document corresponding to each mask tag is obtained.
[0167] Optionally, the sorting module 506 is further configured to: The text to be processed, the allocation-based arrangement strategy, and the second prompt text are input into the document processing model; Based on the document processing model, construct the cost matrix of the at least two candidate documents and their corresponding mask tags; The cost matrix is calculated using a target algorithm to determine the target prediction document corresponding to each mask marker.
[0168] Optionally, the sorting module 506 is further configured to: By replacing the corresponding mask markers with the document identifiers of the target predicted documents corresponding to each mask marker, the document ranking results of the at least two candidate documents are obtained.
[0169] Optionally, the acquisition module 502 is further configured to: Based on the query text, at least two candidate documents are retrieved from the initial document set, or at least two candidate documents are obtained from a preset knowledge base.
[0170] The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing apparatus and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the data processing apparatus, please refer to the description of the technical solution of the data processing method described above.
[0171] Corresponding to the above method embodiments, this specification also provides another data processing apparatus embodiment, which includes: The response module is configured to respond to a document sorting request sent by a client, obtain the query text, at least two candidate documents and a sorting strategy for the candidate documents, and determine the target prompt text based on the sorting strategy. The generation module is configured to generate text to be processed based on the query text, the at least two candidate documents, and the mask markers of each candidate document; The acquisition module is configured to input the text to be processed, the sorting strategy, and the target prompt text into the document processing model, obtain the mask prediction results corresponding to each mask marker, obtain the document sorting results of the at least two candidate documents based on each mask prediction result, and return the document sorting results to the client.
[0172] The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing apparatus and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the data processing apparatus, please refer to the description of the technical solution of the data processing method described above.
[0173] Corresponding to the above method embodiments, this specification also provides embodiments of a model training device. Figure 6 A schematic diagram of a model training apparatus provided in one embodiment of this specification is shown. Figure 6 As shown, the device includes: The acquisition module 602 is configured to acquire the query statement text, at least two candidate documents, the arrangement identifiers of the at least two candidate documents, and a sorting strategy, and determine the target prompt text according to the sorting strategy; The masking module 604 is configured to perform masking processing on the target arrangement identifier of the target candidate document among the at least two candidate documents to obtain the mask mark of the target candidate document; The generation module 606 is configured to generate text to be processed based on the query statement text, the at least two candidate documents, the arrangement identifier of each candidate document, and the mask marker of the target candidate document; Prediction module 608 is configured to input the text to be processed, the sorting strategy and the target prompt text into a data processing model to obtain the mask prediction result corresponding to the mask mark; The training module 610 is configured to train the data processing model based on the mask prediction result and the target arrangement identifier to obtain the document processing model.
[0174] The above is an illustrative scheme of a model training device according to this embodiment. It should be noted that the technical solution of this model training device and the technical solution of the model training method described above belong to the same concept. For details not described in detail in the technical solution of the model training device, please refer to the description of the technical solution of the model training method described above.
[0175] Figure 7 A structural block diagram of a computing device 700 according to one embodiment of this specification is shown. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and a database 750 is used to store data.
[0176] The computing device 700 also includes an access device 740, which enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 740 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0177] In one embodiment of this specification, the above-described components of the computing device 700 and Figure 7 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 7 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0178] The computing device 700 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 700 can also be a mobile or stationary server.
[0179] The processor 720 is used to execute the following computer program / instruction, which, when executed by the processor, implements the steps of the above-mentioned data processing method and model training method.
[0180] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, the computing device embodiments are basically similar to the data processing method and model training method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the data processing method and model training method embodiments.
[0181] An embodiment of this specification also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described data processing method and model training method.
[0182] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on its differences from other embodiments. In particular, the computer-readable storage medium embodiments are basically similar to the data processing method and model training method embodiments, and therefore are described more simply. Relevant parts can be referred to the descriptions of the data processing method and model training method embodiments.
[0183] An embodiment of this specification also provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the steps of the above-described data processing method and model training method.
[0184] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product belongs to the same concept as the technical solutions of the data processing method and the model training method described above. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solutions of the data processing method and the model training method described above.
[0185] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0186] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0187] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0188] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0189] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A data processing method, comprising: Obtain the query text, at least two candidate documents, and a sorting strategy for the candidate documents; determine the target prompt text based on the sorting strategy; and determine the mask marker for each candidate document. The text to be processed is generated based on the query text, the at least two candidate documents, and the mask markers of each candidate document; The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, and the document sorting results of the at least two candidate documents are obtained based on each mask prediction result.
2. The method as described in claim 1, wherein the sorting strategy includes a first relevance strategy and a second permutation strategy; The target prompt text is determined according to the sorting strategy, including: Based on the first relevance strategy, construct a first prompt text for calculating relevance; Based on the second arrangement strategy, construct a second prompt text for document arrangement.
3. The method as described in claim 2, wherein the text to be processed, the sorting strategy, and the target prompt text are input into a document processing model to obtain mask prediction results corresponding to each mask marker, comprising: When the sorting strategy is the first relevance strategy, the text to be processed, the first relevance strategy, and the first prompt text are input into the document processing model; Based on the document processing model, the correlation between the query text and each candidate document is calculated to obtain the relevant prediction results corresponding to each mask tag.
4. The method as described in claim 2, wherein the first related strategy includes a point-to-point reordering strategy; Based on the query text, the at least two candidate documents, and the mask markers of each candidate document, generate the text to be processed, including: For any one of the at least two candidate documents, the query text, the candidate document, and the mask mark of the candidate document are concatenated to obtain the text to be processed corresponding to each candidate document.
5. The method as described in claim 4, wherein the text to be processed, the sorting strategy, and the target prompt text are input into a document processing model to obtain mask prediction results corresponding to each mask marker, comprising: The text to be processed corresponding to each candidate document, the point-to-point reordering strategy, and the first prompt text input document processing model; The correlation between the query semantic document and the target candidate document is calculated based on the document processing model to obtain the correlation prediction result of the mask tag corresponding to the target candidate document, wherein the target candidate document is determined from the at least two candidate documents; Continue executing the steps of calculating the relevance between the query semantic document and the target candidate document based on the document processing model, and obtaining the relevance prediction results of the mask tags corresponding to the target candidate documents, until the relevance prediction results of the mask tags corresponding to each candidate document are obtained.
6. The method of claim 2, wherein the first related strategy includes a list reordering strategy; The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: Input the text to be processed, the list reordering strategy, and the first prompt text into the document processing model; Based on the document processing model, in one forward computation, the relevance between the query text and the at least two candidate documents is calculated to obtain the relevance prediction results corresponding to at least two mask tags.
7. The method of claim 3, wherein obtaining the document ranking result of the at least two candidate documents based on each mask prediction result includes: The at least two candidate documents are sorted according to the relevant prediction results to obtain the document sorting result.
8. The method as described in claim 2, wherein the text to be processed, the sorting strategy, and the target prompt text are input into a document processing model to obtain mask prediction results corresponding to each mask marker, comprising: When the sorting strategy is the second arrangement strategy, the text to be processed, the second arrangement strategy, and the second prompt text are input into the document processing model to obtain the target predicted document corresponding to each mask mark, wherein at least two mask marks in the text to be processed are arranged into a mask mark sequence.
9. The method of claim 8, wherein the second permutation strategy comprises a permutation strategy based on constrained sampling; The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: The text to be processed, the arrangement strategy based on restricted sampling, and the second prompt text are input into the document processing model; Based on the document processing model, in each denoising time step, the prediction confidence of each mask tag for each candidate document is obtained, and a target prediction document is assigned to the target mask tag based on the prediction confidence of each candidate document, until the target prediction document corresponding to each mask tag is obtained. Each candidate document is determined as a target prediction document once, and each mask tag corresponds to a target prediction document.
10. The method of claim 9, wherein a target predicted document is assigned to the target mask marker based on the prediction confidence of each candidate document until the target predicted document corresponding to each mask marker is obtained, comprising: Based on the prediction confidence of each candidate document, a target prediction document is assigned to the target mask label, wherein the target mask label is a mask label with a prediction confidence higher than a preset threshold, and the target prediction document is the candidate document with the highest prediction confidence corresponding to the target mask label; The candidate documents other than the target predicted document among the at least two candidate documents are determined as candidate documents to be processed, and the mask tags other than the target mask tags among the at least two mask tags are determined as mask tags to be processed. Obtain the prediction confidence of each mask tag to be processed for each candidate document to be processed, and assign a target prediction document to the target mask tag based on the prediction confidence of each candidate document to be processed; Continue executing the steps of determining candidate documents other than the target predicted document from the at least two candidate documents as candidate documents to be processed, and determining mask tags other than the target mask tag from the at least two mask tags as mask tags to be processed, until the target predicted document corresponding to each mask tag is obtained.
11. The method of claim 8, wherein the second permutation strategy comprises an allocation-based permutation strategy; The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker, including: The text to be processed, the allocation-based arrangement strategy, and the second prompt text are input into the document processing model; Based on the document processing model, construct the cost matrix of the at least two candidate documents and their corresponding mask tags; The cost matrix is calculated using a target algorithm to determine the target prediction document corresponding to each mask marker.
12. The method according to any one of claims 8-11, wherein obtaining the document ranking result of the at least two candidate documents based on each mask prediction result includes: By replacing the corresponding mask markers with the document identifiers of the target predicted documents corresponding to each mask marker, the document ranking results of the at least two candidate documents are obtained.
13. The method according to any one of claims 1-11, wherein obtaining the query text and at least two candidate documents comprises: Based on the query text, at least two candidate documents are retrieved from the initial document set, or at least two candidate documents are obtained from a preset knowledge base.
14. A data processing method, comprising: In response to a document sorting request sent by a client, the system obtains the query text, at least two candidate documents, and a sorting strategy for the candidate documents, and determines the target prompt text based on the sorting strategy. The text to be processed is generated based on the query text, the at least two candidate documents, and the mask markers of each candidate document; The text to be processed, the sorting strategy, and the target prompt text are input into the document processing model to obtain the mask prediction results corresponding to each mask marker. Based on each mask prediction result, the document sorting results of the at least two candidate documents are obtained, and the document sorting results are returned to the client.
15. A model training method, comprising: Obtain the query text, at least two candidate documents, the arrangement identifiers of the at least two candidate documents, and the sorting strategy; determine the target prompt text based on the sorting strategy. The target arrangement identifier of the target candidate document among the at least two candidate documents is masked to obtain the mask mark of the target candidate document; The text to be processed is generated based on the query text, the at least two candidate documents, the arrangement identifiers of the candidate documents, and the mask marker of the target candidate document; The text to be processed, the sorting strategy, and the target prompt text are input into the data processing model to obtain the mask prediction result corresponding to the mask mark. Based on the mask prediction results and the target arrangement identifiers, the data processing model is trained to obtain the document processing model.
16. A data processing apparatus, comprising: The acquisition module is configured to acquire the query statement text, at least two candidate documents, and a sorting strategy for the candidate documents, determine the target prompt text according to the sorting strategy, and determine the mask marker for each candidate document. The generation module is configured to generate text to be processed based on the query text, the at least two candidate documents, and the mask markers of each candidate document; The sorting module is configured to input the text to be processed, the sorting strategy, and the target prompt text into the document processing model, obtain the mask prediction results corresponding to each mask marker, and obtain the document sorting results of the at least two candidate documents based on each mask prediction result.
17. A model training device, comprising: The acquisition module is configured to acquire the query statement text, at least two candidate documents, the arrangement identifiers of the at least two candidate documents, and a sorting strategy, and determine the target prompt text based on the sorting strategy; The masking module is configured to perform masking processing on the target arrangement identifier of the target candidate document among the at least two candidate documents to obtain the mask mark of the target candidate document; The generation module is configured to generate text to be processed based on the query text, the at least two candidate documents, the arrangement identifiers of the candidate documents, and the mask marker of the target candidate document; The prediction module is configured to input the text to be processed, the sorting strategy, and the target prompt text into the data processing model to obtain the mask prediction result corresponding to the mask marker; The training module is configured to train the data processing model based on the mask prediction results and the target arrangement identifiers to obtain the document processing model.
18. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 15.
19. A computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 15.
20. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 15.