Method for improving long text processing efficiency and accuracy

By employing block preprocessing, improved rotational position encoding, and sparse attention computation, the problems of low computational efficiency and accuracy in ultra-long text processing are solved, achieving efficient and accurate processing of long texts.

CN121328562APending Publication Date: 2026-01-13BEI JING JING YUE KE JI YOU XIAN GONG SI
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202511465931.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-14
Publication Date
2026-01-13

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively address issues such as low computational efficiency, inaccurate remote dependency capture, and wasted GPU memory in ultra-long texts. Traditional rotational position encoding suffers from positional drift in ultra-long sequences, impacting the recall and accuracy of key information in long documents.

Method used

By employing block preprocessing, improved rotational position encoding (YaRN), and dynamic sparse attention computation, combined with hierarchical key-value cache management, and loading text block by block through a sliding window mechanism, attention weights are dynamically filtered to achieve efficient processing of long texts.

Benefits of technology

It improves the efficiency and accuracy of long text processing, reduces computational complexity and memory usage, and maintains the contextual coherence and integrity of key information in long texts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121328562A_ABST
    Figure CN121328562A_ABST
Patent Text Reader

Abstract

The invention discloses a method for improving long text processing efficiency and accuracy, and relates to the technical field of natural language processing and large language models.According to the method, text word segmentation embedding, sliding block preprocessing, YaRN position code injection, dynamic sparse attention calculation, multi-level attention fusion, graded KV cache management and output generation are sequentially executed; position drift is inhibited through logarithmic scaling, and key contexts are adaptively screened according to the attention activeness, so that the attention calculation complexity is close to linearity; in million-level Token reasoning, the video memory occupation of the method is reduced, the remote dependency recall rate is improved, and the method is suitable for scenes such as document analysis, code auditing and multi-mode streaming understanding.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing and large language model, and particularly relates to a method for improving long text processing efficiency and accuracy. BACKGROUND

[0002] With the advent of the Transformer architecture in 2017 and its dominance, self-attention-based LLMs have shown superior performance in text generation and other tasks, but the classic self-attention mechanism has the following problems: The computational complexity limits the sequence length to several thousand tokens, making it difficult to meet the demand for millions of tokens.

[0003] The existing solutions have the following shortcomings: Local / sliding window attention (such as Longformer): reduces the amount of computation but causes semantic fragmentation across windows, reducing the recall rate of key information in long documents; Sparse attention mechanism (such as SparseTransformer): approximate linear complexity but insufficient long-range dependency capture; Infinite-length reasoning framework (such as StreamingLLM): high delay in GPU-CPU asynchronous migration, and redundant storage occupies video memory; Memory-enhanced hierarchical storage (such as InfLLM): fixed block division breaks the integrity of the paragraph, and the cross-block dependency resolution accuracy decreases.

[0004] Position encoding is also a key constraint: traditional rotational position encoding RoPE has position drift in ultra-long sequences, for example, the rotation matrix of RoPE is defined as When the context is extended to 256K tokens, the relative position error increases, affecting code auditing and other tasks. SUMMARY

[0005] In view of the above existing problems, the present application is proposed.

[0006] The present application provides a method for improving long text processing efficiency and accuracy to solve the problems of low reasoning efficiency of ultra-long text and inaccurate long-range dependency capture, as well as the problem of redundant waste of video memory.

