Model acceleration method, apparatus, electronic device, and computer program product
By constructing trajectory description signals and action strategies, the problem of slow inference speed in diffusion language models is solved. Trajectory-level failure modes in the denoising process are explicitly modeled without changing model weights or introducing additional computational paths, thereby improving inference speed and reducing computational cost.
Patent Information
- Application Number
- CN202611331022.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-28
- Publication Date
- 2026-11-27
AI Technical Summary
The inference latency of diffusion language models is high, the KV Cache mechanism of traditional autoregressive models cannot be directly reused, and the existing LLM inference acceleration ecosystem is difficult to migrate, resulting in insufficient inference speed of diffusion language models.
Construct a trajectory description signal, determine the target action of the token position by trajectory fusion and recalculation trigger conditions, update cached data, and exit the denoising process after confirming that the quota has been reached. Use trajectory convergence coefficient to control the model to stop early.
Without modifying model weights or introducing additional computational paths, this method explicitly models oscillations, cascading collapses, and premature freezing in multi-step denoising processes, achieving sequence-level early stopping, improving inference speed, and reducing computational costs.
Smart Images

Figure CN123180345A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and more specifically, to a model acceleration method, a model acceleration device, an electronic device, and a computer program product. Background Technology
[0002] With the rapid development of LLM (Large Language Model) in tasks such as natural language understanding, reasoning, and generation, dLLM (Diffusion Large Language Model) is receiving widespread attention from academia and industry as a powerful alternative to autoregressive models. Unlike autoregressive models that generate tokens from left to right, diffusion language models perform multi-step iterative denoising on a fully masked sequence, demonstrating significant advantages in generation quality, controllability, and parallel decoding flexibility.
[0003] However, the core bottleneck of diffusion language models lies in their high inference latency. Specifically, each time a diffusion language model generates a complete sequence, it requires dozens to hundreds of denoising forward passes, each of which requires a complete Transformer forward computation on the entire sequence. Furthermore, because diffusion language models rely on bidirectional attention, the KV Cache (Key-Value Cache) mechanism of traditional autoregressive models cannot be directly reused, and the existing LLM inference acceleration ecosystem is difficult to directly migrate.
[0004] Therefore, there is an urgent need in this field for a model acceleration method for diffusion language models that can improve the inference speed of diffusion language models.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] The purpose of this disclosure is to provide a model acceleration method, model acceleration device, electronic device, and computer program product, which can at least to some extent improve the inference speed of diffusion language models.
[0007] According to a first aspect of this disclosure, a model acceleration method is provided, comprising: For each token position in the current denoising step of the sequence to be processed in the diffusion language model, a trajectory description signal corresponding to each token position is constructed, and the trajectory fusion score of the token position is obtained based on the trajectory description signal. Based on the trajectory fusion score of the token location and the recalculation trigger condition, the target action of the token location is determined, and the cached data of the token location is updated based on the target action; wherein, the target action is one of the following token-level actions: retain and recalculate action, reuse historical cache action, freeze and abandon action, and recall and recalculate action. The trajectory convergence coefficient is obtained based on the trajectory description signal of the mask token position in the unconfirmed state in the token position, and the confirmation quota of the current denoising step is determined based on the trajectory convergence coefficient. Based on the confirmed quota and the cached data of the mask token position, the mask token position is confirmed, and after all the mask token positions are confirmed, the diffusion language model is controlled to exit the current denoising process.
[0008] In an exemplary embodiment of this disclosure, the trajectory description signal includes a stability signal, an influence signal, a confidence signal, and a budget pressure signal. Constructing the trajectory description signal corresponding to each of the token positions includes: The stability signal corresponding to the token position is obtained based on the change in the normalized hidden state of the token position between adjacent denoising steps. Based on the overall influence of the token position on other token positions in the current denoising step, the influence signal corresponding to the token position is obtained; Based on the maximum probability of the token position in the Softmax distribution during the current denoising step, the confidence signal corresponding to the token position is obtained; Based on the memory usage of the token location, the budget pressure signal corresponding to the token location is obtained.
[0009] In one exemplary embodiment of this disclosure, obtaining the stability signal corresponding to the token position based on the change in the normalized hidden state between adjacent denoising steps includes: The difference between the hidden states is obtained by the diffusion language model based on the hidden states generated for the sequence to be processed in the current denoising step and the previous denoising step. The change in the normalized hidden state is obtained based on the difference between the hidden states and the hidden states generated in the previous denoising step. The stability signal corresponding to the token position is obtained based on the change in the normalized hidden state.
[0010] In one exemplary embodiment of this disclosure, obtaining the influence signal corresponding to the token position based on the overall influence of the token position on other token positions in the current denoising step includes: Based on the attention matrix generated by the diffusion language model on the sequence to be processed in the current denoising step, a multi-layer attention path accumulator operator is obtained. The influence signal corresponding to the token position is obtained by multiplying the multi-layer attention path operator.
[0011] In one exemplary embodiment of this disclosure, obtaining the budget pressure signal corresponding to the token position based on the memory usage of the token position includes: The normalized memory pressure value is obtained based on the baseline memory usage, current memory usage, and upper limit of memory usage at the token position. Based on the normalized memory pressure value and the denoising progress corresponding to the current denoising step, the budget pressure signal corresponding to the token position is obtained.
[0012] In one exemplary embodiment of this disclosure, the method further includes: The denoising progress corresponding to the current denoising step is obtained based on the current denoising step and the preset maximum total number of denoising steps.
[0013] In one exemplary embodiment of this disclosure, obtaining the trajectory fusion component of the token position based on the trajectory description signal includes: The current denoising step and several adjacent historical denoising steps are determined as the target window based on a preset window length. Based on a preset attenuation coefficient, each type of trajectory description signal is subjected to a moving average within the target window to obtain the window average value corresponding to each type of trajectory description signal; The basic fusion score is obtained based on the window average value and signal weight corresponding to the stability signal, the influence signal and the confidence signal, respectively. The suppression term is obtained based on the window average value and signal weight corresponding to the budget pressure signal, and the trajectory fusion score of the token position is obtained based on the basic fusion score and the suppression term.
[0014] In one exemplary embodiment of this disclosure, determining the target action for the token location based on the trajectory fusion score of the token location and the recalculation trigger condition includes: The recalculation trigger condition is determined based on multiple trajectory-level judgment conditions, and when the recalculation trigger condition is met, the recall recalculation action is determined as the target action of the token position. When the recalculation trigger condition is not met, the target action for the token position is determined from the retention and recalculation action, the reuse of historical cache action, and the freeze and abandonment action, based on the trajectory fusion score and the preset compaction threshold.
[0015] In an exemplary embodiment of this disclosure, the trajectory-level determination conditions include an entropy slope determination condition, an attention redirection determination condition, and a sequence-level confidence decrease determination condition. The step of determining whether the recalculation trigger condition is met based on multiple trajectory-level determination conditions includes: If the slope estimate of the output distribution entropy of the token position in the most recent denoising steps is greater than the preset slope threshold, then the entropy slope determination condition is met. If the average attention directed from the unfrozen set to the currently frozen set is greater than the preset attention threshold, then the attention redirection determination condition is met. If the decrease in the average confidence level of the sequence within the preset sequence window relative to the peak value within the window is greater than the preset decrease threshold, then the sequence-level confidence decrease determination condition is met. The recalculation trigger condition is determined to be satisfied when any one of the entropy slope determination condition, the attention redirection determination condition, and the sequence-level confidence decrease determination condition is met.
[0016] In one exemplary embodiment of this disclosure, the target action of determining the token position from the retention and recalculation action, the reuse of history cache action, and the freeze and abandonment action based on the trajectory fusion score and compaction threshold includes: A first compaction threshold and a second compaction threshold are obtained based on the budget pressure signal and the basic compaction threshold, wherein the first compaction threshold is less than the second compaction threshold; If the trajectory fusion score is greater than the second compaction threshold, then the retention and recalculation action is determined as the target action for the token position; If the trajectory fusion score is greater than the first compaction threshold and less than or equal to the second compaction threshold, then the reuse history cache action is determined as the target action of the token position; If the trajectory fusion score is less than or equal to the first compaction threshold, then the freeze-abandon action is determined as the target action for the token position.
[0017] In one exemplary embodiment of this disclosure, the method further includes: If the confidence signal of the token position is greater than the preset parallel confirmation threshold, then the token position enters the confirmation state based on the reuse history cache action.
[0018] In one exemplary embodiment of this disclosure, obtaining the trajectory convergence coefficient based on the trajectory description signal of the mask token position in the unconfirmed state in the token position includes: Based on the window average of the stability signal and the confidence signal of the mask token position in the unconfirmed state within the target window, the trajectory stability convergence coefficient and the trajectory confidence convergence coefficient are obtained.
[0019] In one exemplary embodiment of this disclosure, determining the confirmation quota for the current denoising step based on the trajectory convergence coefficient includes: If the trajectory stability convergence coefficient is greater than the preset trajectory stability threshold, and the trajectory confidence convergence coefficient is greater than the preset trajectory confidence threshold, then the quota increase condition is determined to be met. When the quota increase conditions are met, the confirmation quota for the current denoising step is determined based on the original scheduling quota, the number of mask tokens in the current denoising step, the maximum total number of denoising steps, the upper limit of single-step confirmation ratio, and the freeze acceleration multiple.
[0020] In one exemplary embodiment of this disclosure, confirming the mask token position based on the confirmed quota and the cached data of the mask token position includes: Based on the mask token positions, the target action is either the retain and recalculate action or the reuse history cache action, and the confidence signal is greater than a preset parallel confirmation threshold, a candidate mask token set is obtained. The mask token positions in the candidate mask token set are sorted according to the trajectory fusion score, and the target mask token position to be confirmed is determined from the candidate mask token set based on the confirmation quota and the sorting result. The target mask token position is confirmed based on the cached data of the target mask token position.
[0021] According to a second aspect of this disclosure, a model acceleration apparatus is provided, comprising: The trajectory fusion score determination module is configured to perform each token position of the sequence to be processed for the diffusion language model in the current denoising step, construct a trajectory description signal corresponding to each token position, and obtain the trajectory fusion score of the token position based on the trajectory description signal. The target action determination module is configured to determine the target action of the token position based on the trajectory fusion score and recalculation trigger conditions, and update the cached data of the token position based on the target action; wherein the target action is one of the following token-level actions: retain and recalculate action, reuse historical cache action, freeze and abandon action, and recall and recalculate action. The quota update confirmation module is configured to execute the trajectory convergence coefficient obtained from the trajectory description signal of the mask token position in the unconfirmed state in the token position, and determine the confirmation quota of the current denoising step based on the trajectory convergence coefficient. The denoising process control module is configured to execute the confirmation of the mask token position based on the confirmation quota and the cached data of the mask token position, and after all the mask token positions have been confirmed, control the diffusion language model to exit the current denoising process.
[0022] In an exemplary embodiment of this disclosure, the trajectory description signal includes a stability signal, an influence signal, a confidence signal, and a budget pressure signal, and the trajectory fusion and determination module includes: The stability signal determination unit is configured to perform a process to obtain a stability signal corresponding to the token position based on the change in the normalized hidden state between adjacent denoising steps. The influence signal determination unit is configured to perform an overall influence of the token position on other token positions in the current denoising step based on the token position; The confidence signal determination unit is configured to perform a process based on the maximum probability of the Softmax distribution of the token position in the current denoising step to obtain the confidence signal corresponding to the token position. The budget pressure signal determination unit is configured to determine the budget pressure signal corresponding to the token position based on the memory usage of the token position.
[0023] In one exemplary embodiment of this disclosure, the stability signal determination unit includes: The hidden state difference determination subunit is configured to perform the operation of obtaining the hidden state difference based on the hidden states generated by the diffusion language model for the sequence to be processed in the current denoising step and the previous denoising step, respectively. The hidden state change determination subunit is configured to perform the operation of obtaining the change of the normalized hidden state based on the hidden state difference and the hidden state generated in the previous denoising step. The stability signal determination subunit is configured to perform the operation of obtaining the stability signal corresponding to the token position based on the change in the normalized hidden state.
[0024] In one exemplary embodiment of this disclosure, the confidence signal determination unit includes: The path accumulation operator determination subunit is configured to execute an attention matrix generated on the sequence to be processed in the current denoising step based on the diffusion language model to obtain a multi-layer attention path accumulation operator. The influence signal determination subunit is configured to perform an operation to obtain the influence signal corresponding to the token position based on the multi-layer attention path multiplication operator.
[0025] In one exemplary embodiment of this disclosure, the budget pressure signal determination unit includes: The memory pressure value determination subunit is configured to perform a normalized memory pressure value based on the baseline memory usage at the token position, the current memory usage, and the upper limit of memory usage. The budget pressure signal determination subunit is configured to execute a process to obtain the budget pressure signal corresponding to the token position based on the normalized memory pressure value and the denoising progress corresponding to the current denoising step.
[0026] In one exemplary embodiment of this disclosure, the budget pressure signal determination unit further includes: The denoising progress determination subunit is configured to perform a process to determine the denoising progress corresponding to the current denoising step based on the current denoising step and the preset maximum total number of denoising steps.
[0027] In one exemplary embodiment of this disclosure, the trajectory fusion and determination module further includes: The target window determination unit is configured to determine the current denoising step and a plurality of adjacent historical denoising steps as the target window based on a preset window length. The window average value determination unit is configured to perform a sliding average on each type of trajectory description signal within the target window based on a preset attenuation coefficient, so as to obtain the window average value corresponding to each type of trajectory description signal. The basic fusion score determination unit is configured to perform the following: obtain the basic fusion score based on the window average value and signal weight corresponding to the stability signal, the influence signal and the confidence signal, respectively. The trajectory fusion score determination unit is configured to perform the following: obtain a suppression term based on the window average value and signal weight corresponding to the budget pressure signal, and obtain the trajectory fusion score of the token position based on the basic fusion score and the suppression term.
[0028] In one exemplary embodiment of this disclosure, the target action determination module includes: The recall recalculation action determination unit is configured to perform a determination based on multiple trajectory-level judgment conditions to determine whether the recalculation trigger condition is met, and when the recalculation trigger condition is met, determine the recall recalculation action as the target action of the token position; Other action determination units are configured to determine the target action of the token position from the retention and recalculation action, the reuse of historical cache action, and the freeze and abandon action when the recalculation trigger condition is not met, based on the trajectory fusion score and a preset compaction threshold.
[0029] In an exemplary embodiment of this disclosure, the trajectory-level determination conditions include an entropy slope determination condition, an attention redirection determination condition, and a sequence-level confidence decrease determination condition; the recall recalculation action determination unit includes: The entropy slope determination condition subunit is configured to execute the entropy slope determination condition if the estimated slope value of the output distribution entropy of the token position in the most recent multiple denoising steps is greater than a preset slope threshold. The attention redirection determination subunit is configured to execute the following: if the average attention from the unfrozen set to the current frozen set is greater than a preset attention threshold, then the attention redirection determination condition is met. The confidence decline determination subunit is configured to perform the following: if the decrease in the average confidence level of the sequence level within a preset sequence window relative to the peak value within the window is greater than a preset decrease threshold, then the sequence-level confidence decline determination condition is met. The recalculation trigger condition determination subunit is configured to determine that the recalculation trigger condition is met when one of the entropy slope determination condition, the attention redirection determination condition, and the sequence-level confidence decrease determination condition is met.
[0030] In one exemplary embodiment of this disclosure, the other action determination unit includes: The compaction threshold determination subunit is configured to perform operations to obtain a first compaction threshold and a second compaction threshold based on the budget pressure signal and a base compaction threshold, wherein the first compaction threshold is less than the second compaction threshold; The retain and recalculate action determination subunit is configured to determine the retain and recalculate action as the target action of the token position if the trajectory fusion score is greater than the second compaction threshold. The reuse history cache action determination subunit is configured to determine the reuse history cache action as the target action of the token position if the trajectory fusion score is greater than the first compaction threshold and less than or equal to the second compaction threshold. The freeze-abandon action determination subunit is configured to determine the freeze-abandon action as the target action of the token position if the trajectory fusion score is less than or equal to the first compaction threshold.
[0031] In one exemplary embodiment of this disclosure, the other action determination unit further includes: The confirmation state enters the sub-unit, which is configured to execute the action of making the token position enter the confirmation state based on the reuse history cache action if the confidence signal of the token position is greater than the preset parallel confirmation threshold.
[0032] In one exemplary embodiment of this disclosure, the quota update confirmation module includes: The trajectory convergence coefficient determination unit is configured to perform a process of obtaining the trajectory stability convergence coefficient and the trajectory confidence convergence coefficient based on the window average of the stability signal and the confidence signal of the mask token position in the unconfirmed state within the target window.
[0033] In one exemplary embodiment of this disclosure, the quota update confirmation module further includes: The quota increase condition determination unit is configured to determine that the quota increase condition is met if the trajectory stability convergence coefficient is greater than a preset trajectory stability threshold and the trajectory confidence convergence coefficient is greater than a preset trajectory confidence threshold. The quota increase confirmation unit is configured to, when the quota increase conditions are met, determine the confirmation quota for the current denoising step based on the original scheduling quota, the number of mask tokens for the current denoising step, the maximum total number of denoising steps, the upper limit of single-step confirmation ratio, and the freeze acceleration multiple.
[0034] In one exemplary embodiment of this disclosure, the noise reduction process control module includes: The candidate mask token set determination unit is configured to execute a mask token set based on the mask token positions where the target action is either the retain and recalculate action or the reuse history cache action, and the confidence signal is greater than a preset parallel confirmation threshold. The target mask token position determination unit is configured to sort the mask token positions in the candidate mask token set according to the trajectory fusion score, and determine the target mask token position to be confirmed from the candidate mask token set based on the confirmation quota and the sorting result. The target mask token location confirmation unit is configured to confirm the target mask token location based on cached data of the target mask token location.
[0035] According to a third aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement the model acceleration method described in any of the preceding claims.
[0036] According to a fourth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the model acceleration method described in any of the preceding claims.
[0037] The exemplary embodiments disclosed herein can have the following beneficial effects: In the model acceleration method of this exemplary embodiment, after the conventional forward propagation of each denoising step, the multi-source acceleration signals are unified into interpretable trajectory description signals. Then, a unified action strategy drives token-level processing decisions, and trajectory-level convergence gating drives sequence-level early stopping. The model acceleration method in this exemplary embodiment, on the one hand, can introduce the ability to backtrack and correct the positions of frozen tokens without modifying model weights or introducing additional computational paths. It explicitly models and eliminates three types of trajectory-level failure modes—oscillation, cascading collapse, and premature freezing—during multi-step denoising. On the other hand, by establishing a window convergence criterion and replacing the fixed number of denoising steps with trajectory-level convergence evidence, the sequence immediately exits the denoising process when it has actually stabilized, achieving sequence-level early stopping to obtain end-to-end acceleration at the pure algorithm level. Furthermore, it can be deployed as a lightweight controller layer superimposed on the existing diffusion language model inference stack, allowing the entire mechanism to be integrated into the existing diffusion language model inference stack in a way that is training-independent, has low engineering modification costs, and is compatible with orthogonal kernel acceleration such as sparse attention, meeting the deployment requirements of millisecond-level online inference.
[0038] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0039] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0040] Figure 1 A heatmap of confidence in the denoising trajectory of a diffusion language model in a related embodiment of this disclosure is shown. Figure 2 A schematic flowchart of a model acceleration method according to an exemplary embodiment of this disclosure is shown; Figure 3 A schematic diagram illustrating the process of constructing a trajectory description signal for each token position according to an exemplary embodiment of this disclosure is shown; Figure 4 A flowchart illustrating the determination of the stability signal corresponding to the token position in an exemplary embodiment of this disclosure is shown. Figure 5 A schematic flowchart illustrating the trajectory fusion process for determining the token location in an exemplary embodiment of this disclosure is shown. Figure 6 A flowchart illustrating the target action of determining the token location in an exemplary embodiment of this disclosure is shown; Figure 7 A flowchart illustrating the determination of whether the recalculation triggering condition is met in an exemplary embodiment of this disclosure is shown. Figure 8 A flowchart illustrating a target action for determining the token position based on trajectory fusion analysis, according to an exemplary embodiment of this disclosure, is shown. Figure 9 A schematic diagram of a state machine for four types of token-level actions is shown in a specific embodiment of this disclosure; Figure 10 A schematic diagram of the process for confirming the position of the mask token in an exemplary embodiment of this disclosure is shown; Figure 11 A system architecture diagram of a trajectory awareness strategy framework in a specific embodiment of this disclosure is shown; Figure 12 A schematic diagram showing a comparison of model acceleration results in one specific embodiment of this disclosure is illustrated. Figure 13 A block diagram of a model acceleration apparatus according to an exemplary embodiment of the present disclosure is shown; Figure 14 A schematic diagram of the structure of a computer system suitable for implementing the embodiments of the present disclosure is shown. Detailed Implementation
[0041] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.
[0042] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein.
[0043] The following exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more of the specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0044] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0045] In some related embodiments, the main technical approaches for accelerating training-agnostic inference for diffusion language models include: feature caching and reuse based on inter-step state similarity (such as dLLM-Cache (Accelerating Diffusion Large Language Models with Adaptive Caching), d²Cache (dual adaptive caching)); parallel token confirmation based on confidence thresholds (such as Fast-dLLM (Training-free Acceleration of Diffusion LLM by Enabling KV Cache and Parallel Decoding), SchED (Schedule-based Early Decoding), Dynamic-dLLM (Dynamic Cache-Budget and Adaptive Parallel Decoding for Training-Free Acceleration of Diffusion LLM)); and level skipping based on stability (such as ES-dLLM (Efficient Inference for Diffusion Large Language Models)). Early-skipping (for efficient inference in diffusion-based large language models), low-salience key-value eviction based on memory budget (e.g., Sparse-dLLM (Accelerating Diffusion LLMs with Dynamic Cache Eviction), joint adaptive scheduling based on block size and number of steps (e.g., CadLLM (Confidence-Aware Calibration for dLLM), and revision-based decoding based on speculative decoding or reversal mechanisms (e.g., Spiffy (Speculation for Diffusion LLM Efficiency) and S2D2 (Fast Decoding for Diffusion LLMs via Training-Free Self-Speculation)).Methods such as diffusion-based large language models that achieve fast decoding through self-speculation without training, TOLERATOR (Token-Level Cross-Validation Refinement), and WINO (Wide-In, Narrow-Out) are significant in industrial online services requiring millisecond-level response times, such as search engine result summarization, intelligent question answering, and code assistants.
[0046] Accelerating training-independent inference for diffusion language models can be categorized into the following solutions: Option 1: A method for reusing prompts and responses based on inter-step similarity Represented by dLLM-Cache and Fast-dLLM, these methods are based on the observation that the state changes of most tokens are small between adjacent denoising steps in the diffusion language model. They propose a training-independent feature caching and reuse framework, the core of which is as follows: The input sequence is divided into a static prompt part and a dynamic response part. For the prompt part, since its content does not change throughout the denoising process, its key-value state is cached and reused at long intervals (e.g., refreshed every few steps). For the response part, the similarity of the hidden state features at that position between two adjacent steps (e.g., cosine similarity) is calculated. If the similarity is higher than a set threshold, the hidden state of the previous step is directly reused; otherwise, the entire hidden state is recalculated.
[0047] Formalistically, given the first Hidden state of step With the Hidden state of step , regarding position calculate:
[0048] in, Indicates the current candidate state Reference state obtained from the most recent cache refresh at this location The cosine similarity, where the superscript ref is an abbreviation for reference (reference cache state); This represents the reuse action at position i in step t, which can be either Reuse or Recompute; τ is the reuse threshold. Fast-dLLM further introduces bidirectional caching and a parallel token confirmation mechanism based on confidence thresholds: when the maximum Softmax probability of a token position is higher than the threshold τ_conf, the token is immediately confirmed, allowing multiple tokens to be confirmed simultaneously in each step, thereby achieving an end-to-end acceleration of approximately 2.5× to 2.6× on models such as LLaDA-8B.
[0049] The problems with Option 1 are as follows: 1. Relying solely on single-step snapshot signals makes it difficult to identify oscillating tokens and cascaded sensitive tokens: Tokens with high feature similarity between two adjacent steps may not be stable. Some tokens will repeatedly switch between high and low confidence levels during the denoising process (i.e., oscillation). Single-step snapshots cannot identify such oscillations, causing them to be incorrectly confirmed or incorrectly reused when the confidence level just exceeds the threshold.
[0050] 2. Lack of modeling for the impact of multi-step context: Whether a token's state is reused essentially depends on the token's overall stability in the multi-step trajectory and the degree to which it is affected by the attention of other tokens. A single similarity threshold cannot model the multi-step cascading effect and is prone to causing subsequent multi-step inference to collapse after a hub token (such as an operator in an arithmetic expression) is incorrectly frozen.
[0051] 3. Strong coupling between early stopping signal and buffer reuse: The above method does not have an explicit trajectory-level convergence criterion and can only rely on a fixed number of denoising steps. Even if the sequence has been fully converged in the middle section, a complete T-step forward pass is still required, resulting in a large amount of invalid computation.
[0052] 4. Unable to rollback and correct frozen tokens: Once a token is prematurely confirmed or reused with high confidence, even if subsequent steps find that it is inconsistent with the context, there is no mechanism to put it back into the set to be denoised, which leads to cascading crashes, especially noticeable in highly sensitive tasks such as code generation.
[0053] Option 2: Adaptive Token Confirmation and Scheduling Method Based on Single-Step Confidence Threshold
[0054] Represented by SchED, Dynamic-dLLM, and CadLLM, these methods revolve around deciding whether to confirm the token at each step based on some local signal. Their core mechanism is as follows: SchED usage and noise reduction progress Related scheduling-dependent thresholds Control the confidence threshold for each step of parallel token confirmation:
[0055] in, The baseline parallel confirmation confidence threshold is used at the start of denoising; For the scheduling change amplitude coefficient, control The threshold adjustment intensity and direction; g(·) is a monotonic function of the denoising progress t / T. Dynamic-dLLM introduces the adjacent step distribution drift as an additional signal, and dynamically corrects the confidence threshold according to the drift amplitude. CadLLM, on the other hand, combines adaptive block size and number of steps, increasing the block size and decreasing the number of steps when the confidence slope rises rapidly, thereby achieving higher parallelism.
[0056] The problems with Option 2 are as follows: 1. Single signal dimension: The core of the above methods is still a single confidence signal or a single auxiliary signal (drift, progress) superimposed on the confidence, which fails to characterize the actual usefulness of the token from multiple dimensions such as hidden state stability, attention influence, and memory budget.
[0057] 2. Lack of robust trajectory sliding window accumulation: All decisions are based on the current step or the signals of the current and previous steps. It cannot distinguish between a stable token with sustained high confidence and an oscillating token that jumps to high confidence at this step, resulting in significant accuracy loss under aggressive settings.
[0058] 3. No Rollback: Once a token is confirmed based on a single-step signal, subsequent steps cannot revoke the confirmation based on trajectory evidence. This can lead to a high speedup but a significant drop in accuracy when encountering cascaded sensitive tasks (such as GSM8K mathematical reasoning and HumanEval code generation).
[0059] 4. Separation of early stopping decision and token-level action: Although the scheduling adaptive method can adjust the number of steps, its decision-making basis and the judgment on whether to retain / reuse / discard each token belong to two sets of rules, which fail to be coupled and optimized under a unified framework.
[0060] Option 3: Layer Skip and Sparse Elimination Method Based on Stability and Significance
[0061] Represented by ES-dLLM, d²Cache, and Sparse-dLLM, these methods accelerate inference in diffusion language models from the perspectives of hierarchical stability, attention multi-path accumulation, and memory budget pressure. ES-dLLM compares the change in the hidden state of each layer relative to the previous step after each layer's computation. If If the value is less than the threshold, the update of the next few steps of that layer is skipped; d²Cache uses Attention Rollout (attention path accumulation, accumulation and normalization of the attention matrix along the layer direction) to quantify the multi-layer influence of each token position, and performs differential caching according to the influence from high to low; Sparse-dLLM eliminates low-value KV entries according to significance (low influence, high confidence) when the video memory reaches the limit.
[0062] The problems with Option 3 are as follows: 1. Single signal isolated operation: Stability (ES-dLLM), impact (d²Cache), and budget pressure (Sparse-dLLM) are used independently in different methods, lacking integration, and it is difficult to simultaneously satisfy the more reliable judgment of being stable, having a large impact, and having a budget that allows for retention.
[0063] 2. No accumulation of cross-step evidence: ES-dLLM compares before and after the current step, d²Cache accumulates multiple layers according to the current step, and Sparse-dLLM accumulates according to the current memory pressure. None of them accumulate multi-step trajectories in the sense of a sliding window.
[0064] 3. Even after convergence, the process continues with a fixed number of steps: The above methods all decide to skip / keep / eliminate based on a fixed T-step budget, and cannot determine at the sequence level whether the entire trajectory has converged and thus prematurely end the denoising process.
[0065] 4. Lack of failure safety mechanism: Under aggressive skipping and aggressive elimination conditions, if a token is mistakenly discarded, there is no mechanism to recall it in subsequent steps, lacking robustness guarantee against cascading failure.
[0066] Option 4: A revised acceleration method based on reversal and speculative decoding
[0067] Represented by TOLERATOR and WINO, revision-based methods allow diffusion language models to remask or revoke confirmed tokens during the denoising process. A typical approach of WINO is to trigger the revocation of confirmed tokens with low current confidence at each step, and then put them back into the denoising set for recalculation. Spiffy and S2D2, on the other hand, utilize speculative decoding, with a small model drafting the code and a large model validating it.
[0068] The problems with Option 4 are as follows: 1. The triggering basis is the current step snapshot, not multi-step trajectory evidence: WINO triggers revocation when it finds that the current confidence of the token is low at a certain step. It cannot distinguish between temporary disturbances and cascading collapse precursors, which can easily introduce unnecessary repeated oscillations.
[0069] 2. Lack of clear multi-source triggering conditions: The decision to withdraw relies solely on a single confidence signal, without combining multiple trajectory-level evidence such as entropy increase, attention redirection, and sequence-level confidence decrease for joint judgment.
[0070] 3. The reversal mechanism is independent of early stopping and cache reuse: The revision method only solves the problem of whether to roll back, and is not uniformly scheduled under the same controller as other acceleration mechanisms such as cache reuse, sparse eviction, and adaptive scheduling.
[0071] 4. Inference decoding is costly in bidirectional attention scenarios: each forward step of dLLM involves computation of the full-length sequence, and the draft / verification models introduced by inference decoding place higher demands on GPU memory and computing power, making it difficult to implement in industrial settings with low modification costs.
[0072] The aforementioned training-independent acceleration methods all share a common fundamental limitation: they rely on single-step snapshot signals for cache reuse, skipping decisions, or token confirmation. However, the typical phenomena exhibited by diffusion language models during multi-step denoising, such as oscillations, cascading collapses, and premature freezing, are essentially multi-step trajectory-level behaviors that cannot be captured by single-step signals. Consequently, existing methods often sacrifice significant accuracy in pursuit of high speedup ratios. How to extract multi-dimensional steady-state / influence signals from the entire denoising trajectory of a diffusion language model without modifying model weights, and how to drive token-level actions and sequence-level early stopping with a unified strategy, has become a key technical problem for improving the industrial usability of diffusion language models.
[0073] Figure 1 A heatmap of confidence scores for a diffusion language model denoising trajectory is shown in one relevant embodiment of this disclosure. It primarily displays the confidence scores of tokens at various positions during the 64-step denoising process of the diffusion language model on GSM8K (Grade School Math 8K, a mathematical reasoning benchmark containing multi-step arithmetic word problems) samples. The heatmap visually illustrates the three types of trajectory-level failure modes: the dotted-line area represents oscillating tokens (whose confidence repeatedly jumps between adjacent steps); the dashed-line area represents cascading sensitive tokens (where a sudden drop in confidence of approximately 0.5 occurs in a single step in the middle); the vertical dashed line represents an early stopping candidate point around step 32; and the continuous area to the upper right of the vertical dashed line (approximately token positions 17-30) represents prematurely frozen tokens (most positions were stable before step 30 but were still forcibly recalculated to step 64). These phenomena are not visible from any single-step snapshot perspective and can only be observed at the complete trajectory level.
[0074] To address the aforementioned issues, this example implementation first provides a model acceleration method. (Reference) Figure 2 As shown, the above model acceleration method may include the following steps: Step S210. For each token position in the current denoising step of the sequence to be processed in the diffusion language model, construct the trajectory description signal corresponding to each token position, and obtain the trajectory fusion score of the token position based on the trajectory description signal.
[0075] Step S220. Based on the trajectory fusion score of the token position and the recalculation trigger condition, determine the target action of the token position, and update the cached data of the token position based on the target action.
[0076] The target action is one of the following token-level actions: retain and recalculate, reuse history cache, freeze and abandon, and recall and recalculate.
[0077] Step S230. Obtain the trajectory convergence coefficient based on the trajectory description signal of the mask token position in the unconfirmed state in the token position, and determine the confirmation quota of the current denoising step based on the trajectory convergence coefficient.
[0078] Step S240. Based on the cached data of confirmed quota and mask token positions, confirm the mask token positions, and after all mask token positions have been confirmed, control the diffusion language model to exit the current denoising process.
[0079] In the model acceleration method of this exemplary embodiment, after the conventional forward propagation of each denoising step, the multi-source acceleration signals are unified into interpretable trajectory description signals. Then, a unified action strategy drives token-level processing decisions, and trajectory-level convergence gating drives sequence-level early stopping. The model acceleration method in this exemplary embodiment, on the one hand, can introduce the ability to backtrack and correct the positions of frozen tokens without modifying model weights or introducing additional computational paths. It explicitly models and eliminates three types of trajectory-level failure modes—oscillation, cascading collapse, and premature freezing—during multi-step denoising. On the other hand, by establishing a window convergence criterion and replacing the fixed number of denoising steps with trajectory-level convergence evidence, the sequence immediately exits the denoising process when it has actually stabilized, achieving sequence-level early stopping to obtain end-to-end acceleration at the pure algorithm level. Furthermore, it can be deployed as a lightweight controller layer superimposed on the existing diffusion language model inference stack, allowing the entire mechanism to be integrated into the existing diffusion language model inference stack in a way that is training-independent, has low engineering modification costs, and is compatible with orthogonal kernel acceleration such as sparse attention, meeting the deployment requirements of millisecond-level online inference.
[0080] Below, in conjunction with Figures 3 to 12 The steps described above in this example implementation will be explained in more detail.
[0081] In step S210, for each token position of the sequence to be processed in the diffusion language model in the current denoising step, a trajectory description signal corresponding to each token position is constructed, and the trajectory fusion score of the token position is obtained based on the trajectory description signal.
[0082] In this example implementation, the diffusion language model is a diffusion language model that generates text through iterative denoising. It performs multiple denoising steps on a fully masked sequence to generate the final output. Representative models include LLaDA (Large Language Diffusion with mAsking) and Dream (Diffusion Language Model). The sequence to be processed refers to the input data or text sequence being denoised by the diffusion language model. This sequence consists of multiple discrete units, each called a token. The token position refers to a specific unit in the sequence to be processed, usually corresponding to a word, subword, or character in the text. The denoising step is an iterative stage in the inference process of the diffusion language model. In each denoising step, the model attempts to recover a state closer to the original data from the noisy intermediate representation.
[0083] In this example implementation, the trajectory refers to the stepwise state sequence generated by the diffusion language model for the same sequence during multi-step denoising, including the temporal evolution of hidden states, attention distribution, and confidence at each step. The trajectory description signal is a set of signals used to describe the dynamic behavior of a specific token position in multiple consecutive denoising steps. It may include stability signals, influence signals, confidence signals, and budget pressure signals. These signals aim to capture information such as the token's stability, importance, confidence, and resource consumption. The trajectory fusion score is a numerical value calculated based on multiple trajectory description signals. This score is used to quantitatively evaluate the overall stability, convergence trend, or importance of a token position in the current denoising process.
[0084] For each layer of hidden states, layer of attention matrices and output Softmax distribution generated after each denoising step, four types of original signals are calculated: stability, influence, confidence and budget pressure. An exponential moving average is applied to each type of signal within the most recent K-step window to obtain the four-dimensional trajectory description signal for each token position.
[0085] For example, suppose the diffusion language model is in the... During step denoising, for lengths of The sequence produces the first Hidden state , No. Layer attention matrix And the output layer's token-by-token Logits Where d is the dimension of the hidden state vector of a single token in this layer; V is the vocabulary size; and Logits is the original prediction score (unnormalized score) for each vocabulary candidate before Softmax normalization. For each token position... In the The four-dimensional trajectory is defined as follows to describe the signal:
[0086] in, Indicates stability signal, Indicates the degree of influence signal. This represents the confidence level signal. These represent budget pressure signals. The above four types of signals are collected from the model's regular first-order dense forward pass, and the controller does not introduce additional model calculations.
[0087] In this example implementation, such as Figure 3 As shown, constructing the trajectory description signal corresponding to each token position can specifically include the following steps: Step S310. Obtain the stability signal corresponding to the token position based on the change in the normalized hidden state between adjacent denoising steps.
[0088] Stability signal It can be used to characterize the relative change of the hidden state of token position i between two adjacent steps. The smaller the change, the closer the stability is to 1, indicating that the token has gradually converged on the denoised trajectory; the larger the change, the closer the stability is to 0, indicating that the token may still be in a state of violent adjustment or oscillation.
[0089] In this example implementation, such as Figure 4 As shown, the stability signal corresponding to the token position is obtained based on the change in the normalized hidden state between adjacent denoising steps. Specifically, this can include the following steps: Step S410. Obtain the hidden state difference based on the hidden states generated by the diffusion language model in the current denoising step and the previous denoising step for the sequence to be processed.
[0090] The hidden state is an internal representation generated by the diffusion language model at a specific layer or time step when processing a sequence. It contains semantic information about the current token and its context. In the current denoising step and the previous denoising step, the diffusion language model generates a corresponding hidden state for each token position in the sequence to be processed. By calculating the difference between the hidden states of the same token position in these two adjacent denoising steps, the degree of change in the token's internal representation within the model can be quantified.
[0091] Specifically, the formula for calculating the hidden state difference is as follows:
[0092] in, For the diffusion language model in the first During step denoising, for lengths of The sequence produces the first Hidden state, For the diffusion language model in the first During step denoising, for lengths of The sequence produces the first Hidden layer state.
[0093] Step S420. Based on the difference between the hidden states and the hidden states generated in the previous denoising step, obtain the change in the normalized hidden states.
[0094] The normalized change in the hidden state refers to the result of standardizing the hidden state difference obtained above, combined with the hidden state generated in the previous denoising step. The purpose of this normalization process is to eliminate potential scale differences in the hidden state difference, making the changes between different token positions or different denoising steps comparable.
[0095] Specifically, the change in the normalized hidden state of token position i between adjacent denoising steps is:
[0096] This parameter is actually based on the token position vector. Calculation, i.e. comparison and Instead of taking the uniform norm for the entire N×d matrix.
[0097] Step S430. Obtain the stability signal corresponding to the token position based on the change in the normalized hidden state.
[0098] The stability signal can be calculated based on the change in the normalized hidden state and is used to quantify the stability of the token position in the denoising process of the diffusion language model.
[0099] Specifically, the formula for calculating the stability signal is as follows:
[0100] Generally, the smaller the change in the normalized hidden state, the more stable the hidden state at that token position, and the higher its corresponding stability signal value; conversely, the larger the change, the lower the stability signal value.
[0101] Step S320. Based on the overall influence of the token position on other token positions in the current denoising step, obtain the influence signal corresponding to the token position.
[0102] Influence signal To quantify the overall impact of token position i on other positions in this forward step, for example, the overall impact of token position i on other positions in this forward step can be quantified by multiplying the multi-layer attention path.
[0103] In this example implementation, a multi-level attention path multiplication operator can be obtained based on the attention matrix generated by the diffusion language model in the current denoising step of the sequence to be processed; then, the influence signal corresponding to the token position can be obtained based on the multi-level attention path multiplication operator.
[0104] The attention matrix generated by the diffusion language model for the sequence to be processed in the current denoising step refers to the weight matrix calculated by the diffusion language model's internal attention mechanism when performing the current denoising step. The attention mechanism allows the model to dynamically weigh the importance of other tokens in the sequence when processing each token. This attention matrix quantifies the direct correlation strength between any two tokens in the sequence. The multi-layer attention path accumulation operator is obtained by accumulating the attention matrices of multiple attention layers in the diffusion language model, aiming to capture the indirect and cumulative effects transmitted between tokens through the multi-layer attention mechanism.
[0105] Specifically, the calculation method for the multi-level attention path accumulation operator is as follows:
[0106] in, It is a multi-level attention path accumulation / attention propagation operator. Let I be the attention matrix of the l-th layer after multi-head aggregation, where I is the identity matrix and rownorm denotes row-by-row normalization. The input to the multi-layer attention path accumulation operator is the attention matrix of each layer after multi-head aggregation. First, add an identity residual I to each layer and scale it, then multiply it sequentially according to the layer order, and finally normalize it row by row using rownorm. By incorporating residual identity mapping, the degradation bias of attention at each layer is mitigated. After multiplication and normalization, the path influence matrix from input to output is obtained. The overall influence at each position is obtained by summing along the attention dimension.
[0107] The influence signal is an indicator that quantifies the overall influence of a specific token position on other token positions in a sequence. Its calculation is based on a multi-level attention path accumulation operator. The formula for calculating the influence signal is as follows:
[0108] After multiplying the matrices of each layer in the network hierarchy, the results are then aggregated according to the dimension of the attention location to obtain the overall influence of position i. A higher influence signal value indicates that the token plays a more important role in the information flow within the model, and its state changes or recalculations may have a wider impact on the representation of the entire sequence.
[0109] Step S330. Obtain the confidence signal corresponding to the token position based on the maximum probability of the Softmax distribution of the token position in the current denoising step.
[0110] Confidence signal To represent the degree of certainty the model has about the current prediction result for the token, the maximum probability of the Softmax distribution at the current step can be taken:
[0111] The confidence signal directly reflects the sharpness of the output distribution at that location and is a standard basis for confirming tokens.
[0112] Step S340. Obtain the budget pressure signal corresponding to the token position based on the memory usage of the token position.
[0113] In this example implementation, a normalized memory pressure value can be obtained based on the baseline memory usage, current memory usage, and upper limit of memory usage at the token position; then, the budget pressure signal corresponding to the token position can be obtained based on the normalized memory pressure value and the denoising progress corresponding to the current denoising step.
[0114] Baseline memory usage refers to the amount of memory resources required for a specific token position under ideal or initial conditions during model execution. For example, it can be measured as a baseline for memory usage at each token position during model loading, or calculated based on static attributes such as token embedding dimension and model layer number. Current memory usage refers to the actual amount of memory resources consumed by a specific token position in the current denoising step. Maximum memory usage refers to the maximum allowed memory usage set by the system or user for each token position.
[0115] Normalized memory pressure converts the memory usage at the token location into a uniform, comparable value. Specifically, normalized memory pressure... for:
[0116] in, These are the baseline memory usage, current memory usage, and maximum memory usage, respectively. The greater of the two factors determines the overall budget pressure.
[0117] Budget pressure signals This is used to couple the time budget and memory budget pressure signals. Specifically, the formula for calculating the budget pressure signal is as follows:
[0118] in, For noise reduction progress, It is the maximum nominal denoising steps preset before decoding starts (e.g., 64 steps), and t is the current denoising step; if early stop is triggered, the actual number of steps executed can be less than T.
[0119] In this example implementation, the denoising progress corresponding to the current denoising step can be obtained based on the current denoising step and the preset maximum total number of denoising steps.
[0120] Based on the current denoising step and the preset maximum number of denoising steps, a quantized value can be calculated to represent the degree of completion of the denoising process. This progress value is typically a normalized value between 0 and 1. For example, it can be obtained by dividing the value of the current denoising step by the preset maximum number of denoising steps, or by using a non-linear function to map the current step to the interval between 0 and 1 to reflect the weight or importance of denoising at different stages.
[0121] In this example implementation, a multi-dimensional trajectory description signal is constructed by introducing stability, influence, confidence, and budget pressure signals. The stability signal reflects the degree of convergence of the token content, the influence signal reveals the importance of the token to the overall sequence, the confidence signal quantifies the model's certainty in predicting the token, and the budget pressure signal quantifies the degree of resource consumption. This comprehensive description makes subsequent trajectory fusion calculations more accurate, enabling more intelligent determination of the token's target action and the confirmation quota for the current denoising step. Compared to methods that rely on only single or limited information to evaluate the token state, this scheme significantly improves the efficiency and accuracy of model acceleration, effectively avoids erroneous decisions due to insufficient information, ensures that the quality of generated content is maintained or even optimized while accelerating the process, and achieves a more rational allocation of computing resources.
[0122] In this example implementation, such as Figure 5 As shown, obtaining the trajectory fusion score of the token position based on the trajectory description signal can specifically include the following steps: Step S510. Based on the preset window length, determine the current denoising step and multiple adjacent historical denoising steps as the target window.
[0123] The target window refers to the range of windows encompassing the most recent denoising steps, including the current one. Its purpose is to provide a window interval that allows the evaluation of the token trajectory to consider its changing trend over a period of time, rather than relying solely on the instantaneous state. This helps smooth signal fluctuations and improves the robustness of the evaluation. The target window can be determined based on a preset fixed length, such as the K most recent denoising steps; or the window length can be dynamically adjusted according to the model's running state. For example, a longer window can be used in the early stages of model convergence to capture more historical information, while a shorter window can be used later to quickly respond to the latest changes.
[0124] Step S520. Based on the preset attenuation coefficient, perform a moving average on each type of trajectory description signal within the target window to obtain the window average value corresponding to each type of trajectory description signal.
[0125] The attenuation coefficient is a weighting parameter used in moving average calculations to assign different levels of importance to the trajectory description signal at different time points. Generally, historical data closer to the current denoising step has a larger attenuation coefficient, indicating a greater impact on the current evaluation; historical data further back has a smaller attenuation coefficient, indicating a gradually weakening impact. The attenuation coefficient can use either an exponential or linear decay function.
[0126] Moving average is a time series analysis method used to smooth data and reduce the impact of short-term fluctuations, reflecting long-term trends. It can be applied to smoothing data of various trajectory description signals within a target window. The window average is the result obtained after processing various trajectory description signals using moving average; it represents the average level or trend of the signal within the target window.
[0127] Specifically, for each token position i and each type of trajectory description signal x∈{stab, infl, conf,bud}, an exponentially weighted average can be performed within the most recent K-step window (e.g., default K=5, decay coefficient). =0.9; Budget pressure signals are shared across all locations). Its explicit finite window form is:
[0128] K represents retaining at most K historical observations within the interval [t-K+1,t]. The above steps yield a four-dimensional trajectory description signal after trajectory smoothing. Windowing is a key engineering aspect distinguishing it from all single-step snapshot methods: the window stability and window confidence of the oscillation token cannot converge to a high level, thus avoiding incorrect identification as KEEP or DEFER, fundamentally eliminating false confirmations caused by oscillations.
[0129] In this example implementation, the window moving average method can also be replaced by a simple arithmetic average. Alternatively, a weighted average (linear weights or Gaussian kernel weights) or median filtering can be used, taking the median of observations within the window for better robustness to abrupt changes. In addition, adaptive window lengths can be employed. For example, a shorter window can be used in the early stages of noise reduction (for faster response) and a longer window can be used in the later stages (for greater robustness). This example implementation does not impose any specific limitations.
[0130] Step S530. Obtain the basic fusion score based on the window average value and signal weight corresponding to the stability signal, influence signal and confidence signal, respectively.
[0131] Signal weights are parameters used to assign different levels of importance to the window averages of different types of trajectory description signals when calculating the base fusion score and suppression term. The base fusion score is a preliminary evaluation score obtained by comprehensively considering the window averages and their signal weights of the stability signal, influence signal, and confidence signal.
[0132] For example, stability, impact, and confidence can be weighted. (As default) The weighted fusion is performed to obtain the basic fusion score. .
[0133] Step S540. Obtain the suppression term based on the window average value and signal weight corresponding to the budget pressure signal, and obtain the trajectory fusion score of the token position based on the basic fusion score and the suppression term.
[0134] The suppression term is a correction value calculated based on the window average of the budget pressure signal and its signal weight. It is used to reflect the impact of resource consumption in the trajectory fusion score. For example, when budget pressure is high, the suppression term will reduce the trajectory fusion score, thus favoring the selection of more resource-efficient actions.
[0135] For example, a multiplicative inhibition term can be obtained from budget pressure signals. Thus, the trajectory fusion score of the token position is obtained based on the basic fusion score and the suppression term:
[0136] in Budget sensitivity (e.g., default) When budget pressure is high, all signals are reduced as a whole, which is equivalent to tightening the overall budget when memory or time is tight; when the budget is sufficient, almost no suppression occurs.
[0137] In this example implementation, budget pressure is reduced by a multiplicative suppression term. The weighted fusion score is applied to stability / impact / confidence, and is used as... Budget-sensitive compaction is applied to the KEEP / DEFER threshold. This multiplicative structure covers both explicit budget allocation and implicit dynamic resource scheduling scenarios, and... When the value approaches 0, it degenerates into a Dynamic-dLLM-type scheme.
[0138] In this example implementation, the stability signal can also be replaced by the cosine similarity of the hidden states of each layer, i.e. Additionally, the influence signal can be replaced with the mean of a single layer of attention (without multiplication) to simplify the calculation, and the confidence signal can be replaced with the distribution entropy. Normalized negative value Furthermore, the budget pressure signal can be replaced with a latency budget, such as the remaining SLA (Service Level Agreement) time. In addition, a gradient norm signal can be introduced as a fifth dimension (only in scenarios with inversion), but this example implementation does not impose specific limitations. After the replacement, the controller's sliding window and four-action strategy remain unchanged; only the fusion weights need to be recalibrated. With threshold .
[0139] In this example implementation, the concept of a trajectory-aware unified controller is proposed for the first time in the field of accelerating inference in diffusion language models. This controller integrates four types of signals—stability, influence, confidence, and budget pressure—into a single, recently... Within the step window, exponential moving average aggregation is used to obtain a multi-step trajectory description signal for each token, and a single controller simultaneously drives token-level actions and sequence-level early stops.
[0140] Through the above technical solution, in the process of accelerating the diffusion language model, the calculation of the trajectory fusion score for the token position no longer relies solely on the instantaneous signal of the current denoising step. Instead, it comprehensively considers the token's historical performance over a period of time by introducing a target window and a moving average mechanism. This processing method effectively smooths out short-term fluctuations and noise interference in the trajectory description signal, making the obtained window average more representative and stable. Based on this, the basic fusion score is obtained by combining the window averages and signal weights of the stability signal, influence signal, and confidence signal, and the window average and signal weight of the budget pressure signal are introduced as a suppression term. The final trajectory fusion score can more comprehensively and accurately reflect the true state of the token and resource consumption. This significantly improves the robustness and accuracy of the token state assessment, making subsequent target action decisions more reasonable and efficient, effectively avoiding erroneous judgments caused by instantaneous signal fluctuations, and thus improving the overall stability and performance of the diffusion language model acceleration.
[0141] Continue to refer to Figure 2 As shown, in step S220, the target action of the token position is determined based on the trajectory fusion score of the token position and the recalculation trigger condition, and the cached data of the token position is updated based on the target action.
[0142] In this example implementation, the recalculation trigger condition is a set of preset conditions. When these conditions are met, it indicates that one or more token positions may need to be recalled and recalculated. The target action is the specific processing method determined for that token position based on the trajectory fusion score and the recalculation trigger condition. It can guide the model on how to process the cached data for that token position. Cached data refers to historical calculation results, intermediate hidden states, or other auxiliary information related to a specific token position.
[0143] In this example implementation, the target action can be one of the following token-level actions: retain and recalculate, reuse history cache, freeze and abandon, and recall and recalculate. The four types of token-level actions and their semantics are as follows: KEEP (Keep and Recalculate Actions): Performs regular calculations based on the current hidden state, ensuring that all updates at this position are used in this step; DEFER (Reuse History Cache Action): Preserves the previously cached hidden state as the current step state at this position, skips the current step and recalculates, saving the calculation at this position; PRUNE (Freeze and Abandon Action): Freeze and remove this position from the denoising set, and subsequent steps will no longer participate in the update until RECOVER occurs; RECOVER (Recall and Recalculate): Recalls previously frozen positions to participate in the current step of denoising, revises their freezing results, and continues to be classified according to the new strategy.
[0144] Among them, RECOVER is a key action, which is determined by three types of trajectory-level triggering conditions and OR logic.
[0145] In this example implementation, such as Figure 6 As shown, the target action for the token location is determined based on the trajectory fusion score of the token location and the recalculation trigger condition. This can specifically include the following steps: Step S610. Determine whether the recalculation trigger condition is met based on multiple trajectory-level judgment conditions, and when the recalculation trigger condition is met, determine the recall recalculation action as the target action of the token position.
[0146] The recalculation trigger condition is a comprehensive judgment condition used to determine whether a recall recalculation action needs to be forcibly executed at a certain token position. The recall recalculation action is a mandatory, highest-priority processing method. When the model detects that a token is in a highly uncertain or erroneous state, executing this action ensures that the token re-participates in the denoising process from the beginning, thereby correcting potential errors and improving the quality of the final output.
[0147] In this example implementation, the trajectory-level decision criteria may include the entropy slope decision criteria, the attention redirection decision criteria, and the sequence-level confidence decrease decision criteria.
[0148] In this example implementation, such as Figure 7 As shown, determining whether the recalculation trigger condition is met based on multiple trajectory-level judgment conditions can specifically include the following steps: Step S710. If the estimated slope of the output distribution entropy of the token position in the most recent denoising steps is greater than the preset slope threshold, then the entropy slope determination condition is met.
[0149] slope estimate This indicates that the slope of the output distribution entropy at that position is estimated over the last three steps, reflecting whether the uncertainty at that position suddenly increases near the end of the trajectory.
[0150] The entropy slope determination condition is that if the estimated slope of the output distribution entropy of the token position in the most recent denoising steps is greater than the preset slope threshold, then the condition is met.
[0151] Step S720. If the average attention directed from the unfrozen set to the current frozen set is greater than the preset attention threshold, then the attention redirection judgment condition is met.
[0152] Average attention It represents the average attention directed from the unfrozen support set to the currently frozen set, reflecting whether the context is refocusing on previously frozen locations, and is a typical context redirection signal.
[0153] The condition for determining attention redirection is that if the average attention directed from the unfrozen set to the currently frozen set is greater than a preset attention threshold, then this condition is met.
[0154] Step S730. If the decrease in the average confidence level of the sequence within the preset sequence window relative to the peak value within the window is greater than the preset decrease threshold, then the sequence-level confidence decrease judgment condition is met.
[0155] Decline It represents the decrease in the average confidence level of the sequence relative to the peak value within the window, reflecting whether the overall confidence level of the entire trajectory has declined.
[0156] The condition for determining the decrease in sequence-level confidence is that if the decrease in the average confidence of the sequence level within a preset sequence window relative to the peak value within the window is greater than a preset decrease threshold, then the condition is met.
[0157] Step S740. When one of the entropy slope determination condition, attention redirection determination condition, and sequence-level confidence decrease determination condition is met, the recalculation trigger condition is determined to be met.
[0158] If any one of the following conditions is met—the entropy slope criterion, the attention redirection criterion, or the sequence-level confidence decrease criterion—it indicates that there may be a problem with the generation trajectory of the current token or the entire sequence, requiring an immediate recalculation to correct potential errors or instabilities. The recalculation trigger conditions are as follows:
[0159] in, The default trigger threshold is set to [value]. .
[0160] The RECOVER action is triggered by any one of the following conditions: entropy slope determination, attention redirection determination, or sequence-level confidence decrease determination. Specifically, this involves removing the position from the frozen set, clearing its outdated logits, and having it re-participate in the dense forward pass in the current step, accepting a new policy decision. The RECOVER action is triggered with a strict higher priority than the other three actions, preventing the inertial reuse of high-confidence but expired frozen states. This multi-layered protection mechanism enables the model to identify and respond to anomalies in the generation process more promptly and accurately, avoiding error accumulation and propagation. By utilizing three types of multi-step evidence—entropy slope, attention redirection, and sequence-level confidence decrease—to trigger backoff, a cascading collapse in accuracy is prevented even with high speedup configurations.
[0161] Building upon this, gradient mutation triggering can be added to trigger recovery when the sequence-level logit changes abruptly; syntax / syntactic structure triggering can be added in conjunction with the downstream parser for structure-sensitive tasks such as code generation; and the decision condition can be replaced with a multi-source weighted sum of a single threshold. This example implementation does not impose any specific limitations.
[0162] In this example implementation, a RECOVER action is proposed on top of the traditional three actions (KEEP / DEFER / PRUNE). This RECOVER action is triggered by three types of multi-step trajectory evidence: entropy slope, attention redirection, and sequence-level confidence decrease. It is prioritized over other actions and is determined first. RECOVER contributes significantly under high acceleration. The pp enhances GSM8K accuracy gain and significantly reduces the local cascading failure rate near PRUNE events, acting as a safety valve to prevent cascading accuracy collapse under aggressive acceleration. This mechanism differs from undo methods like WINO, which are based solely on single-step snapshot triggering, and is unique at the multi-step trajectory level.
[0163] Step S620. When the recalculation trigger condition is not met, determine the target action of the token position from the actions of retaining and recalculating, reusing historical cache actions, and freezing and abandoning actions based on the trajectory fusion score and the preset compaction threshold.
[0164] In this example implementation, a budget compaction threshold is introduced, which is the dynamic value of the base compaction threshold adjusted by budget pressure. Based on the trajectory description signal and mapped according to the budget-sensitive threshold, one of four actions—KEEP, DEFER, PRUNE, or RECOVER—is output for each candidate position. The RECOVER action has the highest priority and is jointly determined by three types of multi-step trajectory-level triggering conditions. The remaining three types of actions can be distinguished by the budget-sensitive threshold.
[0165] In this example implementation, such as Figure 8 As shown, based on the trajectory fusion score and the preset compaction threshold, the target action for the token position is determined from the actions of retaining and recalculating, reusing historical cache actions, and freezing and abandoning actions. Specifically, it may include the following steps: Step S810. Obtain a first compaction threshold and a second compaction threshold based on the budget pressure signal and the basic compaction threshold, wherein the first compaction threshold is less than the second compaction threshold.
[0166] The budget pressure signal measures the system's memory resource usage at a specific token position during the current computation. The base compaction threshold is a preset baseline value used to differentiate token processing strategies; this threshold can be set based on empirical data or expert knowledge from the model training phase. The first and second compaction thresholds are dynamically generated based on the budget pressure signal and the base compaction threshold, used to divide the token position trajectory into three intervals, each corresponding to a different processing action. These two thresholds can be obtained by linearly or non-linearly scaling the base compaction threshold based on the budget pressure signal.
[0167] For example, the first tightening threshold The second tightening threshold ,in, and Based on the compaction threshold.
[0168] Step S820. If the trajectory fusion score is greater than the second compaction threshold, the retained and recalculated action will be determined as the target action for the token position.
[0169] Step S830. If the trajectory fusion score is greater than the first compaction threshold and less than or equal to the second compaction threshold, then the reuse of historical cache action is determined as the target action of the token position.
[0170] Step S840. If the trajectory fusion score is less than or equal to the first compaction threshold, then the freeze abandonment action is determined as the target action of the token position.
[0171] Based on obtaining the first compaction threshold and the second compaction threshold, the policy function for the three types of target actions can be defined as:
[0172] By introducing budget pressure signals to dynamically adjust the compaction threshold, the decision-making process for token actions can adaptively respond to the current computational resource situation. This dynamic adjustment mechanism, combined with trajectory fusion analysis, enables the model acceleration method to achieve a more intelligent and flexible balance between computational efficiency and model performance, avoiding resource waste or performance degradation that may result from fixed thresholds, thereby optimizing the inference process of the diffusion language model.
[0173] In this example implementation, during the initial industrial deployment, the four-action strategy can be limited and degraded while maintaining the sliding window description signal unchanged. For example, the action strategy can be degraded to: a three-action version (removing DEFER), which only classifies between KEEP / PRUNE / RECOVER to simplify cache access; a three-action version (removing RECOVER), which disables RECOVER in the Conservative setting to maximize throughput stability; and a two-action version (KEEP / PRUNE), which degrades to the decision rules of a Fast-dLLM-type scheme. Different degradation forms correspond to different precision / throughput trade-offs, facilitating selection based on service SLA levels.
[0174] In this example implementation, if the confidence signal of the token position is greater than the preset parallel confirmation threshold, the token position will enter the confirmation state based on the reuse of historical cache actions.
[0175] The preset parallel confirmation threshold is a pre-defined value used to determine whether the confidence level of a token meets the standard for parallel confirmation. CONFIRMED indicates that the token has been selected and unmasked at the generation location, and has been removed from the set of remaining unconfirmed locations. It will no longer occupy normal confirmation quotas and is the final state of normal state transition.
[0176] The strategy framework in this example implementation can degenerate into decision rules for multiple existing typical schemes under different parameter settings (proposition: decision signal coverage). For example, let... That is, it degenerates into a pure confidence threshold rule of Fast-dLLM; let That is, the stability skipping rule degenerates into ES-dLLM; let That is, it degenerates into the influence ranking rule of d²Cache; let And enable the memory allocation, which degrades to the Sparse-dLLM budget eviction rule; Follow Monotonic variation degenerates into SchED's progress-dependent threshold rule; adjusting the confidence threshold with the drift of adjacent steps degenerates into Dynamic-dLLM's drift correction rule; and jointly adapting the KEEP / DEFER threshold with block size and number of steps degenerates into CadLLM's joint scheduling rule. The entire strategy is supported by four axes: four signals, four actions, a sliding window, and trajectory-level convergence gating. The collapse of any axis degenerates into a special case of the relevant scheme. Based on the above degeneracy scheme, a single controller can be implemented online as a service and exposed to upper-layer callers at operation points, thus covering the working points of the other eight schemes, significantly reducing the cost of scheme selection, commissioning, and maintenance.
[0177] Figure 9 The diagram illustrates a state machine for four types of token-level actions in a specific embodiment of this disclosure. The overall structure of the policy involves first performing a RECOVER check, followed by KEEP / DEFER / PRUNE threshold division. Taking the state transition of a token position in the TAP (Trajectory-Aware Pruning / Policy) controller as an example, starting from the initial MASK, the transition proceeds according to the fusion... Compared with the base threshold Entering the three common states of KEEP / DEFER / PRUNE; when the confidence level Exceeding the parallel confirmation threshold The DEFER state can advance to the CONFIRMED final state; when the fusion recovery exceeds... DEFER can flow back to KEEP; when the fusion rate drops to The following conditions will be downgraded to PRUNE; once the RECOVER condition is triggered... Once established, the PRUNE state is recalled to the KEEP state to participate in the recalculation, forming a complete closed loop.
[0178] In this example implementation, by inserting trajectory tracking and policy execution processes after each step of denoising forward, the hidden state at the current position is recalculated, cached, frozen, or recalled according to the action classification, and a position-by-position state machine is maintained, which can be adapted to the existing diffusion language model inference stack.
[0179] Continue to refer to Figure 2 As shown, in step S230, the trajectory convergence coefficient is obtained based on the trajectory description signal of the mask token position in the unconfirmed state in the token position, and the confirmation quota of the current denoising step is determined based on the trajectory convergence coefficient.
[0180] In this example implementation, the masked token position refers to the token position in the sequence to be processed that has not yet been finally confirmed or frozen in the current denoising step. The trajectory convergence coefficient is a coefficient calculated based on the trajectory description signal of the masked token positions in the unconfirmed state, used to evaluate the overall convergence trend of these unconfirmed tokens. The confirmation quota refers to the maximum number of masked token positions that can be finally confirmed in the current denoising step.
[0181] The original decoding of the diffusion language model can be performed using uniform scheduling: each step confirms approximately Each token will still execute the complete process even if the entire trajectory has converged in the middle. Step forward.
[0182] In this example implementation, the confirmation quota can be updated at each step based on trajectory-level evidence. The confirmation quota is the maximum number of generation positions where a token can be selected from the candidate set and the MASK can be removed in this step.
[0183] In this example implementation, the trajectory stability convergence coefficient and trajectory confidence convergence coefficient can be obtained based on the window average of the stability signal and confidence signal of the mask token position in the unconfirmed state within the target window.
[0184] Unconfirmed mask token positions refer to tokens whose output for certain tokens has not yet reached a final determination state during the denoising process of the diffusion language model, and which require further processing or verification.
[0185] The trajectory stability convergence coefficient can be obtained by averaging the stability and confidence signals of the mask token positions within the target window. Convergence coefficient with trajectory confidence ,in This represents the window EMA (Exponential Moving Average) calculated by averaging the positions of all current mask tokens.
[0186] In this example implementation, if the trajectory stability convergence coefficient is greater than the preset trajectory stability threshold and the trajectory confidence convergence coefficient is greater than the preset trajectory confidence threshold, then the quota increase condition is determined to be met. When the quota increase condition is met, the confirmation quota of the current denoising step is determined based on the original scheduling quota, the number of mask tokens in the current denoising step, the maximum total number of denoising steps, the upper limit of single-step confirmation ratio, and the freeze acceleration multiple.
[0187] Convergence gating can be determined jointly by two trajectory-level thresholds:
[0188] When the average confidence and average stability of the mask token both exceed the task-related thresholds and the warm-up period is completed, the confirmation quota for each step is increased to an adaptive level, so that the entire trajectory immediately exits the noise reduction process after reaching the actual steady state.
[0189] In this example implementation, the dual-gating system based on average stability and average confidence can be replaced with a single-gating version (e.g., gating only based on average confidence), or a triple-gating version (e.g., adding near-gating to the original two-gating system). The slope of the decrease in the proportion of residual mask is used as a third gating, or a learning gating (e.g., using a small MLP to learn binary classification from trajectory features to whether it has ended). In this example implementation, no specific limitation is made.
[0190] The initial scheduling quota is the default number or proportion of tokens to be confirmed in each denoising step. This quota can be a fixed value, such as 3 tokens confirmed per step, or an initial proportion dynamically set based on sequence length or model size. The number of mask tokens in the current denoising step refers to the total number of mask tokens in the current denoising step that are in an unconfirmed state. The maximum number of denoising steps refers to the total number of denoising steps required for the diffusion language model to complete one generation task. The single-step confirmation ratio limit refers to the maximum proportion of tokens that can be confirmed in each denoising step relative to the total number of mask tokens. Its purpose is to prevent confirming too many tokens at once, thereby ensuring generation quality. The freeze acceleration factor refers to the multiplier factor used to increase the confirmation quota when the quota increase conditions are met. Its purpose is to achieve an acceleration effect, allowing more tokens to be confirmed when conditions permit.
[0191] When the quota increase conditions are met, the confirmed quota for the current denoising step is updated as follows:
[0192] in For the remaining mask tokens, more precisely, This refers to the number of positions yet to be generated, still represented as MASK and not yet in the CONFIRMED state; it does not include fixed input positions such as prompts or confirmed positions, but frozen PRUNE positions that have not yet been confirmed are still included. . To complete the target number of steps, Maximum percentage of single-step confirmations (default) ), It is the acceleration factor that is positively correlated with the proportion of frozen but stable positions (default). ), For the original scheduling quota, This is an adaptive quota after trajectory gating. The original quota is still used during the warm-up phase (the first few steps) and when convergence gating fails. .
[0193] The above technical solution dynamically adjusts the number of token confirmations in each denoising step based on the actual convergence status of the tokens, thereby significantly improving the generation efficiency of the diffusion language model while ensuring generation quality. This solution effectively addresses the challenge of precisely controlling the acceleration level to balance performance and quality when using trajectory convergence information for acceleration, enabling the model to optimize more intelligently.
[0194] In step S240, the mask token position is confirmed based on the cached data of the confirmed quota and mask token position, and after all mask token positions are confirmed, the diffusion language model is controlled to exit the current denoising process.
[0195] In this example implementation, confirmation means treating the current calculation result of a mask token position as the final result and removing it from the set of mask tokens to be processed, indicating that the denoising process of that token has been completed.
[0196] In this example implementation, the noise reduction process can exit immediately when all mask tokens have been confirmed, without needing to complete the entire process. This early stopping mechanism is completely independent of the computational cost of each forward step, saving the number of forward calls themselves. Therefore, it is naturally orthogonal to kernel-level acceleration methods such as sparse attention and can be used in combination. All mask tokens here refer only to the initial response positions that need denoising in this generation; the equivalence condition is... =0 means that all these positions are in the CONFIRMED state, excluding the originally fixed input positions such as prompts.
[0197] In this example implementation, such as Figure 10 As shown, the confirmation of the mask token position based on the cached data confirming the quota and mask token position can specifically include the following steps: Step S1010. Based on the mask token positions where the target action is to retain and recalculate the action or reuse the historical cache action, and the confidence signal is greater than the preset parallel confirmation threshold, obtain the candidate mask token set.
[0198] When the number of confirmed candidates in this step exceeds the adaptive confirmation quota When the mask token is still MASK, the action belongs to KEEP or DEFER, the confidence level reaches the parallel confirmation threshold and it has not been RECOVER / PRUNE, the candidate mask token set is obtained.
[0199] This process aims to filter out tokens with high stability and reliability from all unconfirmed masked token locations, and to identify those whose predictions the diffusion language model has high confidence in. These tokens are then considered potential confirmation targets. This avoids unnecessary confirmation attempts on unstable or low-confidence tokens, thereby improving confirmation efficiency and accuracy.
[0200] Step S1020. Sort the mask token positions in the candidate mask token set according to the trajectory fusion score, and determine the target mask token position to be confirmed from the candidate mask token set based on the confirmation quota and sorting results.
[0201] After forming a candidate set based on action, confidence threshold, and non-recover / prune states, the candidate set is then selected from highest to lowest based on trajectory fusion scores. If the number of candidates does not exceed the quota, all will be confirmed. This sorting only addresses the priority when the number of candidates exceeds the single-step quota; it does not add new action categories, and the sorting does not change the result.
[0202] The purpose of sorting is to prioritize tokens with higher trajectory fusion scores for confirmation within a limited confirmation quota. The trajectory fusion score comprehensively reflects the token's stability, influence, confidence, and budget pressure signals. A high score means that the token is more stable, more important, more trustworthy, and has reasonable resource usage. Therefore, prioritizing the confirmation of these tokens helps accelerate the denoising process and improve the quality of the final sequence.
[0203] Then, based on the sorted priorities and available confirmation quotas, the tokens to be confirmed are precisely selected. This ensures that, under resource constraints, the most valuable tokens are selected for confirmation to the greatest extent possible, thereby optimizing the model's acceleration performance. After sorting the candidate mask token set in descending order, token positions can be selected sequentially from the top of the sorted results until the confirmation quota limit is reached or all tokens in the candidate mask token set are selected. Alternatively, after sorting, the first N token positions of the sorted list can be directly extracted, where N is the smaller value between the confirmation quota and the size of the candidate mask token set.
[0204] Step S1030. Confirm the target mask token position based on the cached data of the target mask token position.
[0205] The confirmation operation can change the selected mask token position from an unconfirmed state to a confirmed state, thereby reducing the computational load of subsequent denoising steps.
[0206] To ensure the auditability of early termination, the controller can output a record for each sample, including the planned number of steps, the actual number of steps, whether early termination was triggered, and the quota for each step, which facilitates regression testing and effect backtracking.
[0207] In this example implementation, a dual gating system using the average stability and average confidence of the masked token is used to determine whether the entire trajectory has actually converged. Upon triggering, the confirmation quota for each step is increased. It exits denoising immediately once all masks have been confirmed. This mechanism is completely independent of the computational cost of each forward step, saving the number of forward calls themselves. It is a pure algorithmic-level acceleration source that is naturally orthogonal to kernel-level methods such as sparse attention, and is the core mechanism that achieves end-to-end acceleration of 1.60× / 2.80× / 4.00× at three different operation points.
[0208] The early stopping mechanism in this example implementation can also be orthogonal to DEFER / PRUNE actions and sparse attention (Block-sparse, Sliding-window, sparse KV) and low-bit quantization (INT8 / INT4), forming a multi-layered acceleration. This reduces the number of TAP contribution steps (reducing the number of forward calls), the single-step forward latency of sparse attention contribution, and the single-step forward memory and computing power of quantization contribution. The combination of these three can further compress end-to-end latency without significantly sacrificing accuracy.
[0209] Figure 11 This document illustrates a system architecture diagram of a trajectory-aware strategy framework based on TAP-dLLM (Trajectory-AwarePruning for diffusion LLM, a training-independent, trajectory-aware unified inference acceleration method for diffusion language models) in a specific embodiment of this disclosure. Between adjacent denoising steps, a trajectory-aware controller, state machine, and hidden state / KV cache collaborate to issue four types of action masks—KEEP, DEFER, PRUNE, and RECOVER—to the next step, achieving position-selective computation. Specifically, Figure 11The left half is the standard dLLM Transformer computation (multi-head attention + feedforward + layer normalization) of the adjacent denoising step t-1. Its key / value tensor and hidden state enter the TAP cache module in the middle. The TAP cache module consists of a trajectory-aware controller (containing four types of actions: KEEP / DEFER / PRUNE / RECOVER), a State Machine, and two types of cached tensors: hidden state and key / value tensor. The controller and the state machine synchronize the trajectory-level state through the Reconcile channel and issue an action mask for the next denoising step. Figure 1 The right half is the Transformer calculation for the denoising step t. The normal squares are positions that can be directly reused by hiring through the cache (DEFER action), the dashed squares are positions that are recalculated by Dynamic Calculate initiated according to the action mask (KEEP / RECOVER action), and the crossed positions are positions that are frozen and removed (PRUNE action), thus realizing position-selective calculation under a single controller.
[0210] For the dense forward steps that the diffuse language model would normally execute, the controller only reads statistics based on the existing outputs (hidden states, attention matrix, logits) of that forward pass, without introducing new dense computations. The computation of trajectory description signals and trajectory fusion components, as well as the determination of the target action, are completed in lightweight operators on the CPU (Central Processing Unit) or GPU (Graphics Processing Unit) side, with overhead far less than a single forward pass. Writes to / reuses / releases / restores of the KV cache occur entirely on the bitmasks and indices of the existing cache data structure, without requiring modification to the attention kernel.
[0211] In this example implementation, the TAP controller serves as a lightweight control layer, which can be seamlessly integrated with the existing industrial inference stack of the diffusion language model. A typical integration method is as follows: 1. Insert TAP controller hooks into the iterative denoising loop of diffusion language models such as LLaDA and Dream, and call the controller to perform signal acquisition, action allocation, and quota update in each forward and backward step; 2. The TAP controller reads and writes the KV cache entirely through the bitmask and index interface. It can be used in conjunction with existing feature caching methods such as dLLM-Cache. The underlying cache is directly called by the DEFER action of TAP. 3. The TAP controller is transparent to the sparse attention kernel: the sparsity of the DEFER / PRUNE position can be recognized by the Block-sparse or Sliding-window type kernel, thereby obtaining kernel-level acceleration for each forward step, which is orthogonally superimposed with the step reduction brought by early stopping; 4. The TAP controller exposes itself to upper-layer services with three operation points: Conservative / Default / Aggressive, corresponding to different precision-latency preferences. The main differences between the three levels are reflected in... The other parameters remain the same for the three parameters.
[0212] The default configuration and three-level operation point settings are shown in Table 1:
[0213] Table 1
[0214] Common parameters: RECOVER trigger threshold .
[0215] The TAP-dLLM framework in this example implementation is independent of any specific diffusion language model backbone and can be adapted to various sizes and structures, such as LLaDA-8B-Instruct (the default validation model), Dream-7B, or subsequent larger-scale diffusion language models, as well as extensions to multimodal diffusion models (e.g., vision-language diffusion models, extending budget pressure to visual tokens). When replacing the backbone, the thresholds corresponding to the three operation points need to be recalibrated, but the controller structure remains unchanged.
[0216] Figure 12 A schematic diagram illustrating the comparison of model acceleration results in a specific embodiment of this disclosure is shown, demonstrating a visual comparison of the speedup ratios of eight training-independent acceleration methods on two planes: MMLU (Massive Multitask Language Understanding) and GSM8K. Specifically, it compares the TAP three-level operation points (TAP-C / TAP-D / TAP-A) on LLaDA-8B-Instruct with the eight training-independent acceleration baselines. Figure 12 (a) is the MMLU-acceleration ratio plane. Figure 12 (b) For the GSM8K speedup plane, the line connecting the three points TAP forms the Pareto front.
[0217] Figure 12In (a), the three operation points (solid circles, marked TAP) are all higher than Vanilla (original) (pentagon) and all baseline diamond points on MMLU; Figure 12 (b) The solid line connecting the three operation points TAP-C / TAP-D / TAP-A is the Pareto front obtained by the model acceleration method in this example implementation along the speedup ratio direction in the GSM8K dimension (the dashed line is the baseline optimal envelope). The Pareto-opt (Pareto optimal solution) position marked by the pentagram in the upper right corner simultaneously achieves 4.00× speedup and 79.2% accuracy in GSM8K, which is significantly better than all baseline methods.
[0218] In practical applications, the model acceleration method in this example implementation can achieve the following data advantages: First, the model acceleration method in this example implementation can achieve both speedup and accuracy improvement without modifying the model weights. Specific data is as follows: Table 2 shows the experimental data for four benchmarks—MMLU, GSM8K, HumanEval (a representative code generation benchmark), and MBPP (a representative code generation benchmark)—on the LLaDA-8B-Instruct (bfloat16, single-card A100-80GB) platform (compared to the original Vanilla denoising T=64 steps):
[0219] Table 2
[0220] According to the data in Table 2, MMLU improved by +0.8 to +1.3 percentage points compared to Vanilla at all three operating points; GSM8K improved from 62.8% in Vanilla to a maximum of 79.5%, and even at the highest acceleration level (4.00×), it still reached 79.2%; HumanEval / MBPP maintained a slight lead in the Conservative level, and the decline in the Aggressive level was controlled within 1pp, demonstrating robustness to cascade-sensitive tasks.
[0221] Secondly, the model acceleration method in this example implementation achieves a Pareto frontier in comparison with eight types of training-independent acceleration methods, as shown in the following data: Comparison results with dLLM-Cache, Fast-dLLM, Dynamic-dLLM, ES-dLLM, d²Cache, Sparse-dLLM, SchED, and WINO on LLaDA-8B-Instruct (GSM8K-speedup plane): TAP Conservative achieves 79.5% GSM8K performance at 1.60× acceleration, outperforming Sparse-dLLM (1.50× / 78.8%) and WINO (1.50× / 62.4%). TAP Aggressive achieves 79.2% GSM8K performance at 4.00× acceleration, outperforming SchED (3.80× / 78.5%) on the GSM8K-acceleration plane. In all three TAP configurations, Conservative and Aggressive are both at the Pareto forefront of GSM8K-acceleration ratio.
[0222] Furthermore, the RECOVER action in the model acceleration method of this example implementation significantly reduces the probability of cascading crashes at high acceleration levels, as shown in the following data: Table 3 shows the event-level statistics for RECOVER on GSM8K and MBPP:
[0223] Table 3
[0224] The results show that RECOVER contributes +2.7 pp GSM8K accuracy gain at high acceleration and reduces the cascade failure rate near PRUNE events by 8.6 to 11.7 percentage points.
[0225] Furthermore, the end-to-end acceleration at the pure algorithm level brought about by trajectory-level early stopping in the model acceleration method of this example implementation is specifically shown in the following data: By using convergence-gated early stopping at three different operation points, the average number of steps was reduced from 64.0 to 40.0 / 23.0 / 16.0, corresponding to a step reduction of 37.5% / 64.1% / 75.0%, and an end-to-end speedup of 1.60× / 2.80× / 4.00×. This speedup is completely independent of sparsification or kernel-level optimization for each forward pass, and is compatible with and can be stacked with orthogonal solutions such as sparse attention.
[0226] Furthermore, the model acceleration method in this example implementation also possesses engineering compatibility and observability. This method does not modify the weights of the diffusion language model at all; the controller, as a lightweight layer, is superimposed on the existing denoising loop, making it plug-and-play with newly released diffusion language models; KV cache read / write operations are completed only through bitmasks and index interfaces, allowing for superimposition with existing caching schemes such as dLLM-Cache, and with orthogonal kernel schemes such as sparse attention and quantization; DEFER actions directly call existing feature caches (such as dLLM-Cache), ensuring compatibility with existing caches and sparse kernels; externally, only three operation points—Conservative, Default, and Aggressive—are exposed, allowing for quality-priority and latency-priority configurations based on business SLAs; the controller outputs auditable step counts and early stop logs for each sample, facilitating industrial regression testing. This engineering capability allows the model acceleration method in this example implementation to be integrated into existing diffusion language model inference stacks with minimal modification cost.
[0227] Furthermore, the model acceleration method in this example implementation also features decision signal coverage and scheme uniformity. By describing the signal through a sliding window trajectory and a four-action strategy, it uniformly covers the core decision signals of eight training-independent acceleration methods: dLLM-Cache, Fast-dLLM, ES-dLLM, Dynamic-dLLM, d²Cache, Sparse-dLLM, SchED, and CadLLM. Each existing method can be used as a special case of the model acceleration method in this example implementation under specific parameter settings, thereby significantly reducing the cost of industrial solution selection and maintenance: A single controller exposes three operating points, covering the typical operating points of the eight existing schemes, avoiding frequent switching and parameter tuning between different schemes.
[0228] It should be noted that although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0229] Furthermore, this disclosure also provides a model acceleration device. (See reference) Figure 13 As shown, the model acceleration device may include a trajectory fusion and determination module 1310, a target motion determination module 1320, a quota update confirmation module 1330, and a denoising process control module 1340. Wherein: The trajectory fusion division determination module 1310 is configured to perform each token position of the sequence to be processed for the diffusion language model in the current denoising step, construct a trajectory description signal corresponding to each token position, and obtain the trajectory fusion division of the token position based on the trajectory description signal. The target action determination module 1320 is configured to determine the target action of the token position based on the trajectory fusion score of the token position and the recalculation trigger condition, and update the cached data of the token position based on the target action; wherein, the target action is one of the following token-level actions: retain and recalculate action, reuse historical cache action, freeze and abandon action, and recall and recalculate action. The quota update confirmation module 1330 is configured to perform the following: obtain the trajectory convergence coefficient based on the trajectory description signal of the mask token position in the unconfirmed state in the token position, and determine the confirmation quota for the current denoising step based on the trajectory convergence coefficient. The denoising process control module 1340 is configured to perform a process based on cached data of the confirmed quota and mask token position, confirm the mask token position, and control the diffusion language model to exit the current denoising process after all mask token positions have been confirmed.
[0230] In some exemplary embodiments of this disclosure, the trajectory fusion determination module 1310 may include a stability signal determination unit, an influence signal determination unit, a confidence signal determination unit, and a budget pressure signal determination unit. Wherein: The stability signal determination unit is configured to perform a process to obtain the stability signal corresponding to the token position based on the change in the normalized hidden state between adjacent denoising steps. The influence signal determination unit is configured to perform an overall influence of the token position on other token positions in the current denoising step, and obtain the influence signal corresponding to the token position. The confidence signal determination unit is configured to perform the operation of obtaining the confidence signal corresponding to the token position based on the maximum probability of the Softmax distribution of the token position in the current denoising step. The budget pressure signal determination unit is configured to obtain the budget pressure signal corresponding to the token position based on the memory usage of the token position.
[0231] In some exemplary embodiments of this disclosure, the stability signal determination unit may include a hidden state difference determination subunit, a hidden state change amount determination subunit, and a stability signal determination subunit. Wherein: The hidden state difference determination subunit is configured to perform the operation of obtaining the hidden state difference based on the hidden states generated by the diffusion language model in the current denoising step and the previous denoising step for the sequence to be processed. The hidden state change determination subunit is configured to perform the operation of obtaining the normalized hidden state change based on the hidden state difference and the hidden state generated in the previous denoising step. The stability signal determination subunit is configured to perform the operation of obtaining the stability signal corresponding to the token position based on the change in the normalized hidden state.
[0232] In some exemplary embodiments of this disclosure, the confidence signal determination unit may include a path accumulation operator determination subunit and an influence signal determination subunit. Wherein: The path accumulation operator determination subunit is configured to execute the attention matrix generated by the diffusion language model in the current denoising step for the sequence to be processed, to obtain a multi-layer attention path accumulation operator; The influence signal determination subunit is configured to perform the operation of obtaining the influence signal corresponding to the token position based on the multi-layer attention path accumulation operator.
[0233] In some exemplary embodiments of this disclosure, the budget pressure signal determination unit may include a memory pressure value determination subunit and a budget pressure signal determination subunit. Wherein: The memory pressure value determination subunit is configured to perform a normalized memory pressure value based on the baseline memory usage, current memory usage, and memory usage limit at the token position. The budget pressure signal determination subunit is configured to execute the process of obtaining the budget pressure signal corresponding to the token position based on the normalized memory pressure value and the denoising progress corresponding to the current denoising step.
[0234] In some exemplary embodiments of this disclosure, the budget pressure signal determination unit may further include a denoising progress determination subunit, configured to perform a denoising progress determination based on the current denoising step and a preset maximum total number of denoising steps.
[0235] In some exemplary embodiments of this disclosure, the trajectory fusion score determination module 1310 may further include a target window determination unit, a window average value determination unit, a basic fusion score determination unit, and a trajectory fusion score determination unit. Wherein: The target window determination unit is configured to determine the current denoising step and multiple adjacent historical denoising steps as the target window based on a preset window length. The window average value determination unit is configured to perform a sliding average on each type of trajectory description signal within the target window based on a preset attenuation coefficient, so as to obtain the window average value corresponding to each type of trajectory description signal. The basic fusion score determination unit is configured to perform the calculation of the basic fusion score based on the window average value and signal weight corresponding to the stability signal, influence signal and confidence signal, respectively. The trajectory fusion score determination unit is configured to perform the following: obtain the suppression term based on the window average value and signal weight corresponding to the budget pressure signal, and obtain the trajectory fusion score of the token position based on the basic fusion score and the suppression term.
[0236] In some exemplary embodiments of this disclosure, the target action determination module 1320 may include a recall and recalculation action determination unit and other action determination units. Wherein: The recall recalculation action determination unit is configured to determine whether the recalculation trigger condition is met based on multiple trajectory-level judgment conditions, and when the recalculation trigger condition is met, determine the recall recalculation action as the target action of the token position. Other action determination units are configured to determine the target action of the token position from the actions of retaining and recalculating, reusing historical cache actions, and freezing and abandoning actions when the recalculation trigger condition is not met, based on the trajectory fusion score and the preset compaction threshold.
[0237] In some exemplary embodiments of this disclosure, the recall recalculation action determination unit may include an entropy slope determination condition determination subunit, an attention redirection determination subunit, a confidence decrease determination subunit, and a recalculation trigger condition determination subunit. Wherein: The entropy slope determination condition subunit is configured to execute if the estimated slope of the output distribution entropy of the token position in the most recent denoising steps is greater than a preset slope threshold, then the entropy slope determination condition is met. The attention redirection determination subunit is configured to execute the following: if the average attention from the unfrozen set to the current frozen set is greater than a preset attention threshold, then the attention redirection determination condition is met. The confidence decline determination subunit is configured to execute the following: if the decrease in the average confidence level of the sequence level within the preset sequence window relative to the peak value within the window is greater than the preset decrease threshold, then the sequence level confidence decline determination condition is met. The recalculation trigger condition determination subunit is configured to determine that the recalculation trigger condition is met when one of the entropy slope determination condition, attention redirection determination condition, or sequence-level confidence decrease determination condition is satisfied.
[0238] In some exemplary embodiments of this disclosure, other action determination units may include a compaction threshold determination subunit, a retention and recalculation action determination subunit, a reuse of historical cached action determination subunit, and a freeze and abandon action determination subunit. Wherein: The compaction threshold determination subunit is configured to perform operations to obtain a first compaction threshold and a second compaction threshold based on the budget pressure signal and the base compaction threshold, wherein the first compaction threshold is less than the second compaction threshold. The retain and recalculate action determination subunit is configured to determine the target action of the token position if the trajectory fusion score is greater than the second compaction threshold. The reuse history cache action determination subunit is configured to determine the reuse history cache action as the target action for the token position if the trajectory fusion score is greater than the first compaction threshold and less than or equal to the second compaction threshold. The freeze-abandon action determination subunit is configured to determine the freeze-abandon action as the target action for the token position if the trajectory fusion score is less than or equal to the first compaction threshold.
[0239] In some exemplary embodiments of this disclosure, other action determination units may further include a confirmation state entry subunit, configured to execute if the confidence signal of the token position is greater than a preset parallel confirmation threshold, then cause the token position to enter the confirmation state based on the reuse history cache action.
[0240] In some exemplary embodiments of this disclosure, the quota update confirmation module 1330 may include a trajectory convergence coefficient determination unit, configured to perform a process of obtaining trajectory stability convergence coefficient and trajectory confidence convergence coefficient based on the window average of the stability signal and confidence signal of the mask token position in the unconfirmed state within the target window.
[0241] In some exemplary embodiments of this disclosure, the quota update confirmation module 1330 may further include a quota increase condition determination unit and a quota increase confirmation unit. Wherein: The quota increase condition determination unit is configured to determine that the quota increase condition is met if the trajectory stability convergence coefficient is greater than the preset trajectory stability threshold and the trajectory confidence convergence coefficient is greater than the preset trajectory confidence threshold. The quota increase confirmation unit is configured to, when the quota increase conditions are met, determine the confirmation quota for the current denoising step based on the original scheduling quota, the number of mask tokens in the current denoising step, the maximum total number of denoising steps, the single-step confirmation ratio limit, and the freeze acceleration multiple.
[0242] In some exemplary embodiments of this disclosure, the denoising process control module 1340 may include a candidate mask token set determination unit, a target mask token position determination unit, and a target mask token position confirmation unit. Wherein: The candidate mask token set determination unit is configured to perform operations to obtain a candidate mask token set based on the mask token positions where the target action is to retain and recalculate the action or reuse the historical cache action, and the confidence signal is greater than a preset parallel confirmation threshold. The target mask token position determination unit is configured to sort the mask token positions in the candidate mask token set according to the trajectory fusion score, and determine the target mask token position to be confirmed from the candidate mask token set based on the confirmation quota and the sorting result. The target mask token position confirmation unit is configured to confirm the target mask token position based on cached data of the target mask token position.
[0243] The specific details of each module / unit in the above-mentioned model acceleration device have been described in detail in the corresponding method embodiment section, and will not be repeated here.
[0244] Figure 14 A schematic diagram of the structure of a computer system suitable for implementing the embodiments of the present disclosure is shown.
[0245] It should be noted that, Figure 14 The computer system 1400 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0246] like Figure 14 As shown, the computer system 1400 includes a central processing unit (CPU) 1401, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 1402 or programs loaded from storage section 1408 into random access memory (RAM) 1403. The RAM 1403 also stores various programs and data required for system operation. The CPU 1401, ROM 1402, and RAM 1403 are interconnected via a bus 1404. An input / output (I / O) interface 1405 is also connected to the bus 1404.
[0247] The following components are connected to I / O interface 1405: an input section 1406 including a keyboard, mouse, etc.; an output section 1407 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1408 including a hard disk, etc.; and a communication section 1409 including a network interface card such as a LAN card, modem, etc. The communication section 1409 performs communication processing via a network such as the Internet. A drive 1410 is also connected to I / O interface 1405 as needed. Removable media 1411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1410 as needed so that computer programs read from them can be installed into storage section 1408 as needed.
[0248] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1409, and / or installed from removable medium 1411. When the computer program is executed by central processing unit (CPU) 1401, it performs various functions defined in the system of this disclosure.
[0249] Exemplary embodiments of this disclosure also provide a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the model acceleration method described above.
[0250] In one implementation, the computer program product can be a tangible product containing a computer program, such as a computer-readable storage medium storing the computer program. The readable storage medium can be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory, hard disk drive (HDD), solid-state drive (SSD), etc. For example, the computer program product can be implemented as a non-volatile storage medium storing a computer program, such as read-only memory, NAND flash memory, etc.
[0251] In one implementation, the computer program product can be an intangible product containing a computer program. For example, the computer program product can be implemented as a virtual digital product, such as an executable file, installation package, or other digital file storing the computer program.
[0252] Computer program code can be written in one or more programming languages. Examples of programming languages include C, Java, and C++. Program code can execute entirely on the user's computing device, partially on the user's computing device, or as a standalone software package. It can also execute partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, such as a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via an internet connection provided by a mobile network operator).
[0253] Computer programs can be carried or transmitted via signals such as electrical, magnetic, optical, electromagnetic, and infrared rays. Electronic devices can convert the signals carrying computer programs into digital signals, thereby running the computer programs. When a computer program runs on an electronic device, its code is used to cause the electronic device to execute (more specifically, to execute) the method steps of various exemplary embodiments of this disclosure, such as the model acceleration method described above.
[0254] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0255] It should be noted that although several modules for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules described above can be embodied in one module. Conversely, the features and functions of one module described above can be further divided and embodied by multiple modules.
[0256] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein.
[0257] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A model acceleration method, characterized in that, include: For each token position in the current denoising step of the sequence to be processed in the diffusion language model, a trajectory description signal corresponding to each token position is constructed, and the trajectory fusion score of the token position is obtained based on the trajectory description signal. Based on the trajectory fusion score of the token location and the recalculation trigger condition, the target action of the token location is determined, and the cached data of the token location is updated based on the target action; wherein, the target action is one of the following token-level actions: retain and recalculate action, reuse historical cache action, freeze and abandon action, and recall and recalculate action. The trajectory convergence coefficient is obtained based on the trajectory description signal of the mask token position in the unconfirmed state in the token position, and the confirmation quota of the current denoising step is determined based on the trajectory convergence coefficient. Based on the confirmed quota and the cached data of the mask token position, the mask token position is confirmed, and after all the mask token positions are confirmed, the diffusion language model is controlled to exit the current denoising process.
2. The model acceleration method according to claim 1, characterized in that, The trajectory description signal includes a stability signal, an influence signal, a confidence signal, and a budget pressure signal. Constructing the trajectory description signal corresponding to each token position includes: The stability signal corresponding to the token position is obtained based on the change in the normalized hidden state of the token position between adjacent denoising steps. Based on the overall influence of the token position on other token positions in the current denoising step, the influence signal corresponding to the token position is obtained; Based on the maximum probability of the token position in the Softmax distribution during the current denoising step, the confidence signal corresponding to the token position is obtained; Based on the memory usage of the token location, the budget pressure signal corresponding to the token location is obtained.
3. The model acceleration method according to claim 2, characterized in that, The step of obtaining the stability signal corresponding to the token position based on the change in the normalized hidden state between adjacent denoising steps includes: The difference between the hidden states is obtained by the diffusion language model based on the hidden states generated for the sequence to be processed in the current denoising step and the previous denoising step. The change in the normalized hidden state is obtained based on the difference between the hidden states and the hidden states generated in the previous denoising step. The stability signal corresponding to the token position is obtained based on the change in the normalized hidden state.
4. The model acceleration method according to claim 2, characterized in that, The step of obtaining the influence signal corresponding to the token position based on the overall influence of the token position on other token positions in the current denoising step includes: Based on the attention matrix generated by the diffusion language model on the sequence to be processed in the current denoising step, a multi-layer attention path accumulator operator is obtained. The influence signal corresponding to the token position is obtained by multiplying the multi-layer attention path operator.
5. The model acceleration method according to claim 2, characterized in that, The step of obtaining the budget pressure signal corresponding to the token position based on the memory usage of the token position includes: The normalized memory pressure value is obtained based on the baseline memory usage, current memory usage, and upper limit of memory usage at the token position. Based on the normalized memory pressure value and the denoising progress corresponding to the current denoising step, the budget pressure signal corresponding to the token position is obtained.
6. The model acceleration method according to claim 5, characterized in that, The method further includes: The denoising progress corresponding to the current denoising step is obtained based on the current denoising step and the preset maximum total number of denoising steps.
7. The model acceleration method according to claim 2, characterized in that, The process of obtaining the trajectory fusion component of the token position based on the trajectory description signal includes: The current denoising step and several adjacent historical denoising steps are determined as the target window based on a preset window length. Based on a preset attenuation coefficient, each type of trajectory description signal is subjected to a moving average within the target window to obtain the window average value corresponding to each type of trajectory description signal; The basic fusion score is obtained based on the window average value and signal weight corresponding to the stability signal, the influence signal and the confidence signal, respectively. The suppression term is obtained based on the window average value and signal weight corresponding to the budget pressure signal, and the trajectory fusion score of the token position is obtained based on the basic fusion score and the suppression term.
8. The model acceleration method according to claim 2, characterized in that, The step of determining the target action at the token location based on the trajectory fusion score of the token location and the recalculation trigger condition includes: The recalculation trigger condition is determined based on multiple trajectory-level judgment conditions, and when the recalculation trigger condition is met, the recall recalculation action is determined as the target action of the token position. When the recalculation trigger condition is not met, the target action for the token position is determined from the retention and recalculation action, the reuse of historical cache action, and the freeze and abandonment action, based on the trajectory fusion score and the preset compaction threshold.
9. The model acceleration method according to claim 8, characterized in that, The trajectory-level determination criteria include entropy slope determination criteria, attention redirection determination criteria, and sequence-level confidence decrease determination criteria. The step of determining whether the recalculation triggering condition is met based on multiple trajectory-level determination criteria includes: If the slope estimate of the output distribution entropy of the token position in the most recent denoising steps is greater than the preset slope threshold, then the entropy slope determination condition is met. If the average attention directed from the unfrozen set to the currently frozen set is greater than the preset attention threshold, then the attention redirection determination condition is met. If the decrease in the average confidence level of the sequence within the preset sequence window relative to the peak value within the window is greater than the preset decrease threshold, then the sequence-level confidence decrease determination condition is met. The recalculation trigger condition is determined to be satisfied when any one of the entropy slope determination condition, the attention redirection determination condition, and the sequence-level confidence decrease determination condition is met.
10. The model acceleration method according to claim 8, characterized in that, The target action for determining the token position based on the trajectory fusion score and compaction threshold from the retention and recalculation action, the reuse of historical cache action, and the freeze and abandonment action includes: A first compaction threshold and a second compaction threshold are obtained based on the budget pressure signal and the basic compaction threshold, wherein the first compaction threshold is less than the second compaction threshold; If the trajectory fusion score is greater than the second compaction threshold, then the retention and recalculation action is determined as the target action for the token position; If the trajectory fusion score is greater than the first compaction threshold and less than or equal to the second compaction threshold, then the reuse history cache action is determined as the target action of the token position; If the trajectory fusion score is less than or equal to the first compaction threshold, then the freeze-abandon action is determined as the target action for the token position.
11. The model acceleration method according to claim 10, characterized in that, The method further includes: If the confidence signal of the token position is greater than the preset parallel confirmation threshold, then the token position enters the confirmation state based on the reuse history cache action.
12. The model acceleration method according to claim 2, characterized in that, The step of obtaining the trajectory convergence coefficient based on the trajectory description signal of the mask token position in the unconfirmed state in the token position includes: Based on the window average of the stability signal and the confidence signal of the mask token position in the unconfirmed state within the target window, the trajectory stability convergence coefficient and the trajectory confidence convergence coefficient are obtained.
13. The model acceleration method according to claim 12, characterized in that, The step of determining the confirmation quota for the current denoising step based on the trajectory convergence coefficient includes: If the trajectory stability convergence coefficient is greater than the preset trajectory stability threshold, and the trajectory confidence convergence coefficient is greater than the preset trajectory confidence threshold, then the quota increase condition is determined to be met. When the quota increase conditions are met, the confirmation quota for the current denoising step is determined based on the original scheduling quota, the number of mask tokens in the current denoising step, the maximum total number of denoising steps, the upper limit of single-step confirmation ratio, and the freeze acceleration multiple.
14. The model acceleration method according to claim 12, characterized in that, The step of confirming the mask token position based on the confirmed quota and the cached data of the mask token position includes: Based on the mask token positions, the target action is either the retain and recalculate action or the reuse history cache action, and the confidence signal is greater than a preset parallel confirmation threshold, a candidate mask token set is obtained. The mask token positions in the candidate mask token set are sorted according to the trajectory fusion score, and the target mask token position to be confirmed is determined from the candidate mask token set based on the confirmation quota and the sorting result. The target mask token position is confirmed based on the cached data of the target mask token position.
15. A model acceleration device, characterized in that, include: The trajectory fusion score determination module is configured to perform each token position of the sequence to be processed for the diffusion language model in the current denoising step, construct a trajectory description signal corresponding to each token position, and obtain the trajectory fusion score of the token position based on the trajectory description signal. The target action determination module is configured to determine the target action of the token position based on the trajectory fusion score and recalculation trigger conditions, and update the cached data of the token position based on the target action; wherein the target action is one of the following token-level actions: retain and recalculate action, reuse historical cache action, freeze and abandon action, and recall and recalculate action. The quota update confirmation module is configured to execute the trajectory convergence coefficient obtained from the trajectory description signal of the mask token position in the unconfirmed state in the token position, and determine the confirmation quota of the current denoising step based on the trajectory convergence coefficient. The denoising process control module is configured to perform a confirmation of the mask token position based on the confirmation quota and the cached data of the mask token position, and after all the mask token positions have been confirmed, control the diffusion language model to exit the current denoising process.
16. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the model acceleration method as described in any one of claims 1 to 14.
17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the model acceleration method as described in any one of claims 1 to 14.
