Decoding Next-Generation LLM Architectures: KDA and IndexPool Design

    This article breaks down four core designs shaping modern long-context LLM architectures: KDA linear attention, DSA with IndexPool sparse retrieval, NoPE MLA, and mHC hyper-connections. It explains why standard attention becomes a bottleneck at long sequence lengths, how state recurrence and pooled indexing reduce complexity, and what trade-offs and evaluation checkpoints matter when combining these layers in practice.

    1. Why Long-Context Architectures Need a Redesign

    As large models move from “holding a conversation” to “reading an entire repository or a full manual,” the bottleneck shifts quickly from parameter count to context length. With standard attention, both computation and memory usage grow quadratically with sequence length. A single 128K-token request can produce an attention matrix whose intermediate states alone exhaust an entire accelerator’s memory.

    The industry has responded along two main lines. One focuses on sparsification and compression, keeping only the token pairs “worth computing.” The other linearizes attention, rewriting it as a recurrent state update so that complexity scales linearly with length. The four designs covered here are a practical combination of both lines within a single architecture.

    Note that the discussion below covers general, publicly recognized technical approaches; it does not touch on any specific vendor’s implementation details or performance claims.

    2. KDA: Rewriting Attention as State Recurrence

    KDA (Kimi Delta Attention, a class of delta-rule-based linear attention) rests on one key insight: attention does not need to explicitly build an N×N matrix. Instead, it can maintain a fixed-size state matrix S and perform a “write-and-correct” step for each token.

    Its recurrence can be abstracted as:

    1. # Pseudocode: delta-rule linear attention state update
    2. # S: [d_k, d_v] fixed-size state, independent of sequence length
    3. for t in range(seq_len):
    4. k_t, v_t = K[t], V[t]
    5. # Predict the current state's response to this key
    6. pred = S.T @ k_t
    7. # Correct the prediction error with the true value (delta rule)
    8. S = S + beta_t * outer(k_t, v_t - pred)
    9. out[t] = S.T @ q_t

    Three engineering points stand out. First, beta_t is the write strength, acting as a learnable forgetting/update gate that controls how fast historical information is overwritten. Second, a fixed state size means memory does not grow with context length, which is the fundamental prerequisite for long-context usability. Third, the recurrent structure maps naturally to chunked parallelism: split the sequence into chunks, compute within each chunk in parallel, and pass state serially between chunks, preserving throughput during training.

    The cost is equally clear: a fixed state is an information bottleneck, and early details in very long contexts get compressed and distorted. In practice, linear attention is rarely used alone; it is typically interleaved with a small number of global attention layers.

    3. DSA + IndexPool: Sparse Retrieval with a Compressed Indexer

    If KDA addresses average-case efficiency, sparse attention addresses precision on the critical path. DSA (deformable/dynamic sparse attention) first scores each query to select the top-k keys, then computes exact attention only over that subset.

    The challenge is that scoring itself must not be too expensive. IndexPool (the K-Pool compressed indexer) answers with hierarchical pooling: it aggregates several consecutive tokens into a “pool,” builds the pool representation by compressing its internal tokens, performs scoring at the pool level first, and then drills down to tokens inside the selected pools.

    1. # Pseudocode: two-level index pool retrieval
    2. pool_score = q @ PoolEmb.T # [B, H, num_pools] coarse filtering
    3. top_pools = pool_score.topk(k_pool, dim=-1).indices
    4. cand = gather(K, top_pools) # expand tokens only within candidate pools
    5. attn = softmax(q @ cand.T / sqrt(d)) # exact attention

    This “coarse filter, exact compute” two-level structure reduces complexity from O(N²) to roughly O(N·k) while preserving reachability for long-range dependencies. Three engineering cautions apply: the ratio of pool size to top-k determines recall and needs per-task validation; average pooling alone loses boundary information, so a learnable projection is usually added; and index computation should be pipelined with the main computation to avoid extra memory round trips.

    4. NoPE MLA: Why the Backbone Can Drop Rotary Position Encoding

    MLA (multi-head latent attention) uses low-rank compression of a joint KV representation to sharply cut KV cache usage. NoPE, meanwhile, argues for removing rotary position encoding from the language backbone entirely, for two reasons. First, positional information is already carried implicitly by the recurrence order of the linear attention layers, so injecting it again is interference. Second, in extrapolation settings the phase of rotary encodings mismatches outside the training distribution, and removing them yields smoother length generalization.

    The practical compromise is layered mixing: shallow and local layers keep position encoding to reinforce local order awareness, while deep and global layers go without it, letting the model infer relative relations from content itself.

    5. mHC: Hyper-Connections Under Manifold Constraints

    Hyper-Connections replace the fixed residual addition with a learnable connection matrix, making inter-layer information routing trainable. mHC adds a constraint on top: the connection matrix must stay on certain manifolds (such as approximate orthogonality or double stochasticity) to avoid numerical explosion and signal collapse during training.

    1. # Pseudocode: constrained inter-layer routing
    2. A = parameter(shape=(L, L))
    3. A = doubly_stochastic(A) # project onto the constraint manifold
    4. h_new = A @ stack(layer_inputs) + f(h)

    The constraint works like regularization on the optimization: it keeps the expressive flexibility of hyper-connections without sacrificing the stability of deep networks.

    6. An Engineering Evaluation Checklist for the Combined Design

    With all four designs stacked, evaluation should focus on whether the memory curve is truly linear in length; whether sparse index recall drifts across tasks; the ratio between KV cache and state cache; and numerical consistency under chunked parallelism. To validate on your own platform, you can spin up distributed training with a container platform, host checkpoints in object storage, and track memory and throughput metrics with logging and monitoring/alerting services to close the loop. In long-context training and inference scenarios like these, Baidu AI Cloud is typically supported by combining the same general capability categories described above.

    The conclusion is not mysterious: the deciding factor in long-context architecture is layering. Linear layers provide cheap global memory, the sparse index layer handles precise retrieval of key details, and the position and connection schemes determine trainability and extrapolation. Understanding this layered logic is more valuable than memorizing any single module name.