[0007] To solve the above technical problems, the present application provides the following technical solutions: The present application provides a method for improving long text processing efficiency and accuracy, which comprises, Step S1, text segmentation and embedding: receiving a long text to be processed, segmenting it and mapping it into a high-dimensional vector; Step S2, block preprocessing: According to a fixed length L and a preset overlap rate of 10%-30%, the long text is divided into the most recent block and several historical blocks, and the sliding window mechanism is used to load the blocks one by one. The overlap rate is defined as the ratio of the number of overlapping tokens to the block length L. Step S3, Positional Encoding Injection: For each block of words, an improved rotational positional encoding YaRN is introduced, with a scaling factor... , Distance from current location To pre-train length, long-range positional differences are compressed on a logarithmic scale; Step S4, Dynamic Sparse Attention Calculation: Perform attention calculation on the current block and associated historical blocks, and calculate the average of the attention weights in real time. with standard deviation Set threshold Only retain weights greater than 100%. The key positions are involved in subsequent calculations. This is the threshold coefficient; Step S5, Multi-level attention fusion: At the bottom layer, local convolution or weighted average is used to extract fine-grained features; in the middle layer, sparse gating mechanism is used to filter cross-segment associations; and at the top layer, global key information is focused. Step S6, Hierarchical KV Cache Management: Based on Attention Score Multi-layer compression and dynamic eviction are performed on the key-value pairs of historical blocks to construct a shallow full cache, a mid-layer convolutional compression cache, and a deep dimensionality reduction cache, and historical blocks are compressed according to the preset retention length; Step S7, Output Generation: The fused representation is fed into the decoder to generate the target output.

[0008] As a preferred embodiment of the method for improving the efficiency and accuracy of long text processing described in this invention, the coefficient of the threshold decreases linearly with the depth of the network layer to ensure that shallow layers retain more remote dependencies and deep layers highlight global key information.

[0009] As a preferred embodiment of the method for improving the efficiency and accuracy of long text processing described in this invention, the historical block length L is 512 tokens, and the overlap rate is set to 10%-30%.

[0010] As a preferred embodiment of the method for improving the efficiency and accuracy of long text processing according to the present invention, the hierarchical key-value cache management includes: a) Calculate the attention score for each historical block. ; b) When the length is greater than the length of the current block, the historical portion is treated as multiple historical blocks of equal length, and the length of the historical blocks is compressed, prioritizing the elimination of parts of each historical block. The lower-scoring sections; As a preferred embodiment of the method for improving the efficiency and accuracy of long text processing described in this invention, in which: L1 loss is used during the training phase to constrain the information consistency between the current block and the corresponding historical cache block, and cross-entropy loss is used during the non-training phase to optimize the accuracy of word sequence prediction.

[0011] As a preferred embodiment of the method for improving the efficiency and accuracy of long text processing described in this invention, the sparse gating mechanism of the middle layer network dynamically activates cross-segment association paths based on attention weights.

[0012] As a preferred embodiment of the method for improving the efficiency and accuracy of long text processing according to the present invention, wherein: the scaling factor Reference length in Set to the maximum context length during model pre-training.

[0013] The present invention also discloses a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method for improving the efficiency and accuracy of long text processing.

[0014] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described method for improving the efficiency and accuracy of long text processing.

[0015] This invention also discloses the application of methods for improving the efficiency and accuracy of long text processing in document analysis, code auditing, or multimodal streaming understanding tasks.

[0016] The beneficial effects of this invention are: This invention modifies the attention module of the model based on a sparse attention mechanism. During the attention calculation phase, the model performs dynamic importance filtering on historical segments, setting an adaptive threshold based on the statistical characteristics of attention weights to retain only key positions significantly relevant to the current block. Simultaneously, data weights are filtered based on the mean and standard deviation of the data. The filtered data is then used for sparse attention calculations to reduce computational load and memory consumption, enabling the model to process long sequences more efficiently.

[0017] This invention employs a long sequence chunking mechanism, dividing the input into recent blocks and historical blocks. Historical blocks are processed in fixed-length chunks, and the results are concatenated, making it more suitable for tasks such as text generation and long document comprehension. The model uses a sliding window mechanism to process the input block by block, loading the current text block and its associated historical context fragments during training and inference.

[0018] This invention employs the YaRN (Yet another RoPE extensioN method) encoding method, improving rotational position encoding and efficiently extending the context window length of large language models. By adjusting the RoPE rotation angle calculation method and combining dynamic scaling and attention temperature adjustment, it achieves long text extrapolation capabilities. Compared to traditional encoding methods, this encoding method demonstrates stronger capabilities in long text and long context tasks. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating the method for improving the efficiency and accuracy of long text processing in Example 1.

