Data processing method and apparatus, and question answering method

WO2026179431A1PCT designated stage Publication Date: 2026-09-03ALIBABA (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2026/070982
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-02-28
Filing Date
2026-01-06
Publication Date
2026-09-03

Smart Images

  • Figure CN2026070982_03092026_PF_FP_ABST
    Figure CN2026070982_03092026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present disclosure are a data processing method and apparatus, and a question answering method. The data processing method comprises: inputting a target query and corresponding prompt text into a data processing model, obtaining, in the data processing model, a plurality of predicted tokens for a plurality of sampling threads at a current time step in an autoregressive manner, and placing the plurality of predicted tokens into a plurality of token sequences corresponding to the plurality of sampling threads; when the plurality of token sequences are inconsistent, determining the current time step as a target time step, and on the basis of the target time step and a preset time step length, acquiring a token sequence set from the plurality of token sequences; on the basis of a self-evaluation method, evaluating the token sequence set, so as to obtain a sequence evaluation result, and on the basis of the sequence evaluation result, determining a target sampling thread from among the plurality of sampling threads; and on the basis of a target token sequence corresponding to the target sampling thread, obtaining a target answer corresponding to the target query. By determining a target sampling thread, the computational load can be reduced, and the processing efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing methods and devices, question-and-answer methods

[0001] This disclosure claims priority to Chinese Patent Application No. 202510238106.3, filed with the China National Intellectual Property Administration on February 28, 2025, entitled “Data Processing Method and Apparatus, Question Answering Method”, the entire contents of which are incorporated herein by reference. Technical Field

[0002] This disclosure relates to the fields of computer and large model technology, and particularly to a data processing method and apparatus, a question-and-answer method. One or more embodiments of this disclosure also relate to a computing device, an electronic device, a computer-readable storage medium, and a computer program product. Background Technology

[0003] Large Language Models (LLMs), extensively pre-trained on large corpora, possess powerful generation and reasoning capabilities. Therefore, excellent solutions to a problem can often be directly derived from their probability distributions. However, basic autoregressive decoding focuses on locally optimal solutions, neglecting more promising thought processes. Therefore, the test-time extension technique was proposed, which searches for better thought processes by adding extra computation during decoding.

[0004] Specifically, it filters the final solution by sampling multiple inference paths in parallel. However, this method sorts the complete answers generated by multiple inference paths to filter the final solution, which can lead to significant memory pressure and time latency. Summary of the Invention

[0005] In view of the above, embodiments of this disclosure provide a data processing method. One or more embodiments of this disclosure also relate to a data processing apparatus, a question-and-answer method, a computing device, an electronic device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.

[0006] According to a first aspect of the present disclosure, a data processing method is provided, comprising:

[0007] The target query and the corresponding prompt text are input into the data processing model. In the data processing model, multiple predicted words of multiple sampling threads at the current time step are obtained through autoregression. The multiple predicted words are then put into the multiple word sequences corresponding to the multiple sampling threads.

[0008] In the case that the multiple word sequences are inconsistent, the current time step is determined as the target time step, and a word sequence set is obtained from the multiple word sequences according to the target time step and the preset time step length;

[0009] The word sequence set is evaluated using a self-evaluation method to obtain sequence evaluation results, and a target sampling thread is determined from the plurality of sampling threads based on the sequence evaluation results.

[0010] The target answer corresponding to the target query is obtained based on the target lexical sequence corresponding to the target sampling thread, wherein the target lexical sequence is the lexical sequence of the end time step corresponding to the target sampling thread.

[0011] According to a second aspect of the present disclosure, a data processing apparatus is provided, comprising:

[0012] The lexical prediction module is configured to input the target query and the corresponding prompt text into the data processing model. In the data processing model, multiple predicted lexical units of multiple sampling threads at the current time step are obtained through autoregression, and the multiple predicted lexical units are put into multiple lexical sequences corresponding to the multiple sampling threads.

[0013] The data acquisition module is configured to determine the current time step as the target time step when the multiple word sequences are inconsistent, and to acquire a set of word sequences from the multiple word sequences according to the target time step and a preset time step length;

[0014] The sequence evaluation module is configured to evaluate the lexical sequence set according to a self-evaluation method, obtain a sequence evaluation result, and determine a target sampling thread from the plurality of sampling threads based on the sequence evaluation result;

[0015] The answer acquisition module is configured to obtain the target answer corresponding to the target query based on the target lexical sequence corresponding to the target sampling thread, wherein the target lexical sequence is the lexical sequence of the end time step corresponding to the target sampling thread.

[0016] According to a third aspect of the embodiments of this disclosure, a question-and-answer method is provided, including:

[0017] Receive the target query and the corresponding prompt text sent by the client, and apply the above data processing method to obtain the target answer corresponding to the target query;

[0018] The target answer is returned to the client so that it can be displayed on the client's user interface.

[0019] According to a fourth aspect of the present disclosure, a computing device is provided, comprising:

[0020] Memory and processor;

[0021] The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which implement the steps of the above data processing method when executed by the processor.

[0022] According to a fifth aspect of the present disclosure, an electronic device is provided, comprising:

[0023] A memory and a processor, the memory and the processor being connected via a bus;

[0024] 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 above-described data processing method.

[0025] According to a sixth aspect of the present disclosure, a computer-readable storage medium is provided that stores a computer program / instructions that, when executed by a processor, implement the steps of the data processing method described above.

[0026] According to a seventh aspect of the present disclosure, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the data processing method described above.

[0027] This disclosure provides a data processing method in one embodiment. When a target query and corresponding prompt text are input into a data processing model, the model obtains multiple predicted words from multiple sampling threads at the current time step through autoregression. These predicted words are then placed into multiple word sequences corresponding to the sampling threads. Specifically, during the generation process, the data processing model generates predicted words at each current time step and obtains multiple word sequences from multiple sampling threads. If the multiple word sequences are inconsistent, the current time step is determined as the target time step. Within a preset time step starting from the target time step, the acquired word sequence set is self-evaluated. This reduces the computational cost of external reward models and solves the problem that external reward models are difficult to use for scoring and evaluation, without relying on external reward models. This approach addresses the challenge of low scoring accuracy in open-ended question-answering scenarios, effectively improving generalization across different domains by avoiding the introduction of additional intervention variables that hinder generalization. Based on the obtained sequence evaluation results, a target sampling thread is determined from the multiple sampling threads. By starting from the current time step when multiple lexical sequences show inconsistencies and performing self-evaluation on the lexical sequence set, the target sampling thread can be identified as early as possible. This allows for the generation of the target lexical sequence corresponding to the target sampling thread, obtaining the target lexical sequence, and then obtaining the target answer for the target query based on the target lexical sequence. Compared to the approach of completely generating complete lexical sequences from multiple sampling threads and determining the target answer from one of these complete lexical sequences, this approach significantly reduces memory pressure, alleviates computational load earlier, and improves data processing efficiency. Attached Figure Description

[0028] Figure 1 is a schematic diagram of a data processing method provided in an embodiment of this disclosure;

[0029] Figure 2 is a flowchart of a data processing method provided in an embodiment of this disclosure;

[0030] Figure 3 is a schematic diagram of the processing procedure of a data processing method provided in an embodiment of this disclosure;

[0031] Figure 4 is a schematic diagram of the structure of a data processing apparatus provided in an embodiment of the present disclosure;

[0032] Figure 5 is a structural block diagram of a computing device provided in an embodiment of this disclosure;

[0033] Figure 6 is a structural block diagram of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0034] Numerous specific details are set forth in the following description to provide a full understanding of this disclosure. However, this disclosure 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 disclosure. Therefore, this disclosure is not limited to the specific implementations disclosed below.

[0035] The terminology used in one or more embodiments of this disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this disclosure. The singular forms “a,” “the,” and “the” as used in one or more embodiments of this disclosure 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 disclosure refers to and includes any or all possible combinations of one or more associated listed items.

