AB
AiBoss
project

Kimi Linear - A Novel Hybrid Linear Attention Architecture Open Sourced from the Dark Side of the Moon

Kimi Linear is a novel hybrid linear attention architecture introduced by Dark Side of the Moon, designed to improve the efficiency and performance of large language models (LLMs) in long sequence tasks. Its core component is Kimi Delta Attention (KDA...

What is Kimi Linear?

Kimi Linear, introduced by Dark Side of the Moon, is a novel hybrid linear attention architecture designed to improve the efficiency and performance of large language models (LLMs) in long sequence tasks. Its core component, Kimi Delta Attention (KDA), significantly enhances the model's expressive power and hardware efficiency through a refined channel-level gating mechanism and efficient block processing algorithm. Kimi Linear employs a 3:1 hybrid design of KDA and full attention layers (MLA), drastically reducing the use of key-value caches (by 75%), achieving a 6.3x speedup in decoding millions of texts. The Kimi Linear architecture outperforms traditional full attention mechanisms in both short and long sequence tasks and performs exceptionally well in reinforcement learning tasks.

Kimi Linear's main functions

  • Efficiently handle long sequence tasksKimi Linear significantly reduces key-value cache usage (by 75%) through a hybrid linear attention architecture, achieving a 6.3x throughput improvement in decoding 1MB long texts.
  • Precision Information ManagementKimi Delta Attention (KDA) employs a channel-level gating mechanism, enabling the model to precisely and selectively retain key information and forget irrelevant content, thereby enhancing its ability to process long sequences.
  • Strengthen reasoning abilityKimi Linear performs exceptionally well in reinforcement learning tasks that require complex reasoning, with faster growth in training accuracy and outperforming full attention models on the test set.
  • Hardware-friendly designIt employs an efficient block processing algorithm, making full use of the Tensor Cores of modern GPUs to achieve high matrix multiplication throughput and significantly reduce computation time and resource consumption.
  • Adaptable to various task scenariosKimi Linear performs well in both short and long sequence tasks, and is suitable for various application scenarios such as language understanding, code generation, and mathematical reasoning, with good generalization ability.

Kimi Linear's technical principles

  • Hybrid linear attention architectureKimi Linear is based on a 3:1 hybrid design, where a full attention layer (MLA) is inserted after every three Kimi Delta Attention (KDA) layers. This design combines the efficiency of linear attention with the powerful expressiveness of full attention, while reducing the amount of key-value cache used and improving the model's decoding speed.
  • Kimi Delta Attention (KDA)KDA is the core module of Kimi Linear, achieving efficient processing through the following mechanisms:
    • Refined gating mechanism: Introducing channel-level gating, each feature dimension has an independent forgetting rate, similar to RoPE's location encoding, to enhance the model's ability to perceive location information.
    • Hardware-efficient block processing algorithmsThe block-processing parallel algorithm is adopted to reduce the amount of computation and improve hardware utilization. The state transition of KDA can be regarded as a special diagonal low-rank (DPLR) matrix, and the computational complexity is reduced through the constrained structure.
  • No Position Encoding (NoPE)Kimi Linear's MLA layer does not use any explicit positional encoding (such as RoPE), leaving the encoding of positional information entirely to the KDA layer. This design simplifies the model architecture and enhances robustness and extrapolation capabilities for long text tasks.
  • Combined with expert blending (MoE)Kimi Linear combines Mixture-of-Experts (MoE) technology to expand the model parameter scale through sparse activation patterns, further improving training and inference efficiency. The model has a total of 48 billion parameters, with only 3 billion parameters activated in each forward propagation.

Kimi Linear's project address

  • HuggingFace model libraryhttps://huggingface.co/moonshotai/Kimi-Linear-48B-A3B-Instruct
  • Technical Papers: https://github.com/MoonshotAI/Kimi-Linear/blob/master/tech_report.pdf

Application scenarios of Kimi Linear

  • Long text generationKimi Linear performs exceptionally well when processing million-level texts, with a 6.3x speedup in decoding, making it suitable for generating long novels, research reports, and more.
  • Code generation and understandingIts efficient long sequence processing capabilities make it outstanding in code generation and understanding tasks, supporting the generation of more complex code logic and long code snippets.
  • Mathematical Reasoning and Problem SolvingIn reinforcement learning training for mathematical tasks, Kimi Linear's training accuracy increases faster, and its performance on the test set is better than that of the full attention model, making it suitable for solving complex mathematical problems.
  • Language Comprehension and Question AnsweringKimi Linear performs well in both short and long sequence tasks, and is suitable for language understanding, question answering systems, etc., supporting longer contextual understanding and generation.
  • Multimodal tasksKimi Linear can be used for multimodal tasks such as image description generation and video content understanding, and supports longer text descriptions and complex logical reasoning.