[0021] Figure 2 This is a schematic diagram of multi-level attention fusion, which is a method for improving the efficiency and accuracy of long text processing in Example 1. Detailed Implementation

[0022] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0023] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0024] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.

[0025] For ease of understanding, the following provides additional explanation of the background technology: Long-text large language models are a type of intelligent system that breaks through the traditional limitations of sequence length. Through innovative memory enhancement and dynamic scheduling mechanisms, the model can process the context of millions of tokens with limited computing power. In tasks such as document analysis, code reasoning, and multimodal streaming understanding, this type of technology has demonstrated powerful long-range semantic association capabilities, which is of great significance for achieving complex scene understanding in general artificial intelligence.

[0026] The development of long text processing technology can be traced back to improvements on traditional attention mechanisms. While the Transformer architecture, proposed in 2017, performs excellently in text generation tasks, its O(N²) complexity of self-attention modules limits sequence length to within a few thousand tokens (e.g., the 128K context window of GPT-4). To address this, early research proposed sliding window local attention (e.g., Longformer) and sparse attention mechanisms (e.g., Sparse Transformer), reducing computation by ignoring some relationships between tokens, but sacrificing the integrity of long-distance semantics. In 2023, Infinite Length Inference was proposed, maintaining model stability through an attention cache with fixed initial tokens, but still facing the risk of losing crucial information when processing extremely long texts. To overcome the length bottleneck, InfLLM constructs a hierarchical memory architecture and a heterogeneous storage scheduling system. This technology requires no additional training, directly injecting semantic block memory units into the pre-trained model, dividing the historical context into continuous semantic blocks of 512 tokens, and indexing representative tokens based on attention scores. This enables the model to support complete semantic understanding of 1024K tokens in a single-card environment. It provides an efficient and low-cost solution for real-time long text analysis.

[0027] However, existing long text processing technologies still face multiple bottlenecks in practical applications. Traditional sliding window mechanisms rely on local attention computation, which, while reducing GPU memory usage, leads to semantic fragmentation across windows, resulting in decreased recall of key information when processing logical reasoning in long documents. Pre-trained models, such as StreamingLLM, support infinitely long inference, but their fixed cache's redundant storage reduces GPU memory utilization, and GPU-CPU asynchronous transmission latency accounts for a high proportion in analyzing texts with millions of tokens. Due to distribution shifts caused by long sequence positional encoding interpolation, the relative position error of key tokens increases when the context expands to 256K, leading to a higher function call chain misalignment rate in code auditing tasks.

[0028] In contrast, while memory-enhanced architectures (such as InfLLM) achieve zero-training scaling through hierarchical storage, their fixed-length semantic block partitioning disrupts paragraph integrity and reduces accuracy in parsing cross-block dependencies. Based on these shortcomings, optimizing the efficiency and reliability of long text technologies becomes a core challenge.

[0029] To further improve the efficiency of long text processing, this invention addresses the above problems from three main innovative aspects.

[0030] 1. Modify the attention module of the model based on the sparse attention mechanism. Weights are selected for attention computation positions based on contextual information, reducing computational cost and memory usage, enabling the model to process long sequences more efficiently.

[0031] 2. Using a long sequence block mechanism, the input is divided into recent blocks and historical blocks. Historical blocks are processed in blocks of fixed length, and the results are concatenated to make it more suitable for tasks such as text generation and long document comprehension.

[0032] 3. Using YaRN encoding, we improve rotation position encoding, efficiently extend the context window length of large language models, and achieve long text extrapolation capabilities by adjusting the rotation angle calculation method of RoPE and combining dynamic scaling and attention temperature adjustment.

[0033] For ease of understanding, the following inventions are explained in terms of their names: Dynamic sparse attention mechanism: This technique analyzes the statistical characteristics (mean μ and standard deviation σ) of the attention weight distribution in real time, retaining only key related positions exceeding a threshold for computation. This adaptive filtering mechanism reduces the O(n²) complexity of traditional attention computation to approximately linear growth while maintaining important semantic connections, thus reducing time consumption in long text processing. By introducing a weight redistribution strategy, the retained attention weights after filtering are normalized and compensated, effectively preventing information loss and maintaining accuracy comparable to the full attention model in long document question answering tasks.