[0036] 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 disclosure, 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 disclosure, 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”, “in response to a determination”, or “when…”.

[0037] 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 disclosure 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.

[0038] In one or more embodiments of this disclosure, a large model refers to a deep learning model with a large number of model parameters, typically containing hundreds of millions, tens of billions, hundreds of billions, trillions, or even tens of trillions of model parameters. A large model can also be called a foundation model. It is pre-trained using large-scale unlabeled corpora to produce a pre-trained model with hundreds of millions of parameters. Such models can adapt to a wide range of downstream tasks and have good generalization ability. Examples include Large Language Models (LLMs) and multi-modal pre-training models.

[0039] In practical applications, large models only require a small number of samples to fine-tune the pre-trained model before they can be applied to different tasks. Large models can be widely used in fields such as Natural Language Processing (NLP) and Computer Vision. Specifically, they can be applied to computer vision tasks such as Visual Question Answering (VQA), Image Captioning (IC), and Image Generation, as well as natural language processing tasks such as text-based sentiment classification, text summarization, and machine translation. The main application scenarios for large models include digital assistants, intelligent robots, search, online education, office software, e-commerce, and intelligent design.

[0040] First, the terms and concepts involved in one or more embodiments of this disclosure will be explained.

[0041] Best-of-N sampling: BoN sampling simultaneously samples N sequences during the large model decoding stage and selects the better sequence as the final solution through a reordering strategy.

[0042] Test time extension: By adding additional computational cost during the decoding of large models, better solution paths can be searched, thereby directly improving the performance of large models.

[0043] Full-BoN: Specifically refers to the paradigm type under the traditional BoN paradigm, which requires the complete generation of N sampled sequences.

[0044] Sampling refers to the process of randomly drawing samples from the probability distribution generated by a large model. Specifically, in natural language processing tasks, such as text generation, machine translation, or dialogue systems, a large model generates a probability distribution for the next word or character, which reflects the probability that each possible word will be the next output.

[0045] In the Best-of-N sampling strategy, "sampling" means not simply choosing the word with the highest probability (i.e., greedy search), but simultaneously generating N different sequences based on this probability distribution. Each sequence is constructed by randomly selecting words according to the probability distribution, thus exploring more possibilities rather than being limited to a single path.

[0046] Best-of-N sampling is one of the most widely used extension paradigms in test time extension techniques. By sampling N sequences from LLMs and selecting the best sample after decoding using a reordering strategy, Best-of-N can fully utilize the potential within the model distribution. A simple and effective method within this paradigm is self-consistent decoding, which selects the answer that appears most frequently as the final answer. Other methods utilize an external reward model to score multiple candidate answers, thereby selecting the candidate answer with the highest score as the final answer.

[0047] However, Best-of-N sampling faces two key challenges that may hinder efficient deployment in real-world scenarios:

[0048] All N sequences to be sampled need to be generated: Traditional Best-of-N sampling requires the complete generation of all N samples (which can be called Full-BoN). Although GPU (Graphics Processing Unit) parallelization can partially alleviate time latency, additional memory overhead is unavoidable, especially when LLMs generate long sequences. The accumulation of KV (Key-Value cache) can cause a huge burden on GPU memory, affecting data processing efficiency.

[0049] Limitations of external reward models: Training reward models is costly due to the scarcity of high-quality feedback data. Furthermore, they often exhibit domain specificity, which further limits their ability to generalize across domains (e.g., from mathematical problems to open-ended question answering).

[0050] To address the aforementioned technical problems, this disclosure provides a data processing method. This disclosure also relates to a data processing apparatus, a computing device, an electronic device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.

[0051] Referring to Figure 1, Figure 1 shows a scenario diagram of a data processing method provided according to an embodiment of the present disclosure.

[0052] Specifically, this data processing method is applied to a data processing system, which includes a terminal device 102 and a server 104. The terminal device 102 is used to send a target query and the corresponding prompt text to the server 104. In practical applications, users can input data on the terminal device 102 via text or voice. If voice is used, the terminal device 102 will also include a corresponding voice processing component, such as a voice parsing, voice-to-text, or voice synthesis module, to convert the user's language input into text. This disclosure does not impose any limitations on this.

[0053] A data processing model is trained in server 104. When server 104 receives a target query and corresponding prompt text sent by end device 102, it inputs the target query and corresponding prompt text into the data processing model. In the data processing model, multiple predicted words from multiple sampling threads at the current time step are obtained through autoregression, and these multiple predicted words are placed into multiple word sequences corresponding to the multiple sampling threads. If the multiple word sequences are inconsistent, the current time step is determined as the target time step, and a word sequence set is obtained from the multiple word sequences based on the target time step and a preset time step length. The word sequence set is evaluated using a self-evaluation method (i.e., sequence evaluation is performed on the word sequences in the word sequence set), and a sequence evaluation result is obtained. Based on the sequence evaluation result, a target sampling thread is determined from the multiple sampling threads. The target answer corresponding to the target query is obtained based on the target word sequence corresponding to the target sampling thread, wherein the target word sequence is the word sequence of the end time step corresponding to the target sampling thread. The target answer is then returned to end device 102.

[0054] 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 may 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.

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

[0056] It is worth noting that the data processing method provided in this embodiment can be executed by the server 104. In other embodiments of this disclosure, the data processing model can be deployed in the end device 102, so that the end device 102 can also have similar functions to the server 104, thereby executing the data processing method provided in this embodiment. In other embodiments, the data processing method provided in this embodiment can also be jointly executed by the end device 102 and the server 104.

[0057] The data processing method provided in this embodiment, when inputting a target query and corresponding prompt text into a data processing model, obtains multiple predicted words from multiple sampling threads at the current time step through autoregression in the data processing model, and places these multiple predicted words into multiple word sequences corresponding to the multiple sampling threads; that is, during the generation process, the data processing model generates predicted words at each current time step and obtains multiple word sequences from multiple sampling threads. If the multiple word sequences are inconsistent, the current time step is determined as the target time step, and within a preset time step starting from the target time step, the acquired word sequence set is self-evaluated, and the target is determined from the multiple sampling threads based on the obtained sequence evaluation results. The sampling thread, by starting from the current time step when multiple lexical sequences produce inconsistencies and performing sequence evaluation on the lexical sequence set, can determine the target sampling thread as early as possible. This allows for the generation of the target lexical sequence corresponding to the target sampling thread, obtaining the target lexical sequence, and then obtaining the target answer for the target query based on the target lexical sequence. Compared to the approach of completely generating complete lexical sequences from multiple sampling threads and determining the target answer from one of these complete lexical sequences, this approach significantly reduces memory pressure, alleviates computational load earlier, and improves data processing efficiency. Furthermore, without introducing an additional reward model, it avoids introducing additional intervention variables that hinder generalization across domains, effectively improving generalization ability across different domains and ensuring universality.

[0058] Referring to Figure 2, Figure 2 shows a flowchart of a data processing method provided according to an embodiment of the present disclosure, which specifically includes the following steps.

[0059] Step 202: Input the target query and the corresponding prompt text into the data processing model. In the data processing model, multiple predicted words of multiple sampling threads at the current time step are obtained through autoregression. The multiple predicted words are then placed into the multiple word sequences corresponding to the multiple sampling threads.

[0060] The target query can be understood as the question or task entered by the user, such as "write an article about climate change". The prompt text can be understood as the text used to guide the large language model to generate content. The prompt text can include restrictions and requirements on the generated content, and is usually a sentence or fragment; for example, the prompt text could be "the article should not exceed 500 words".

[0061] The data processing model is an autoregressive model that generates a complete sequence by progressively predicting the next element in the sequence; at each time t, the data processing model is based on the previously generated elements x1, x2, ..., x... t-1 Predict the next element x tThe large language model is an autoregressive model based on an autoregressive architecture. It generates text by progressively generating tokens (lexical units, which can be words or subwords).