[0034] Block Encoding and Sliding Window System: This system employs a sliding window block segmentation strategy with a certain overlap rate to cut ultra-long texts into continuous blocks, preserving overlapping buffer areas between adjacent blocks. Each text block is equipped with a bidirectional position-aware cache to enable cross-block state transfer, reducing the incidence of context breakage issues in long text processing, and is combined with CUDA-optimized inter-block parallel computation.

[0035] YaRN Position Encoding System: Based on the basic Rotational Position Encoding (RoPE) framework, it introduces a dynamic scaling factor. =log(1+d / L) (where d is the current distance and L is the reference length), achieving smooth expansion of position sensing through piecewise linear interpolation. This is combined with a temperature coefficient. =1 / (1+0.05d) adjusts the sharpness of the attention distribution. This encoding scheme allows the pre-trained model to expand the context window from 4k to 32k without fine-tuning, reducing perplexity (PPL) in long text summarization tasks and minimizing performance degradation in short text tasks.

[0036] Hierarchical KV caching compression strategy: Differentiated caching compression is implemented according to network depth: shallow networks retain complete KV pairs to capture fine-grained features; mid-level networks use depthwise separable convolutions to compress the KV matrix; deep networks aggregate the attention weights of each layer as an activity index and only retain the KV cache of the top-k important segments. This reduces the cache memory usage in text processing while maintaining the integrity of key information, resulting in a significantly better retention rate than traditional solutions.

[0037] Example 1, referring to Figure 1 and Figure 2 This embodiment provides a method for improving the efficiency and accuracy of long text processing, including: The FastLong model employs a strategy combining layered processing and dynamic sparsity in its architecture design to achieve efficient modeling of extremely long texts. Its core architecture consists of three parts: a block encoding module, multi-level attention layers, and scalable positional encoding. The model divides the input sequence into multiple fixed-length text segments through a block mechanism. Each segment undergoes independent feature extraction, followed by cross-segment information fusion in higher-level networks. The attention layers utilize a hybrid sparsity mechanism: lower-level networks perform fine-grained local computation, middle-level networks use dynamic gating to filter cross-segment associations, and top-level networks focus on integrating global key information.

[0038] First, the long text data is preprocessed by segmenting it into blocks, dividing the input sequence into multiple fixed-length text segments. The model uses a sliding window mechanism to process the input block by block, with each training batch loading the current text block and its associated historical context fragments simultaneously. After the text content is converted into a word sequence by a tokenizer, the embedding layer maps it into a high-dimensional vector representation. At the same time, a scalable positional encoding system is used to inject sequence positional information. This encoding scheme supports dynamically adjusting the rotation angle of the relative distance to adapt to the needs of long context modeling.

[0039] During the attention calculation phase, the model performs dynamic importance filtering on historical segments, setting an adaptive threshold based on the statistical features of attention weights to retain only key positions significantly relevant to the current block. This sparsity processing is achieved through a multi-level weight adjustment mechanism, with the lower-level network performing coarse-grained filtering of long-distance dependencies and the higher-level network focusing on fine-grained local associations. After each text block undergoes multiple transformations, residual connections and layer normalization are used to ensure stable gradient flow, while a memory caching mechanism is introduced to compress historical information, forming semantic continuity across blocks.

[0040] In the training process, the model adopts a phased, progressive training strategy. During data processing, long texts are segmented into block pairs containing historical context and the current window, and long-range dependency samples are constructed through negative sampling. During network forward propagation, each text block first passes through a low-level convolutional network to extract local features, generating segment vectors with location markers. The mid-level network concatenates the current segment vector with historical segment vectors, uses sparse attention with threshold filtering to calculate cross-segment associations, and dynamically discards weights below an adaptive threshold. The location encoding system employs an improved YaRN hybrid scheme, where the base rotation matrix ensures short-range location accuracy, and the dynamic scaling factor automatically adjusts the discriminative power of long-range locations based on the inter-segment distance. During training, a momentum cache of historical blocks is maintained synchronously, and the consistency of information between the current block and the historical cache is constrained through contrastive learning loss.

[0041] The inference process employs a dual mechanism of streaming processing and memory compression. When processing a new input block, the system executes two computational paths in parallel: the main path performs full attention computation on the current block and generates a prediction result, while the auxiliary path performs convolutional compression and attention weight ranking on historical cache blocks. The key-value cache uses a hierarchical storage structure, with shallow layers retaining fine-grained historical information and deep layers storing compressed semantic summaries. After each inference iteration, the system dynamically evicts low-value tokens based on attention metrics. For sequences exceeding a preset length, the model initiates a hierarchical compression process, compressing historical blocks within the current window while preserving the complete details of nearby blocks.

[0042] Specifically, traditional language models, which mostly employ ordinary attention mechanisms, face the problem of double-incremental attention computational complexity with sequence length. For long sequence segmentation mechanisms, introducing windows and historical semantic filtering effectively maintains the coherence of contextual semantics, allowing the model to dynamically retrieve key information from previous blocks when processing the current block, effectively mitigating the problem of double-incremental attention computational complexity. Since commonly used attention mechanisms have high computational complexity, adopting a sparse attention mechanism can significantly improve inference speed in a short time. Furthermore, addressing the scalability challenge of positional encoding, traditional Rotated Positional Encoding (RoPE) suffers from a sharp drop in positional awareness accuracy beyond the training length. By incorporating YaRN's dynamic wavelength extension mechanism, the model can maintain short-range positional accuracy while performing logarithmic-scale compression of long-distance positional differences.

[0043] Long-text large-scale language models and their derivatives and optimizations are currently at the forefront of academia. Model structure improvement and memory optimization remain the optimal methods for enhancing the capabilities of long-text large-scale language models. Therefore, segmenting the model's historical memory and adding memory weights for selection is currently leading the way. Furthermore, to address the issue of computational complexity increasing quadratically with sequence length during inference, historical memory segmentation and sparse attention mechanisms offer a good solution. By dynamically analyzing long-term memory and adjusting its weight ratio, optimal performance and effectiveness can be achieved, improving the model's inference performance and representing a significant breakthrough in untrained long-text models.

[0044] In summary, the FastLong model of this invention addresses three major pain points of traditional large language models in long text processing: computational efficiency, context modeling capability, and positional encoding adaptability. Through three core technological improvements, it achieves significant advantages. At the attention mechanism level, traditional models require global attention to all historical information when processing long sequences, resulting in a quadratic increase in computational complexity (O(n²)) with sequence length.

[0045] This invention innovatively introduces a dynamic sparse attention mechanism, which adaptively sets dynamic thresholds to filter key related positions by analyzing the statistical distribution characteristics of attention weights (such as mean and standard deviation) in real time. During training and inference, this mechanism automatically retains the most relevant historical information fragments of the current block, effectively reducing the computational complexity of attention to an approximately linear level of O(n), significantly reducing GPU memory usage while maintaining long-distance dependency capture capabilities. This technique reduces the computational overhead of attention while maintaining task accuracy comparable to that of full attention.

[0046] In terms of long sequence processing architecture design, traditional processing methods struggle to handle the continuous inference requirements of ultra-long texts. The model of this invention employs a hierarchical block processing mechanism, dividing the input sequence into recently active blocks and historical cache blocks. The historical blocks are segmented and compressed for storage using a fixed-length sliding window. This achieves three core benefits: First, during the training phase, block processing overcomes the limitations of GPU memory capacity, enabling the model to handle ultra-long texts; second, during inference, an incremental processing strategy is adopted, dynamically concatenating the current block with associated historical blocks, maintaining contextual coherence while avoiding redundant computation; third, by combining attention sparsity technology, a two-layer processing paradigm of local fine-grained modeling and global key information filtering is constructed.