[0062] The following section uses a large language model as an example to explain the data processing method in detail. During the text generation process of the large language model, multiple independent sampling threads can run simultaneously; each sampling thread represents a possible generation path (inference path); and multiple sampling threads mean that the large language model will generate multiple different token sequences in parallel, each token sequence being determined based on the same input but with different possible token selections.

[0063] It should be noted that each sampling thread maintains an independent lexical sequence, recording the currently generated predicted lexical units. These lexical sequences will differ during the gradual generation process because each sampling thread may select different predicted lexical units.

[0064] Specifically, in the text generation process of the large language model, the large language model generates text word by word. Each generation step can be called a time step, and the time step in which word prediction is currently being performed is called the current time step. That is, at each current time step, the large language model will calculate the probability distribution of each possible word based on the input content, and predict a possible word for each sampling thread by determining the predicted word from the probability distribution. These predicted words can be randomly sampled according to the probability distribution, or they can be selected by a certain strategy (such as top-k sampling, sampling the K words with higher probabilities). There is no limitation here.

[0065] At each current time step, the large language model adds the obtained predicted lexical units to the lexical sequence of the corresponding sampling thread to gradually build the complete text.

[0066] In one or more embodiments of this disclosure, the data processing model generates predicted terms progressively through an autoregressive approach, and predicts the corresponding predicted terms for the term sequence of each sampling thread at each current time step, while multiple sampling threads are running in parallel. Specific implementation details are as follows:

[0067] In the data processing model, multiple predicted terms from multiple sampling threads at the current time step are obtained through autoregression, including:

[0068] In the data processing model, an autoregressive approach is used to generate multiple predicted terms corresponding to the multiple term sequences of the multiple sampling threads at the current time step. Each sampling thread corresponds to one term sequence, and the multiple sampling threads are performed in parallel.

[0069] Autoregression can be understood as a text generation method in which the data processing model generates a word at each time step and uses it as part of the input to generate the next word; this process is carried out step by step until a complete text is generated.

[0070] Specifically, autoregressive generation is performed word by word. At each current time step, the large language model predicts the next word based on the generated word sequence. Therefore, when the target query and the corresponding prompt text are input into the large language model, for multiple parallel sampling threads, at the current time step, the next predicted word corresponding to the word sequence is generated using the word sequence corresponding to each sampling thread.

[0071] The data processing method provided in this disclosure generates multiple word sequences through multiple sampling threads. The large language model can explore different generation paths, and the multiple sampling threads running in parallel can generate multiple word sequences simultaneously, which significantly improves the generation efficiency.

[0072] Step 204: If the multiple word sequences are inconsistent, determine the current time step as the target time step, and obtain a word sequence set from the multiple word sequences according to the target time step and the preset time step length.

[0073] The preset time step is a pre-defined parameter that indicates the number of time steps to be traced back from the target time step. For example, a preset time step of 3 means that 3 time steps will be analyzed from the target time step.

[0074] Starting from the target time step, the generated lexical sequences for each time step are extracted from multiple sampling threads according to the preset time step length, forming a lexical sequence set. That is, at each time step within the preset time step length, the lexical sequences generated by different sampling threads will be collected into the lexical sequence set so that subsequent sequence evaluation can be performed on the lexical sequences in the lexical sequence set.

[0075] In practical applications, a time window can be formed based on the target time step and the preset time step size, and the lexical sequences corresponding to different sampling threads within this time window can be analyzed and evaluated.

[0076] By analyzing the lexical sequence set, we can better balance diversity and consistency. For example, while ensuring diversity through multiple sampling threads, we can avoid generating results that deviate from the target query or prompt text.

[0077] In one or more embodiments of this disclosure, inconsistency among multiple lexical sequences refers to the fact that any two lexical sequences among the multiple lexical sequences are inconsistent. This is because if two arbitrary pairs of lexical sequences are consistent, it becomes impossible to determine which of the two consistent lexical sequences is superior. Specific implementation methods are described below:

[0078] In the case that the multiple lexical sequences are inconsistent, determining the current time step as the target time step includes:

[0079] For the multiple lexical sequences corresponding to the multiple sampling threads at the current time step, a sequence comparison is performed. If any two lexical sequences are inconsistent, it is determined that the multiple lexical sequences are inconsistent, and the current time step is determined as the target time step.

[0080] Specifically, at the current time step, the word sequences generated by multiple sampling threads may be the same or different. By comparing the word sequences generated by multiple sampling threads, it is determined whether they are consistent. If any two word sequences are inconsistent, then these word sequences are considered inconsistent, and the current time step is determined as the target time step. The target time step is the point at which multiple word sequences begin to diverge. That is, the target time step can be understood as the earliest time step when multiple word sequences become inconsistent pairwise. Starting from the target time step, the multiple inconsistent word sequences after the target time step are analyzed and evaluated.

[0081] The data processing method provided in this embodiment can promptly detect discrepancies between multiple lexical sequences through sequence comparison. This allows for self-estimation when multiple lexical sequences corresponding to multiple sampling threads just begin to show pairwise inconsistencies, facilitating timely truncation and thus minimizing memory pressure and reducing computational load as early as possible.

[0082] In one or more embodiments of this disclosure, after performing sequence comparison on the multiple word sequences corresponding to the multiple sampling threads at the current time step, the method further includes:

[0083] If any two word sequences in the plurality of word sequences are identical, and the current time step is not the end time step of the plurality of word sequences,

[0084] The next time step of the current time step is updated to the current time step, and the steps of obtaining multiple predicted words from multiple sampling threads at the current time step, putting the multiple predicted words into multiple word sequences corresponding to the multiple sampling threads, and performing sequence comparison on the multiple word sequences corresponding to the multiple sampling threads at the current time step are continued.

[0085] In practical applications, if any two word sequences in the plurality of word sequences are consistent, and the current time step is the end time step of the plurality of word sequences, then the target word sequence can be determined from the plurality of word sequences according to preset rules, and the target answer corresponding to the target query can be obtained according to the target word sequence.

[0086] The preset rules include, but are not limited to, rules based on the overall probability of the sequence, fluency, and relevance to the target query, etc., and are not limited here. The end time step is determined when the generation process reaches the termination condition, which can be set according to the actual situation. For example, the generation process may end when the preset generation length is reached, or when the generation end symbol (such as...) is reached. <eos>It may end when specific conditions are met.

[0087] Specifically, at the current time step, if it is determined that two word sequences in multiple word sequences from multiple sampling threads are consistent, check whether the current time step meets the termination condition. If the current time step meets the termination condition, then the current time step is determined as the end time step, and the generation process terminates. Select a better sequence from multiple word sequences as the target word sequence, and generate the target answer.

[0088] In practice, if any two word sequences among multiple word sequences are identical, the current time step is theoretically not the end time step. This is because if any two word sequences are identical at the end time step, it is usually impossible to determine which word sequence is better. The occurrence of identical word sequences at the end time step usually indicates an unreasonable termination condition, such as an excessively short preset generation length. In this case, the preset generation length can be reset, and the process can be repeated. Since it is usually impossible to determine which of the two identical word sequences is better when they are identical, the preset rule can also be to directly determine the identical word sequence as the target word sequence, without further limitation here.

[0089] If the current time step does not meet the termination condition and is not the end time step, the generation process continues and enters the next time step, that is, the next time step is updated to the current time step, and the generation of predicted words and the comparison of multiple generated word sequences continue.

[0090] The data processing method provided in this disclosure reduces unnecessary computational overhead by determining whether the current time step is the end time step and performing the next step of correct processing when it is determined that any two sequences in multiple word sequences are consistent.

[0091] In one or more embodiments of this disclosure, starting from a target time step, multiple word sequences from multiple sampling threads within a preset time step are obtained. Based on these multiple word sequences, a word sequence set is obtained, and subsequent sequence evaluation is performed on the word sequences in the word sequence set. Specific implementation methods are described below:

[0092] The step of obtaining a lexical sequence set from the plurality of lexical sequences based on the target time step and a preset time step length includes:

[0093] A preset time step is determined, and each time step within the preset time step, starting from the target time step, is progressively determined as the current time step.

[0094] Using the data processing model, at each current time step within the preset time step, the predicted lexical units corresponding to each sampling thread are obtained;

[0095] Based on the multiple lexical sequences corresponding to the target time step of the multiple sampling threads, and the predicted lexical sequences corresponding to each sampling thread obtained at each time step within the preset time step, a lexical sequence set corresponding to the multiple sampling threads is obtained, wherein the lexical sequence set includes multiple lexical sequences corresponding to each time step within the preset time step.

[0096] Specifically, starting from the target time step, each time step is marked as the current time step in turn until the preset time step is covered. That is, by gradually determining the current time step, each time step starting from the target time step can be analyzed in turn. Using the data processing model, the predicted words of multiple sampling threads at the current time step are obtained. Thus, while gradually determining each time step within the preset time step as the current time step, the predicted words of each sampling thread corresponding to each time step within the preset time step are recorded.

[0097] Based on the lexical sequences corresponding to the target time step of each sampling thread, and the newly generated predicted lexical sequences within the preset time step, multiple lexical sequences corresponding to each sampling thread within the preset time step can be obtained. For example, taking a sampling thread as an example, the lexical sequence 1 corresponding to the target time step of sampling thread 1 is [0 1 2]. With a preset time step of 2, sampling thread 1 will obtain two new predicted lexical sequences through autoregression. For example, in sampling thread 1, based on the lexical sequence 1 [0 1 2] corresponding to the target time step, the predicted lexical sequence obtained in the next time step (the first time step within the preset time step) is 3, and a new lexical sequence 2 is generated as [0 1 2 3]. Then, for the second time step in the preset time step, using the lexical sequence 2 [0 1 2 3], the predicted lexical sequence obtained is 4, and a new lexical sequence 3 is generated as [0 1 2 3 4]. The newly generated lexical sequences 2 and 3 within the preset time step are placed into the lexical sequence set.

[0098] That is, extracting the lexical sequence from the target time step to the preset time step length from multiple sampling threads to form a lexical sequence set. This lexical sequence set records the generation results (lexical sequences) of different sampling threads within the preset time step.

[0099] The data processing method provided in this disclosure can precisely control the analysis scope of the generation process by setting a preset time step and a target time step, and analyze and evaluate the word sequence set within the analysis scope to provide data support for subsequent sequence evaluation and improve the accuracy of the evaluation results.

[0100] Step 206: Evaluate the lexical sequence set according to the self-evaluation method to obtain the sequence evaluation result, and determine the target sampling thread from the multiple sampling threads based on the sequence evaluation result.

[0101] Among them, self-evaluation can be understood as the ability of a data processing model to evaluate the reliability, accuracy, or confidence of its prediction results. By using self-evaluation, the introduction of an external reward model for evaluation can be avoided. The target sampling thread can be understood as the optimal sampling thread selected based on the sequence evaluation results. The word sequence generated by the thread is considered to be more in line with the requirements and closer to the correct answer.

[0102] In a lexical sequence set containing multiple sampling threads and lexical sequences generated at each time step within a preset time step, sequence evaluation is performed on the lexical sequences generated by each sampling thread in the lexical sequence set, and the sequence evaluation results are calculated. By calculating the sequence evaluation results, the lexical sequences generated by each sampling thread can be evaluated, providing a basis for selecting the target sampling thread.

[0103] In one or more embodiments of this disclosure, at each time step of a preset time step, multiple word sequences from multiple sampling threads are obtained. The multiple word sequences corresponding to each time step within the preset time step are determined as a word sequence group. An initial evaluation result for the word sequence group corresponding to each time step is calculated, thereby determining the sequence evaluation result. Specific implementation methods are as follows:

[0104] The step of evaluating the lexical sequence set according to a self-evaluation method to obtain sequence evaluation results includes:

[0105] Based on the time step, multiple word sequences in the word sequence set are grouped to obtain a word sequence group corresponding to each time step within the preset time step, wherein the word sequence group includes multiple word sequences corresponding to the multiple sampling threads at one time step;

[0106] Self-evaluation is performed on the word sequence group corresponding to each time step to obtain the initial evaluation result of the word sequence group corresponding to each time step;

[0107] The sequence evaluation result is obtained based on the initial evaluation result of the word sequence group corresponding to each time step.

[0108] Specifically, multiple lexical sequences in the lexical sequence set are grouped according to time steps, with each time step corresponding to a lexical sequence group. That is, each lexical sequence group contains lexical sequences generated by multiple sampling threads at a time step. The lexical sequence group at each time step is evaluated independently to obtain the initial evaluation result corresponding to each time step. The sequence evaluation result is the result of comprehensive calculation of the initial evaluation results of multiple time steps. That is, by combining the initial evaluation results of each time step, the final evaluation result of the entire lexical sequence set can be obtained.

[0109] In practical applications, when each time step within the prediction time step is progressively determined as the current time step and the lexical sequences corresponding to each sampling thread within the prediction time step are obtained, multiple lexical sequences of multiple sampling threads corresponding to the current time step can be evaluated. Thus, at each current time step within the prediction time step, the initial evaluation result corresponding to each time step can be obtained by generating and evaluating simultaneously. In other words, in this way, the lexical sequence group corresponding to each current time step within the prediction time step can be evaluated in real time.

[0110] The data processing method provided in this disclosure can analyze the quality of the generated results more meticulously by performing self-evaluation on the word sequence group at each time step, and obtain the sequence evaluation result of the entire word sequence set by integrating the initial evaluation results of each time step, thus ensuring the accuracy of the sequence evaluation result.

[0111] In one or more embodiments of this disclosure, the consistency of answers and the correctness of answers have a strong positive correlation. This means that the closer a word sequence is to other word sequences, the greater the probability that the word sequence is correct. Therefore, by calculating the distance between word sequences in each word sequence group, the word sequence closest to the correct answer in each word sequence group can be determined. Specific implementation methods are as follows:

[0112] The step of performing sequence evaluation on the lexical sequence group corresponding to each time step to obtain the initial evaluation result of the lexical sequence group corresponding to each time step includes:

[0113] Determine the embedding chain features of each lexical sequence in the lexical sequence group corresponding to each time step;

[0114] Calculate the embedding chain features of each word sequence and the average distance between the embedding chain features of other word sequences in the same word sequence group;

[0115] Based on the average distance, the initial evaluation result of the word sequence group corresponding to each time step is obtained.

[0116] Specifically, previous work has demonstrated a strong positive correlation between the consistency of the final answer and the correctness of the answer. This means that a lexical sequence that is closer to other lexical sequences is more likely to be correct. Generalizing this hypothesis, we can deduce that there is also a correlation between sampling consistency in the early stages of decoding (generation) and the final correctness of the answer. This means that in the early stages of decoding, the closer a lexical sequence is to other lexical sequences, the more likely it is to reach the correct answer among these multiple lexical sequences.

[0117] In practice, in previous work, a chain of hidden states from the input to the output space is called an embedding chain, which reflects the model's underlying thought process. By acquiring the embedding chain features of each word sequence at each time step, for each word sequence, the average distance between its embedding chain and the embedding chain features of other word sequences corresponding to the same time step is calculated; the word sequence with the smaller average distance is considered the better sequence estimate for that time step.

[0118] In this context, the embedding chain refers to the sequential chain of hidden states generated at each time step when the model processes the input sequence. These hidden states are the model's internal representation of the input data, typically a low-dimensional, continuous vector. Embedding chain features are information extracted from the embedding chain that reflects the model's potential representation or thought process at each time step; embedding chain features can be viewed as a representation of the model's "thought process" when processing the input sequence.