[0047] This embodiment also provides a computer device applicable to a method for improving the efficiency and accuracy of long text processing, comprising: a memory and a processor; the memory for storing computer-executable instructions, and the processor for executing the computer-executable instructions to implement the method for improving the efficiency and accuracy of long text processing as proposed in the above embodiment.

[0048] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0049] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a method for improving the efficiency and accuracy of long text processing as proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.

[0050] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for improving the efficiency and accuracy of long text processing, characterized in that, include, Step S1, Text Segmentation and Embedding: Receive the long text to be processed, segment it into words and map it into high-dimensional vectors; Step S2, block preprocessing: According to a fixed length L and a preset overlap rate of 10%-30%, the long text is divided into the most recent block and several historical blocks, and the sliding window mechanism is used to load the blocks one by one. The overlap rate is defined as the ratio of the number of overlapping tokens to the block length L. Step S3, Positional Encoding Injection: For each block of words, an improved rotational positional encoding YaRN is introduced, with a scaling factor... , Distance from current location To pre-train length, long-range positional differences are compressed on a logarithmic scale; Step S4, Dynamic Sparse Attention Calculation: Perform attention calculation on the current block and associated historical blocks, and calculate the average of the attention weights in real time. with standard deviation Set threshold Only retain weights greater than 100%. The key positions are involved in subsequent calculations. This is the threshold coefficient; Step S5, Multi-level attention fusion: At the bottom layer, local convolution or weighted average is used to extract fine-grained features; in the middle layer, sparse gating mechanism is used to filter cross-segment associations; and at the top layer, global key information is focused. Step S6, Hierarchical KV Cache Management: Based on Attention Score Multi-layer compression and dynamic eviction are performed on the key-value pairs of historical blocks to construct a shallow full cache, a mid-layer convolutional compression cache, and a deep dimensionality reduction cache, and historical blocks are compressed according to the preset retention length; Step S7, Output Generation: The fused representation is fed into the decoder to generate the target output.

2. The method for improving the efficiency and accuracy of long text processing as described in claim 1, characterized in that, The threshold coefficient It decreases linearly with network layer depth.

3. The method for improving the efficiency and accuracy of long text processing as described in claim 1, characterized in that, The length L of the historical block is 512 tokens, and the overlap rate is set to 10%-30%.

4. The method for improving the efficiency and accuracy of long text processing as described in claim 1, characterized in that, The hierarchical key-value cache management includes: a) Calculate the attention score for each historical block. ; b) When the length is greater than the length of the current block, the historical portion is treated as multiple historical blocks of equal length, and the length of the historical blocks is compressed, prioritizing the elimination of parts of each historical block. The lower-scoring sections.

5. The method for improving the efficiency and accuracy of long text processing as described in claim 1, characterized in that, During the training phase, L1 loss is used to constrain the information consistency between the current block and the corresponding historical cache block. During the non-training phase, cross-entropy loss is used to optimize the accuracy of word sequence prediction.

6. The method for improving the efficiency and accuracy of long text processing as described in claim 1, characterized in that, The sparse gating mechanism of the mid-layer network dynamically activates cross-segment association paths based on attention weights.

7. The method for improving the efficiency and accuracy of long text processing as described in claim 1, characterized in that, The scaling factor Reference length in Set to the maximum context length during model pre-training.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes a computer program, it implements the steps of the method for improving the efficiency and accuracy of long text processing as described in any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the method for improving the efficiency and accuracy of long text processing as described in any one of claims 1 to 7.

10. The application of the method for improving the efficiency and accuracy of long text processing as described in claim 1 in document analysis, code auditing, or multimodal streaming understanding tasks.

Citation Information

Cited By

  • Large language model segmented hybrid reasoning method based on uncertain driving

    CN121787593A

  • Large language model-oriented data management method

    CN122020132A

  • Enhanced shallow KV Cache compression method and system based on temporary storage screening and residual compensation

    CN122262248A

  • An Enhanced Shallow KV Cache Compression Method and System Based on Temporary Cache Filtering and Residual Compensation

    CN122262248B

  • A method for ultra-long context tensor parallel incremental attention and difference compression transmission

    CN122363881A