[0119] For example, the embedding chain features of a given word sequence at time step c can be obtained as follows:

[0120] The word sequence corresponding to time step c includes c tokens. Assuming the large language model has L layers, the embedding vector generated at the position of the t-th (1≤t≤c) token in the l-th (0≤l≤L) layer can be represented as: The sequence embedding vector of each layer is represented as the average of all token embedding vectors in that layer, i.e. At this point, the embedding chain at time c can be represented as H. c :=h0→h1→...→h L That is, an embedding chain that connects the input to the output; and then the corresponding embedding chain features are obtained based on the embedding chain.

[0121] In practical applications, by calculating the embedding chain features corresponding to each time step and each lexical sequence, and for each lexical sequence, the distance between its embedding chain features and the embedding chain features of other lexical sequences in its group is calculated. By comparing the distance of the embedding chain features, the similarity or difference between two lexical sequences in the model representation space can be measured. Specifically, the embedding chain features are the model's latent representation of the sequence, and the distance reflects the degree of similarity between the sequences in terms of semantics, structure, or context. By averaging the calculated distances, the average distance corresponding to each lexical sequence is obtained. The distance can be calculated using metrics such as cosine similarity and Euclidean distance, which are not limited here.

[0122] By calculating the average distance, the difference between each word sequence and other sequences in the group can be quantified; the smaller the distance, the higher the similarity between it and other word sequences; the larger the distance, the greater the difference between it and other word sequences. Based on the average distance between each word sequence and other sequences in a word sequence group, the initial evaluation result of a word sequence group is determined, that is, the initial evaluation result of the word sequence group is the better word sequence determined from the word sequence group.

[0123] The data processing method provided in this disclosure embeds chain features to capture the semantic information of lexical sequences. By calculating the average distance, the semantic consistency between sequences can be evaluated, thereby selecting sequences that are more semantically consistent.

[0124] In one or more embodiments of this disclosure, the initial evaluation result of the lexical sequence group corresponding to each time step can obtain the candidate sampling thread corresponding to each time step within a preset time step. This allows for frequency counting of the candidate sampling threads within the preset time step, and the candidate sampling thread that appears most frequently is determined as the target sampling thread. Specific implementation methods are as follows:

[0125] The step of obtaining the sequence evaluation result based on the initial evaluation result of the word sequence group corresponding to each time step includes:

[0126] Based on the initial evaluation results of the word sequence group corresponding to each time step, candidate sampling threads corresponding to each time step are determined from the plurality of sampling threads;

[0127] In each time step within the prediction time step, if one candidate sampling thread is determined, the frequency of occurrence of each candidate sampling thread within the prediction time step is statistically analyzed, and the sequence evaluation result is obtained based on the candidate sampling thread with the highest frequency in the statistical results.

[0128] Specifically, if the initial evaluation result of the word sequence group at each time step is a better word sequence in that word sequence group, the sampling thread corresponding to the better word sequence can be determined as a candidate sampling thread. Thus, the candidate sampling thread for each time step can be determined based on the initial evaluation result at each time step.

[0129] In practice, from the lexical sequence group at each time step, a lexical sequence with a smaller average distance is selected as a candidate lexical sequence (i.e., a better lexical sequence). Each candidate lexical sequence corresponds to a sampling thread, thus the sampling thread corresponding to the candidate lexical sequence can be marked as a candidate sampling thread.

[0130] At each time step within the prediction time step, there is a corresponding candidate sampling thread. By counting the number of times each candidate sampling thread appears within the prediction time step, the candidate sampling thread with the highest frequency can be determined from each candidate sampling thread, thereby obtaining the sequence evaluation result. That is, the candidate sampling thread with the highest frequency is the sampling thread (inference path) most likely to generate the answer corresponding to the target query.

[0131] The data processing method provided in this disclosure determines candidate lexical sequences and candidate sampling threads from the lexical sequence group corresponding to each time step, and obtains sequence evaluation results based on the occurrence frequency of candidate sampling threads. This method can more accurately determine the target sampling thread that performs better in multiple time steps.

[0132] Step 208: Obtain the target answer corresponding to the target query based on the target lexical sequence corresponding to the target sampling thread, wherein the target lexical sequence is the lexical sequence of the end time step corresponding to the target sampling thread.

[0133] Specifically, the target sampling thread generates a better word sequence, and its generation result will be used as the final output. The target word sequence is a complete text sequence generated by the target sampling thread, which contains all predicted words from beginning to end. Therefore, the target answer of the target query can be determined based on the target word sequence generated by the target sampling thread.

[0134] In one or more embodiments of this disclosure, when a target sampling thread is determined, word prediction continues for the word sequence corresponding to the target sampling thread until the end time step is reached. Specific implementation methods are as follows:

[0135] The step of obtaining the target answer corresponding to the target query based on the target lexical sequence corresponding to the target sampling thread includes:

[0136] Using the data processing model, predictive words are continuously generated step by step for the word sequence corresponding to the target sampling thread until the end time step is reached;

[0137] The lexical sequence of the end time step corresponding to the target sampling thread is determined as the target lexical sequence corresponding to the target sampling thread, and the target answer corresponding to the target query is obtained based on the target lexical sequence.

[0138] Specifically, for the lexical sequence corresponding to the target sampling thread, the autoregressive method of the large language model is used to gradually generate predicted lexical units until the end time step is reached. The end time step marks the termination of the generation process. The lexical sequence generated by the target sampling thread is completed at this time step. The complete lexical sequence generated by the target sampling thread is determined as the target lexical sequence. The target lexical sequence records all lexical units from the start to the end time step.

[0139] The target answer for the target query is determined by the target word sequence generated by the target sampling thread.

[0140] The data processing method provided in this disclosure generates predicted words step by step for the target sampling thread among multiple sampling threads, while truncating the generation process of other sampling threads. This can avoid further processing of low-quality sequences, release memory, accelerate inference, and thus improve generation efficiency.

[0141] The data processing method provided in this disclosure utilizes the model's self-estimation (self-evaluation) technology to allow the large language model to truncate multiple inference paths in the early stages of decoding, selecting only one valuable inference path to generate a complete one. This can reduce the memory load by nearly 90% and the inference latency by 50%, while demonstrating performance comparable to or even better than traditional solutions.

[0142] One embodiment of this disclosure also provides a question-and-answer method, which includes:

[0143] Receive the target query and the corresponding prompt text sent by the client, and apply the above data processing method to obtain the target answer corresponding to the target query;

[0144] The target answer is returned to the client so that it can be displayed on the client's user interface.

[0145] Specifically, when a user sends a target query and corresponding prompt text through the user interface of the client, the target query and prompt text are input into the data processing model. In the data processing model, multiple predicted words of multiple sampling threads at the current time step are obtained through autoregression, and the multiple predicted words are put into the multiple word sequences corresponding to the multiple sampling threads.

[0146] In the case of inconsistent multiple lexical sequences, the current time step is determined as the target time step, and a lexical sequence set is obtained from the multiple lexical sequences according to the target time step and the preset time step size; the lexical sequence set is evaluated according to a self-evaluation method to obtain a sequence evaluation result, and a target sampling thread is determined from the multiple sampling threads according to the sequence evaluation result.

[0147] Based on the target lexical sequence corresponding to the target sampling thread, the target answer corresponding to the target query is obtained and output, and the target answer is returned to the client so as to display the target answer to the user on the client's user interface.

[0148] The question-and-answer method provided in this disclosure, when the target answer is obtained by applying the above-described data processing method, can improve the efficiency of answer generation, thereby improving the user's interactive experience.

[0149] Referring to Figure 3, Figure 3 shows a schematic diagram of the processing procedure of a data processing method provided in an embodiment of the present disclosure.

[0150] In the existing technology, there are two main paradigms, including:

[0151] Self-consistent decoding based on majority voting: This method extracts answers from N sample sequences (i.e., the word sequences corresponding to N sampling threads) and selects the answer with the highest frequency as the final solution. This method is easy to implement, but its key drawback is that it can only be applied to deterministic tasks (such as mathematics and reasoning). For open-ended question answering without a standard answer, the model cannot calculate the frequency of answers, and therefore cannot obtain the final solution based on voting.

[0152] Scoring strategy based on external reward model: This method uses an external reward model to directly score N sample sequences and selects the highest-scoring sequence as the final answer. Intuitively, this method is simple, but it is computationally expensive, training a reward model is difficult, and the scoring accuracy of the reward model remains unresolved in current research. More importantly, this method is difficult to generalize to other domains; for example, a reward model specifically designed for mathematical reasoning is hard to apply to scoring in open-ended question-answering scenarios.

[0153] Therefore, in order to promote efficient testing time extension, embodiments of this disclosure provide a data processing method that avoids the complete generation of N sampling sequences and the intervention of external reward models.

[0154] Specifically, the target query and the instruction (prompt text) are input into the large language model. The large language model gradually generates lexical sequences corresponding to N sampling threads through autoregression. In this embodiment, N is 3 as an example to illustrate the data processing method in detail. In practical applications, the lexical sequences corresponding to N sampling threads can be represented as N samples.

[0155] During the process of the data processing model gradually generating the word sequences corresponding to N sampling threads (such as sampling 1-3 in Figure 3), the earlier moment when the word sequences corresponding to N sampling threads generate inconsistent tokens is determined as the earlier estimated moment (i.e., the target time step in the above embodiment). Taking Figure 3 as an example, the word sequences generated by sampling 1 and sampling 2 are consistent up to the number 2. However, the tokens predicted at a time step after the number 2 are inconsistent. That is, the token predicted by sampling 1 is "4" and the token predicted by sampling 2 is "3". At this time, the sequences of sampling 1 and sampling 2 are inconsistent. The moment when the sequence is inconsistent is determined as the earliest estimated moment, and the earliest estimated moment is determined as c.

[0156] Starting from the earliest estimated time c, a window consisting of τ time steps (i.e., a preset time step size of τ) is used as a buffer window, and self-estimation (i.e., self-evaluation in the above embodiment) is performed at each time step within the buffer window to obtain a better sequence estimate. That is, τ self-estimations are performed within the buffer window to obtain τ better sequence estimates.

[0157] The self-estimation algorithm executed at each time step is as follows: For each word sequence, its corresponding embedding chain feature is determined, and N word sequences are sequentially identified as target sequences. The average distance between the embedding chain feature corresponding to the target sequence and the remaining N-1 embedding chain features is calculated. The sequence with the smaller average distance is identified as the better sequence estimate corresponding to that time step (i.e., the initial evaluation result in the above embodiment). Based on τ time steps, τ better sequence estimates can be determined. The word sequence that appears more frequently among the τ better sequence estimates is identified as the final target sample, and other samples are self-truncated. In this embodiment, sample 2 is identified as the target sample, and the other samples (samples 1 and 3) are self-truncated.

[0158] After the buffer window, the generation of the determined target sample continues until the end. If the inference length set by the data processing model does not exceed T, the generation of sample 2 continues within Tc-τ time steps until the inference length reaches T, at which point the generation termination condition is met, and the target answer corresponding to the target query is 10.

[0159] The data processing method provided in this disclosure does not require the extraction of deterministic answers, and therefore is not limited to specific task types. In addition, the method does not rely on the scoring of an external reward model, so it does not introduce additional intervention variables that hinder the generalizability between domains. By utilizing the self-estimation technique of a large language model, the large language model truncates multiple inference paths in the early stages of decoding, selecting only one valuable path to generate the complete path. This method reduces the memory load by nearly 90% and the inference latency by 50%, while exhibiting performance comparable to or even better than traditional solutions. It can greatly optimize the computational cost of the decoding stage while maintaining performance.

[0160] Specifically, experiments demonstrate that GPU (Graphics Processing Unit) memory usage during inference time mainly includes the model's base weights and key-value (KV) cache. Since base weights are unavoidable, the memory bottleneck primarily depends on the peak usage of the KV cache. For traditional BoN methods, their peak memory usage is reached when N samples are generated, and it is proportional to the inference length and N itself. For the data processing method provided in this disclosure, its peak memory usage may be reached at the earliest estimation time c, or it may be reached when generation is complete (at which point the inference batch has been reduced to 1). By comparing the peak memory usage percentage, it was found that as the number of samples N increases (when N is greater than 10), the peak memory usage percentage of this data processing method is less than 10%, meaning that memory usage is optimized by more than 90%.

[0161] Inference latency is another significant factor hindering efficient decoding. Comparative analysis reveals that our proposed data processing method reduces inference time by approximately 50% compared to Full-BoN; furthermore, it achieves superior performance at the same computational cost; and while achieving the same performance, it requires less computational cost.

[0162] Corresponding to the above method embodiments, this disclosure also provides a data processing apparatus embodiment. Figure 4 shows a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this disclosure. As shown in Figure 4, the apparatus includes:

[0163] The lexical prediction module 402 is configured to input the target query and the corresponding prompt text into the data processing model. In the data processing model, multiple predicted lexical units of multiple sampling threads at the current time step are obtained through autoregression, and the multiple predicted lexical units are put into multiple lexical sequences corresponding to the multiple sampling threads.

[0164] The data acquisition module 404 is configured to determine the current time step as the target time step when the multiple word sequences are inconsistent, and to acquire a set of word sequences from the multiple word sequences according to the target time step and a preset time step length.

[0165] The sequence evaluation module 406 is configured to evaluate the lexical sequence set according to a self-evaluation method, obtain a sequence evaluation result, and determine a target sampling thread from the plurality of sampling threads based on the sequence evaluation result;

[0166] The answer acquisition module 408 is configured to obtain the target answer corresponding to the target query based on the target lexical sequence corresponding to the target sampling thread, wherein the target lexical sequence is the lexical sequence of the end time step corresponding to the target sampling thread.

[0167] Optionally, the data acquisition module 404 is further configured to:

[0168] For the multiple lexical sequences corresponding to the multiple sampling threads at the current time step, a sequence comparison is performed. If any two lexical sequences are inconsistent, it is determined that the multiple lexical sequences are inconsistent, and the current time step is determined as the target time step.

[0169] Optionally, the sequence evaluation module 406 is further configured to:

[0170] Based on the time step, multiple word sequences in the word sequence set are grouped to obtain a word sequence group corresponding to each time step within the preset time step, wherein the word sequence group includes multiple word sequences corresponding to the multiple sampling threads at one time step;

[0171] Self-evaluation is performed on the word sequence group corresponding to each time step to obtain the initial evaluation result of the word sequence group corresponding to each time step;

[0172] The sequence evaluation result is obtained based on the initial evaluation result of the word sequence group corresponding to each time step.

[0173] Optionally, the sequence evaluation module 406 is further configured to:

[0174] Determine the embedding chain features of each lexical sequence in the lexical sequence group corresponding to each time step;

[0175] Calculate the embedding chain features of each word sequence and the average distance between the embedding chain features of other word sequences in the same word sequence group;

[0176] Based on the average distance, the initial evaluation result of the word sequence group corresponding to each time step is obtained.

[0177] Optionally, the sequence evaluation module 406 is further configured to:

[0178] Based on the initial evaluation results of the word sequence group corresponding to each time step, candidate sampling threads corresponding to each time step are determined from the plurality of sampling threads;

[0179] In each time step within the prediction time step, if one candidate sampling thread is determined, the frequency of occurrence of each candidate sampling thread within the prediction time step is statistically analyzed, and the sequence evaluation result is obtained based on the candidate sampling thread with the highest frequency in the statistical results.

[0180] The device further includes:

[0181] The judgment module is configured to, when any two word sequences in the plurality of word sequences are consistent and the current time step is not the end time step of the plurality of word sequences, update the next time step of the current time step to the current time step, and continue to execute the steps of obtaining the plurality of predicted words of the plurality of sampling threads at the current time step, putting the plurality of predicted words into the plurality of word sequences corresponding to the plurality of sampling threads, and performing sequence comparison on the plurality of word sequences corresponding to the plurality of sampling threads at the current time step.

[0182] Optionally, the data acquisition module 404 is further configured to:

[0183] A preset time step is determined, and each time step within the preset time step, starting from the target time step, is progressively determined as the current time step.

[0184] Using the data processing model, at each current time step within the preset time step, the predicted lexical units corresponding to each sampling thread are obtained;

[0185] Based on the multiple lexical sequences corresponding to the target time step of the multiple sampling threads, and the predicted lexical sequences corresponding to each sampling thread obtained at each time step within the preset time step, a lexical sequence set corresponding to the multiple sampling threads is obtained, wherein the lexical sequence set includes multiple lexical sequences corresponding to each time step within the preset time step.

[0186] Optionally, the answer obtaining module 408 is further configured to:

[0187] Using the data processing model, predictive words are continuously generated step by step for the word sequence corresponding to the target sampling thread until the end time step is reached;

[0188] The lexical sequence of the end time step corresponding to the target sampling thread is determined as the target lexical sequence corresponding to the target sampling thread, and the target answer corresponding to the target query is obtained based on the target lexical sequence.

[0189] Optionally, the lexical prediction module 402 is further configured to:

[0190] In the data processing model, an autoregressive approach is used to generate multiple predicted terms corresponding to the multiple term sequences of the multiple sampling threads at the current time step. Each sampling thread corresponds to one term sequence, and the multiple sampling threads are performed in parallel.

[0191] One embodiment of this disclosure provides a data processing apparatus that, when a target query and corresponding prompt text are input into a data processing model, obtains multiple predicted words from multiple sampling threads at the current time step through an autoregressive approach within the data processing model, and places these multiple predicted words into multiple word sequences corresponding to the multiple sampling threads. Specifically, during the generation process, the data processing model generates predicted words at each current time step and obtains multiple word sequences from multiple sampling threads. If the multiple word sequences are inconsistent, the current time step is determined as the target time step, and within a preset time step starting from the target time step, the acquired word sequence set is self-evaluated. This reduces the computational cost of external reward models and solves the problem that external reward models are difficult to use for scoring and evaluation without relying on them. This approach addresses the challenge of low scoring accuracy in open-ended question-answering scenarios, effectively improving generalization across different domains by avoiding the introduction of additional intervention variables that hinder generalization. Based on the obtained sequence evaluation results, a target sampling thread is determined from the multiple sampling threads. By starting from the current time step when multiple lexical sequences show inconsistencies and performing self-evaluation on the lexical sequence set, the target sampling thread can be identified as early as possible. This allows for the generation of the target lexical sequence corresponding to the target sampling thread, obtaining the target lexical sequence, and then obtaining the target answer for the target query based on the target lexical sequence. Compared to the approach of completely generating complete lexical sequences from multiple sampling threads and determining the target answer from one of these complete lexical sequences, this approach significantly reduces memory pressure, alleviates computational load earlier, and improves data processing efficiency.

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

[0193] Figure 5 shows a structural block diagram of a computing device 500 provided according to an embodiment of the present disclosure.

[0194] The computing device 500 includes:

[0195] Memory 510 and processor 520;

[0196] The memory 510 is used to store computer programs / instructions, and the processor 520 is used to execute the computer programs / instructions, which, when executed by the processor 520, implement the steps of the data processing method.

[0197] In one or more embodiments of this disclosure, the computing device can be understood as an integrated smart terminal, including but not limited to a server, desktop computer, PC (Personal Computer), all-in-one model machine, mobile phone, tablet computer or other portable smart terminal, etc., and the computing device may have the model described in the above embodiments of this disclosure pre-installed.

[0198] Specifically, this computing device can pre-install various types of models, including but not limited to models in natural language processing, visual processing, speech processing, code processing, and multimodal task processing, thus providing diverse model selection. In different product forms, this computing device can support one or more model usage methods, including but not limited to model training, model invocation, model fine-tuning, model deployment, model inference, and application. In some product forms, this computing device also supports model management, including but not limited to multi-type model management (supporting the management of discriminative, generative, and other types of models), model version control (supporting the control of different model versions), and model evaluation (evaluating model performance and effectiveness based on model evaluation tools). In other product forms, this computing device can also create applications based on models, providing API (Application Programming Interface) calling capabilities. Users can call models into created applications through the API interface, and application management tools are also provided to manage and monitor the applications.

[0199] Furthermore, the computing device may also include data management (supporting the creation and management of model tuning datasets), a training center (providing abundant training resources to help users learn and master AI (Artificial Intelligence) technology), and basic control capabilities (providing enterprise-level basic control capabilities to ensure the security and efficient operation of the system). Through the above functions, it provides a comprehensive and integrated device for AI development, training, deployment, and application.

[0200] Figure 6 shows a structural block diagram of an electronic device 600 provided according to an embodiment of the present disclosure.

[0201] The memory 610 and the processor 620 are connected via a bus 630.

[0202] The memory 610 is used to store computer programs / instructions, and the processor 620 is used to execute the computer programs / instructions, which, when executed by the processor 620, implement the steps of the method.

[0203] Specifically, the components of the electronic device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and the database 650 is used to store data.

[0204] Electronic device 600 also includes access device 640, which enables electronic device 600 to communicate via one or more networks 660. 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. Access device 640 may include one or more of any type of wired or wireless network interface (e.g., network interface controller (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, a Near Field Communication (NFC) interface, and so on.

[0205] In one embodiment of this disclosure, the aforementioned components of the electronic device 600, as well as other components not shown in FIG. 6, may also be connected to each other, for example, via a bus. It should be understood that the electronic device structural block diagram shown in FIG. 6 is merely for illustrative purposes and is not intended to limit the scope of this disclosure. Those skilled in the art can add or replace other components as needed.

[0206] Electronic device 600 can be any type of stationary or mobile electronic device, including mobile computers or mobile electronic devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable electronic devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary electronic devices such as desktop computers or personal computers (PCs). Electronic device 600 can also be a mobile or stationary server.

[0207] The above is an illustrative scheme of an electronic device according to this embodiment. It should be noted that the technical solution of this electronic device 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 electronic device, please refer to the description of the technical solution of the data processing method described above.

[0208] An embodiment of this disclosure 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.

[0209] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium 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 storage medium, please refer to the description of the technical solution of the data processing method described above.

[0210] An embodiment of this disclosure also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described data processing method.

[0211] 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 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 computer program product, please refer to the description of the technical solution of the data processing method described above.

[0212] The foregoing has described specific embodiments of this disclosure. 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 results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0213] The computer program / 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.

[0214] 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 of this disclosure are not limited to the described order of actions, because according to the embodiments of this disclosure, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments of this disclosure.

[0215] 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 of other embodiments.

[0216] The preferred embodiments disclosed above are merely illustrative of this disclosure. 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 of this disclosure. These embodiments are selected and specifically described in this disclosure to better explain the principles and practical applications of the embodiments of this disclosure, thereby enabling those skilled in the art to better understand and utilize this disclosure. This disclosure is limited only by the claims and their full scope and equivalents.< / eos>

Claims

1. A data processing method, comprising: The target query and the corresponding prompt text are input into the data processing model. In the data processing model, multiple predicted words of multiple sampling threads at the current time step are obtained through autoregression. The multiple predicted words are then put into the multiple word sequences corresponding to the multiple sampling threads. In the case that the multiple word sequences are inconsistent, the current time step is determined as the target time step, and a word sequence set is obtained from the multiple word sequences according to the target time step and the preset time step length; The word sequence set is evaluated using a self-evaluation method to obtain sequence evaluation results, and a target sampling thread is determined from the plurality of sampling threads based on the sequence evaluation results. The target answer corresponding to the target query is obtained based on the target lexical sequence corresponding to the target sampling thread, wherein the target lexical sequence is the lexical sequence of the end time step corresponding to the target sampling thread.

2. The data processing method according to claim 1, wherein determining the current time step as the target time step when the multiple lexical sequences are inconsistent includes: For the multiple lexical sequences corresponding to the multiple sampling threads at the current time step, a sequence comparison is performed. If any two lexical sequences are inconsistent, it is determined that the multiple lexical sequences are inconsistent, and the current time step is determined as the target time step.

3. The data processing method according to claim 1 or 2, wherein evaluating the lexical sequence set according to a self-evaluation method to obtain a sequence evaluation result includes: Based on the time step, multiple word sequences in the word sequence set are grouped to obtain a word sequence group corresponding to each time step within the preset time step, wherein the word sequence group includes multiple word sequences corresponding to the multiple sampling threads at one time step; Self-evaluation is performed on the word sequence group corresponding to each time step to obtain the initial evaluation result of the word sequence group corresponding to each time step; The sequence evaluation result is obtained based on the initial evaluation result of the word sequence group corresponding to each time step.

4. The data processing method according to claim 3, wherein the step of performing self-evaluation on the lexical sequence group corresponding to each time step to obtain the initial evaluation result of the lexical sequence group corresponding to each time step includes: Determine the embedding chain features of each lexical sequence in the lexical sequence group corresponding to each time step; Calculate the embedding chain features of each word sequence and the average distance between the embedding chain features of other word sequences in the same word sequence group; Based on the average distance, the initial evaluation result of the word sequence group corresponding to each time step is obtained.

5. The data processing method according to claim 4, wherein obtaining the sequence evaluation result based on the initial evaluation result of the lexical sequence group corresponding to each time step includes: Based on the initial evaluation results of the word sequence group corresponding to each time step, candidate sampling threads corresponding to each time step are determined from the plurality of sampling threads; In each time step within the prediction time step, with one candidate sampling thread determined, the frequency of occurrence of each candidate sampling thread within the prediction time step is statistically analyzed. Based on the candidate sampling thread with the highest frequency in the statistical results, the sequence evaluation result is obtained.

6. The data processing method according to claim 4 or 5, wherein determining the embedding chain features of each lexical sequence includes: For the given word sequence at the current time step t, obtain the hidden state of each network layer l in the data processing model at each token position 1 to t; Pooling is performed on the t hidden states of each layer l to obtain the sequence-level representation vector of that layer; The sequence-level representation vectors of all layers are concatenated or weighted and fused in order of layer to form the embedding chain feature of the word sequence at time step t.

7. The data processing method according to any one of claims 3-6, wherein the self-evaluation of the word sequence group corresponding to each time step includes: Without introducing an external reward model, the semantic similarity between each word sequence is calculated using the intermediate layer representation of the data processing model itself. Based on the semantic similarity, a consistency score is assigned to each word sequence, wherein the score is positively correlated with the average similarity between the sequence and other sequences; The word sequence with the highest consistency score is used as the better sequence estimate for that time step.

8. The data processing method according to any one of claims 2-7, further comprising, after performing sequence comparison on the multiple word sequences corresponding to the multiple sampling threads at the current time step: If any two word sequences in the plurality of word sequences are identical, and the current time step is not the end time step of the plurality of word sequences, The next time step of the current time step is updated to the current time step, and the steps of obtaining multiple predicted words from multiple sampling threads at the current time step, putting the multiple predicted words into multiple word sequences corresponding to the multiple sampling threads, and performing sequence comparison on the multiple word sequences corresponding to the multiple sampling threads at the current time step are continued.

9. The data processing method according to any one of claims 1-8, wherein obtaining a lexical sequence set from the plurality of lexical sequences according to the target time step and a preset time step length includes: A preset time step is determined, and each time step within the preset time step, starting from the target time step, is progressively determined as the current time step. Using the data processing model, at each current time step within the preset time step, the predicted lexical units corresponding to each sampling thread are obtained; Based on the multiple lexical sequences corresponding to the target time step of the multiple sampling threads, and the predicted lexical sequences corresponding to each sampling thread obtained at each time step within the preset time step, a lexical sequence set corresponding to the multiple sampling threads is obtained, wherein the lexical sequence set includes multiple lexical sequences corresponding to each time step within the preset time step.

10. The data processing method according to any one of claims 1-9, wherein obtaining the target answer corresponding to the target query based on the target lexical sequence corresponding to the target sampling thread includes: Using the data processing model, predictive words are continuously generated step by step for the word sequence corresponding to the target sampling thread until the end time step is reached; The lexical sequence of the end time step corresponding to the target sampling thread is determined as the target lexical sequence corresponding to the target sampling thread, and the target answer corresponding to the target query is obtained based on the target lexical sequence.

11. The data processing method according to any one of claims 1-10, wherein in the data processing model, obtaining multiple predicted terms from multiple sampling threads at the current time step through autoregression includes: In the data processing model, an autoregressive approach is used to generate multiple predicted terms corresponding to the multiple term sequences of the multiple sampling threads at the current time step. Each sampling thread corresponds to one term sequence, and the multiple sampling threads are performed in parallel.

12. The data processing method according to any one of claims 1-11, wherein the preset time step is dynamically adjusted according to at least one of the following: The target query belongs to a task category, where open-ended question answering tasks correspond to a larger preset time step, while deterministic reasoning tasks correspond to a smaller preset time step; The entropy value of the predicted probability distribution of multiple sampling threads at the target time step; the higher the entropy value, the larger the preset time step. The system's current available video memory capacity or inference latency budget.

13. The data processing method according to any one of claims 1-12, further comprising, after determining the target sampling thread: Terminate the generation process of all sampling threads except the target sampling thread; Release the KV cache, intermediate activation state, and word sequence storage space occupied by the other sampling threads; The subsequent inference batch size was reduced from N to 1 to reduce memory peak and computational load.

14. The data processing method according to any one of claims 1-13, further comprising, before inputting the target query and prompt text into the data processing model: Identify the task type of the target query, whereby the task type includes deterministic tasks and non-deterministic tasks; If it is a deterministic task, set a smaller number of sampling threads and a preset time step; For nondeterministic tasks, a larger number of sampling threads and a preset time step are set to enhance generation diversity and evaluation robustness.

15. A question-and-answer method, comprising: The system receives a target query and a corresponding prompt text sent by the client, and applies the data processing method of any one of claims 1-9 to obtain the target answer corresponding to the target query. The target answer is returned to the client so that it can be displayed on the client's user interface.

16. A data processing apparatus, comprising: The lexical prediction module is configured to input the target query and the corresponding prompt text into the data processing model. In the data processing model, multiple predicted lexical units of multiple sampling threads at the current time step are obtained through autoregression, and the multiple predicted lexical units are put into multiple lexical sequences corresponding to the multiple sampling threads. The data acquisition module is configured to determine the current time step as the target time step when the multiple word sequences are inconsistent, and to acquire a set of word sequences from the multiple word sequences according to the target time step and a preset time step length; The sequence evaluation module is configured to evaluate the lexical sequence set according to a self-evaluation method, obtain a sequence evaluation result, and determine a target sampling thread from the plurality of sampling threads based on the sequence evaluation result; The answer acquisition module is configured to obtain the target answer corresponding to the target query based on the target lexical sequence corresponding to the target sampling thread, wherein the target lexical sequence is the lexical sequence of the end time step corresponding to the target sampling thread.

17. 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.

18. An electronic device comprising: A memory and a processor, the memory and the processor being connected via a bus; 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.