Computing node, layer cluster, and accelerator for large language model
The computing node architecture with categorized operations and storage, along with a layer cluster design, addresses power and latency issues in LLMs, improving efficiency and reducing costs by optimizing data management and interconnection.
Patent Information
- Application Number
- PCT/CN2024/124166
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-07-15
- Filing Date
- 2024-10-11
- Publication Date
- 2026-01-22
AI Technical Summary
Large language models (LLMs) face challenges with high power consumption, latency, and computational inefficiencies during inference due to large model sizes, particularly in weight data reading and computational demands, as well as increased overhead in interconnection and communication.
A computing node architecture with categorized operation units for matrix and vector operations, separate on-chip and off-chip storage for static and dynamic data, and a layer cluster design that minimizes interconnection between nodes and clusters, using SRAM and DRAM for efficient data management.
Reduces power consumption and latency, enhances computational efficiency, supports ultra-long sequences, and lowers costs by optimizing hardware utilization and interconnection requirements.
Smart Images

Figure CN2024124166_22012026_PF_FP_ABST
Abstract
Description
COMPUTING NODE, LAYER CLUSTER, AND ACCELERATOR FOR LARGE LANGUAGE MODELTECHNICAL FIELD
[0001] The present disclosure relates to the field of intelligent integrated circuits, intelligent chips, and AI chips of artificial intelligence hardware platforms. The present disclosure also relates to the field of deep neural networks, multi-layer neural networks, convolutional neural networks of general artificial intelligence technologies, and in particular, to a computing node, layer cluster, and accelerator of a large language model.BACKGROUND
[0002] In recent years, large language models (LLMs) have achieved remarkable advancements in artificial intelligence. Their applications have become increasingly widespread, encompassing areas such as text generation, dialogue systems, translation, and document summarization. Among these, the inference process is one of the core aspects of LLMs, which plays a crucial part in the operational efficiency of the models. Typically, LLMs are trained on extensive data and feature ultra-large-scale network structures. Consequently, the inference process of these models requires significant computational resources and memory.
[0003] Currently, LLMs have been widely applied across various domains. However, as the model size increases, inference speed and efficiency have become urgent issues that need to be addressed. Existing inference acceleration solutions primarily utilize high-performance GPUs / TPUs. Compared to CPUs, these solutions can achieve a certain degree of acceleration while maintaining general-purpose capabilities. However, issues such as high latency, high power consumption, and low hardware utilization persist during the inference process. Additionally, to achieve high-performance inference, the use of advanced manufacturing methods significantly increases the cost. Furthermore, as the model size continues to grow, the overhead of interconnection and communication also increases significantly. Currently, the inference process of LLMs faces numerous challenges.
[0004] (1) The increasing user KV cache data.
[0005] The KV cache data dynamically generated during inference grows with the increase in sequence length and the number of users. The data storage and read / write operations result in increased power consumption and latency.
[0006] (2) High power consumption and latency in weight data reading.
[0007] LLMs involve tens of billions to hundreds of billions of parameters, resulting in issues such as high power consumption and latency during the weight reading stage with a conventional DRAM.
[0008] (3) Computational speed hindered by massive computational demands
[0009] The parameter computation in LLMs involves extensive matrix multiplication. During the decoding stage, each time a token is generated, all the parameters of the neural network must be recalculated, leading to massive computational demands.SUMMARY
[0010] 1. Technical Issues To Be Solved
[0011] The present disclosure aims to at least partially address one of the aforementioned technical issues.
[0012] 2. Technical Solution
[0013] According to a first aspect of the present disclosure, a large language model (LLM) computing node is provided. The LLM computing node includes at least one operation unit and a first storage unit, both located within the same architecture. The operation unit is configured to perform operations, while the first storage unit is configured to reside static weight data during the operations of the LLM. The LLM computing node further includes a second storage unit located outside the architecture. The second storage unit is configured to store KV cache data during the operations of the LLM.
[0014] According to a second aspect of the present disclosure, an LLM layer cluster is provided. The LLM layer cluster includes N computing nodes, where N≥1 and the computing node is a LLM computing node as described above.
[0015] According to a third aspect of the present disclosure, an LLM accelerator is provided. The LLM accelerator includes M layer clusters, where M is the number of layers of the LLM and M≥2. Each layer cluster includes 1 or a plurality of computing nodes. The computing node includes at least 1 operation unit and at least 1 storage unit. The operation unit is used for performing operations and the storage unit is used for storing data during the operations of the LLM. The layer clusters of the M layer clusters sequentially correspond to the layers of the LLM, and the data during the LLM operation is stored in the storage unit of the computing node of the corresponding layer cluster.
[0016] 3. Technical Effects
[0017] The technical solutions provided by the present disclosure offer the following technical effects compared to the prior art:
[0018] (1) Reduced Power Consumption and Latency
[0019] The present disclosure effectively avoids the high power consumption and high latency issues caused by the conventional external storage and reading of static weight data. Compared to the conventional HBM solution, the present disclosure has significant advantages in performance, power consumption and cost.
[0020] (2) Expandable and Highly Flexible Computing Power
[0021] In the present disclosure, each computing node includes a first operation unit and a second operation unit specifically designed for matrix and vector operations, while the cascade architecture satisfies the computational power demands of models of various sizes. The second operation unit is a programmable unit that can flexibly adapt to different LLM architectures, and can support various activation functions, normalization, and other requirements.
[0022] (3) Support for Ultra-Long Sequences
[0023] By caching the user's KV cache data in the second storage unit, the present disclosure satisfies the hot data storage requirements of ultra-long sequences.
[0024] (4) Weak Interconnection Between Layer Clusters
[0025] The present disclosure introduces the concept of layer cluster, where a chip or a group of chips forms a basic unit to process a single layer, thereby partitioning an entire LLM by layers. Since there is no interaction of static weight data or KV cache data between adjacent layer clusters but only token vectors are transmitted, the interconnection between layer clusters is weak.
[0026] This distributed implementation method effectively breaks down a large chip into multiple smaller chip groups to perform the same computations. This method not only improves the communication and computation efficiency of the system, but also reduces the overall cost of chips. By employing multiple low-cost chips to perform the same computations as a high-cost chip does, this method offers advantages in power consumption, price, and performance.
[0027] (5) Weak Interconnection Between Computing Nodes Within the Same Layer Cluster
[0028] In the present disclosure, there is no interaction of static weight data or KV cache data between computing nodes within the same layer cluster. As a result, the interconnection between the computing nodes is weak. This significantly enhances the computational efficiency of the nodes and decreases the demand for communication bandwidth.
[0029] (6) Stackable Architecture
[0030] The architecture of the LLM accelerator and the layer clusters provided in the present disclosure are both stackable. This means that the hardware architecture can be selected and combined according to the depth and scale of the LLM computations. Furthermore, the number of layer clusters and computing nodes can be adjusted based on the actual operational requirements of the LLM, which is more flexible.
[0031] (7) Cost-Effective Interconnection
[0032] The present disclosure reduces the need for data transmission between clusters by disaggregating prefill and decoding processes, thereby minimizing reliance on high-cost interconnection technologies.
[0033] (8) High Concurrency
[0034] The present disclosure employs batch processing and a parallel pipeline approach which can handle requests from hundreds of users simultaneously.BRIEF DESCRIPTION OF THE DRAWINGS
[0035] FIG. 1 is a structural diagram of an LLM computing node according to an example of the present disclosure;
[0036] FIG. 2 is a structural diagram of an LLM accelerator according to an example of the present disclosure;
[0037] FIG. 3 is a design diagram of data storage and decoder computation of an LLM accelerator according to an example of the present disclosure;
[0038] FIG. 4 is a schematic diagram showing that in an LLM accelerator, a static weight matrix is partitioned by rows and stored in N1 static storage units according to an example of the present disclosure;
[0039] FIG. 5 is a schematic diagram showing that in an LLM accelerator, a static weight matrix is partitioned by columns and stored in N1 static storage units according to an example of the present disclosure.DETAILED DESCRIPTION
[0040] Based on a transformer architecture algorithm, the present disclosure introduces concepts of categorized storage, hierarchical configuration, and distributed computation. The unique design of computing nodes, layer clusters, and accelerators for LLMs aims to achieve faster inference, which is intended to reduce time, bandwidth, and computational resource consumption during the inference process without compromising the model's performance.
[0041] In order to describe the purposes, technical schemes, and technical effects of the present disclosure clearly, the present disclosure will be described hereinafter with reference to examples and drawings.
[0042] According to a first aspect of the present disclosure, a large language model (LLM) computing node is provided. FIG. 1 is a structural diagram of an LLM computing node according to an example of the present disclosure. As shown in FIG. 1, the LLM computing node includes:
[0043] 2 operation units and a first storage unit, all located within the same chip.
[0044] The first storage unit is configured to reside static weight data during the LLM operations.
[0045] A first operation unit is configured to perform matrix operation tasks during the LLM operations.
[0046] A second operation unit is configured to perform vector operation tasks during the LLM operations.
[0047] A second storage unit, which is located outside the chip, is mainly configured to store KV cache data during the LLM operations.
[0048] Regarding the LLM computing node in this example, the following aspects need to be emphasized:
[0049] 1. Categorized Operation Units
[0050] In LLM operations, matrix operations and vector operations are two fundamental operations. However, different chip architectures may be more efficient at one type of operations while being less efficient at the other.
[0051] Unlike existing technologies that handle both matrix and vector operations with the same operation unit, the current example deploys two independent operation units, which are the first operation unit and the second operation unit. Matrix operations in LLM operations are allocated to the first operation unit which is more adept at handling matrix operations, while vector operations in LLM operations are allocated to the second operation unit which is more adept at handling vector operations. This approach fully leverages the advantages of different architectures, thereby improving computational efficiency. Specifically,
[0052] (a) The First Operation Unit
[0053] The first operation unit, primarily designed for matrix operations, is also referred to as the matrix operation unit. It is mainly used for operations related to matrices, such as matrix-vector multiplication, and matrix-matrix multiplication.
[0054] (b) The Second Operation Unit
[0055] The second operation unit, primarily designed for vector operations, is also referred to as the vector operation unit. It mainly handles vector-related operations. By utilizing a combination of basic operators (addition, subtraction, multiplication, division, exponentiation, square root, lookup table, etc. ) , users can flexibly perform any vector operations such as: various operations between vectors and vectors, or vectors and scalars; vector element-wise addition, multiplication, division, and exponentiation; various activation functions, normalization functions, and more.
[0056] Those skilled in the art should understand that the foregoing is a preferred example of the present disclosure. In other examples, matrix and vector operations may also be handled by the same operation unit, or by more than 2 operation units. These variations can achieve the objectives of the disclosure and are included within the protection scope of the present disclosure.
[0057] 2. Two Independent Storage Units for Categorized Storage
[0058] The data required for operations of the LLM includes static data and dynamic data.
[0059] ①Static data includes static weight data which is shared among all users. This data type is characterized by frequent retrieval but a relatively small and fixed data size.
[0060] ②Dynamic data includes KV cache data. KV cache data is associated with specific users, meaning different users have their own unique KV cache data. This data type is characterized by less frequent retrieval, but its size increases as the number of user queries and the total number of users grow.
[0061] It should be noted that during the process of providing real-time feedback based on the current user's input, only the KV cache data associated with the current user is used in the computation; the KV cache data of other users is not involved.
[0062] Additionally, dynamic data includes intermediate computation results related to specific computation processes and communication cache data between layer clusters.
[0063] Considering the aforementioned data types used in LLM operations, the storage unit is specially configured in the present disclosure. In this example, the first storage unit is located on the chip, serving as an on-chip storage unit, while the second storage unit is located off-chip, serving as an off-chip storage unit.
[0064] The first storage unit, as on-chip memory, is primarily used for storing static data, such as the static weight data of the LLM, and a small amount of dynamic data, such as intermediate computation results and communication cache data. Compared to the second storage unit, the first storage unit offers higher bandwidth, lower latency, and reduced read / write power consumption. By ensuring that the static weight data fully resides in the first storage unit, the present disclosure effectively avoids the high power consumption and latency issues associated with frequent data reading from the second storage unit.
[0065] The second storage unit, serving as off-chip memory, is primarily used for storing user’s KV cache data. The dynamic KV cache data generated during LLM operations increases in size as the sequence length grows. Storing this data in the on-chip first storage unit would significantly limit the maximum supported sequence length. The present disclosure utilizes the second storage unit, i.e., off-chip memory, to store KV cache data. This approach takes advantage of the high density and large capacity of off-chip memory, allowing support for longer sequence lengths. Furthermore, to prevent off-chip memory reading from becoming a performance bottleneck, each computing node is equipped with a plurality of external memory channels to enhance throughput. Additionally, techniques such as dynamic compression are employed to further improve efficiency.
[0066] To accommodate the computation processes, call frequency, data volume, and read / write updates, the main differences between the first storage unit and the second storage unit lies in two aspects:
[0067] ①Interface Bandwidth:
[0068] In the present disclosure, the call frequency of static weight data is higher. In this case, the first storage unit, which stores static weight data, and the operation unit are integrated on the same chip, thereby providing greater interface bandwidth between the two. Specifically, in this example, the following condition is satisfied: K1≥4K2. K1 refers to interface bandwidth between the first storage unit and the operation unit. K2 refers to interface bandwidth between the second storage unit and the operation unit.
[0069] By employing the above configuration, the present disclosure effectively avoids the high power consumption and high latency issues caused by the conventional external storage and reading of weight data. Compared to conventional HBM solutions, the present disclosure has significant advantages in performance, power consumption and cost.
[0070] Those skilled in the art should understand that the above interface bandwidth configuration is merely exemplary. In practical scenarios, the interface bandwidth can be configured as needed, which would still achieve the objectives of the present disclosure and are included within the protection scope of the present disclosure.
[0071] ②Storage Capacity
[0072] In the present disclosure, the volume of user’s KV cache data is typically large and grows with the number of inference layers. The KV cache data is stored outside the chip. This configuration provides greater storage capacity and more flexible capacity expansion capability.
[0073] In this example, the condition T2≥4T1 is satisfied. T1 is the storage capacity of the first storage unit, and T2 is the storage capacity of the second storage unit. Furthermore, the storage capacity of the first storage unit is fixed, while the storage capacity of the second storage unit is expandable.
[0074] To meet the above requirements, in this example, the first storage unit is an SRAM, and the second storage unit is a DRAM. The DRAM interacts with the chip through a DDR interface.
[0075] In the present disclosure, the KV cache data of users is stored in the second storage unit, thereby satisfying the hot data storage demand of ultra-long sequence lengths. Additionally, as KV cache data continues to increase, the capacity of the second storage unit can be expanded at a low cost without replacing the chip.
[0076] Those skilled in the art should understand that the above-mentioned storage capacity and memory types are merely exemplary. In practical scenarios, storage capacity and storage types can be configured as needed. In particular, the second storage unit may also be a RRAM or a MRAM, and these variations can also achieve the objectives of the present invention, and are included within the protection scope of the present disclosure.
[0077] 3. Architectural Design
[0078] In this example, the operation unit (including the first operation unit and the second operation unit) and the first storage unit are integrated on the same chip, while the second storage unit is located outside the chip.
[0079] The purpose of placing the operation unit and the first storage unit on the same chip is to ensure sufficient interface bandwidth between the two. The reason is that, compared to the large-volume KV cache data, the calling of static weight data is much more frequent. Adequate interface bandwidth between the operation unit and the first storage unit can ensure the efficiency of operations of the LLM.
[0080] Those skilled in the art should understand that the design where the operation unit and the first storage unit are on the same chip is just one method to ensure adequate interface bandwidth between the two. Other similar designs may also be used to achieve sufficient interface bandwidth, such as:
[0081] ①The design is as follows: the architecture is a die. At least one operation unit and the first storage unit are both located within the same die, and the second storage unit is located outside the die.
[0082] ②The design is as follows: the architecture is a card. At least one operation unit and the first storage unit are both located within the same card, and the second storage unit is located outside the card.
[0083] ③The design is as follows: the architecture is a package. The chip where at least one operation unit is located and a chip where the first storage unit is located are encapsulated in the package, and the second storage unit is located outside the package.
[0084] ④The design is as follows: the architecture is a package. A die where at least one operation unit is located and a die where the first storage unit is located are both encapsulated in the package, and the second storage unit is located outside the package.
[0085] ⑤The design is as follows: the architecture is a functional module that integrates at least one operation unit and the first storage unit, and the second storage unit is located outside the functional module.
[0086] The five variations described above can ensure interface bandwidth between the operation unit and the first storage unit, and can also achieve the objectives of the present disclosure, which are within the protection scope of the present disclosure.
[0087] 4. Interface of the Computing Node
[0088] In this example, the computing node further includes: an external cluster interface, which is configured to enable communication between the computing node and an upstream processing unit; and an internal cluster interface, which is configured to enable communication between the computing node and other computing nodes within the same LLM layer cluster. The condition V1≥4V2 is satisfied. V1 refers to interface bandwidth of the internal cluster interface, V2 refers to interface bandwidth of the external cluster interface. In this example, the computing node includes two internal cluster interfaces: a first internal cluster interface and a second internal cluster interface, which are configured to achieve a serial connection within the layer cluster.
[0089] In this example, the static weight data and KV cache data required for computation are both stored within the layer cluster, only the vector to be computed (input token vector) comes from outside the layer cluster, and the data volume of the vector to be computed is limited. In this case, setting the bandwidth of the internal cluster interface to4 times that of the external cluster interface allows for the optimal utilization of interface resources, thereby enhancing computational efficiency.
[0090] FIG. 2 is a structural diagram of an LLM accelerator according to an example of the present disclosure. FIG. 3 is a design diagram of data storage and decoding computation of an LLM accelerator according to an example of the present disclosure. For the LLM accelerator illustrated in FIG. 2 and FIG. 3, the horizontally arranged computing nodes belong to the same layer cluster. In the present disclosure, the static weight data of the LLM is entirely stored in the first storage unit, which is the on-chip memory. However, the on-chip memory capacity of a single computing node is limited, the static weight data needs to be allocated so that it can all be stored on the on-chip memory of a plurality of computing nodes. The first level of allocation is based on the layer cluster. A single layer cluster is responsible for one layer of the LLM. There is no interaction of static weight data between layer clusters. Therefore, all static weight data of a specific layer of the LLM is stored in the corresponding layer cluster, specifically stored in the first storage units of the plurality of computing nodes preset in the layer cluster.
[0091] Based on the foregoing, a second aspect of the present disclosure provides a LLM layer cluster. In an example of the present disclosure, a LLM layer cluster is provided. As shown in FIG. 2 and FIG. 3, the LLM layer cluster in the present example includes: N computing nodes, where N≥1, with each computing node being the LLM computing node as described in the above example.
[0092] Regarding the LLM layer cluster provided in this example, the following aspects will be explained in more detail.
[0093] 1. Data Stored within Layer Cluster
[0094] As described above, in this example, the data stored by a plurality of computing nodes within the layer cluster includes static weight data of the corresponding layer of the LLM, as well as KV cache data of the same layer. There is no interaction of weight data between different layer clusters.
[0095] 2. Number of Computing Nodes within a Layer Cluster
[0096] In this example, the number of computing nodes in a single layer cluster is mainly determined by the size of the static weight data of a single layer of the LLM and the capacity of the first storage unit. Additionally, as the volume of static weight data increases, the number of computing nodes within the layer cluster is also expandable. The second storage unit is an off-chip memory and the storage capacity can be expandable, its capacity can be expanded to accommodate the increases in KV cache data. Therefore, the volume of KV cache data does not directly determine the number of computing nodes within the layer cluster.
[0097] 3. Second Storage Units of Different Computing Nodes within a Layer Cluster
[0098] In the same layer cluster, the second storage units of different computing nodes can be: physically independently, or logically independently. Both methods can achieve the objectives of the present disclosure.
[0099] 4. Interfaces and Connections of Computing Nodes within a Layer Cluster
[0100] As shown in FIG. 2, in this example, within the same layer cluster, N computing nodes are connected in series via internal cluster interfaces within the LLM layer cluster. The internal cluster interfaces can be: PCIE interfaces or serial ports. The external cluster interfaces can be PCIE interfaces or serial ports.
[0101] Based on the above, a third aspect of the present disclosure provides a LLM accelerator. An exemplary example of the present disclosure provides a LLM accelerator. As shown in FIG. 2 and FIG. 3, the LLM accelerator of this example includes: M layer clusters. The layer clusters are the LLM layer clusters as described in the above example. M represents the number of layers in the LLM, and M≥2. Each layer cluster includes: one or more computing nodes. The computing node includes: at least one operation unit and at least one storage unit. The operation unit is used for performing operations. The storage unit is used for storing data during the operations of the LLM. The layer clusters of the M layer clusters sequentially correspond to the layers of the LLM, and the data during the operation of the LLM is stored in the storage unit of the computing node of the corresponding layer cluster.
[0102] Specifically, the LLM accelerator of the present disclosure includes a plurality of layer clusters, each of which contains a plurality of computing nodes. The computing nodes of each layer cluster are sequentially interconnected through corresponding interfaces, and the layer clusters are also sequentially interconnected. In addition, the accelerator cooperates with an upstream processing unit. Each computing node is provided with a dedicated interface for communication with the upstream processing unit. The number of layer clusters and the number of computing nodes can be expanded according to the size of the LLM.
[0103] In this example, the upstream processing unit is connected to M layer clusters and is used for operations such as: resource allocation for each layer cluster, tokenization of user input data and prefill operations, and de-tokenization operations for the topmost layer cluster.
[0104] It should be noted that the upstream processing unit shown in FIG. 2 and FIG. 3 is not included in the LLM accelerator in this example. However, in other examples of the present disclosure, the upstream processing unit may also be included in the LLM accelerator, which remains within the protection scope of the present disclosure.
[0105] In this example, the first level of allocation is based on the layer cluster. A single layer cluster is responsible for one layer of the LLM. There is no interaction of static weight data between layers. Therefore, a layer cluster stores all static weight data of its corresponding network layer in the first memory of all its internal computing nodes. The number of computing nodes in a single layer cluster is determined by the amount of static weight data of a single network layer and the capacity of the first memory. Based on the above, it can be understood that the number of computing nodes in different layer clusters can be the same or different. In addition, in certain examples, the layer cluster may include only one computing node.
[0106] In this example, the layer clusters are interconnected using a chip-to-chip approach, but this disclosure is not limited to it. In addition to the aforementioned low-cost chip-to-chip interconnection approach, if the data transfer volume between chips exceeds the capabilities of chip-to-chip interconnection, a die-to-die interconnection approach can be used to provide higher interconnection bandwidth. With this approach, multiple chips are encapsulated together in the form of a chiplet. Alternatively, all dies can be placed on the same wafer and interconnected internally within the wafer through a metal layer. These solutions can also achieve the objectives of the disclosure and fall within the protection scope of the present disclosure.
[0107] Based on the above, the following aspects need to be emphasized again:
[0108] ①Weak Interconnection Between Layer Clusters
[0109] LLMs are constructed by stacking multiple layers. Only a few token interactions occur between layers. Based on this, the present disclosure introduces the concept of layer cluster, where a chip or a group of chips forms a basic unit to process a single layer, thereby partitioning an entire LLM by layers. Since there is no interaction of static weight data or KV cache data between adjacent layer clusters but only token vectors are transmitted, the interconnection between layer clusters is weak.
[0110] This distributed implementation method effectively breaks down a large chip into multiple smaller chip groups to perform the same computations. This method not only improves both communication and computation efficiency of the system, but also reduces the overall chip cost. By employing multiple low-cost chips to perform the same computations as a high-cost chip does, this method offers advantages in power consumption, price, and performance.
[0111] ②Weak Interconnection Between Computing Nodes Within the Same Layer Cluster
[0112] There is no interaction of static weight data or KV cache data between computing nodes within the same layer cluster, as a result, the interconnection between the nodes is weak. This significantly enhances the computational efficiency of the nodes and decreases the demand for communication bandwidth.
[0113] ③Stackable Architecture
[0114] In a decoder-only structure, the amount of data transferred between layers is relatively small. This characteristic allows the layers to be stacked sequentially. By passing feature maps between the layers, the output of an upper layer acts as the input to a lower layer. Compared to the memory usage of weights, KV cache data, and token data, the feature maps being transferred are smaller, thus requiring less bandwidth. Except for the weights, the computational structure between layers is completely consistent. The computational architecture is the same, with only the data involved in the computation differing. Therefore, the stackable architecture design is feasible.
[0115] The architecture of the LLM accelerator and the layer clusters provided in the present disclosure are both stackable. This means that the hardware architecture can be selected and combined according to the depth and scale of the LLM computations. Furthermore, the number of layer clusters and computing nodes can be adjusted based on the actual operational requirements of the LLM, which is more flexible.
[0116] ④Reduction of Interconnection Cost
[0117] Due to the disaggregation of prefill and decoding phases, as well as the use of layer cluster, the interconnection requirements for chips in the present disclosure are relatively low. For most high-performance neural network accelerators, interconnection typically constitutes a large portion of the overall cost. In this disclosure, since both the layer clusters and the computing nodes exhibit weak interconnection, the interconnection cost can be greatly reduced.
[0118] As an instance, the computation process of the m-th layer cluster of the LLM accelerator will be described below. It should be understood by those skilled in the art that m =1, 2, ..., M. The m-th layer includes N computing nodes. The N computing nodes include:
[0119] ①N1 static computing nodes: the first storage units of the N1 static computing nodes are configured to reside the static weight data of the m-th layer of the LLM, where 1≤N1≤N.
[0120] ②N2 dynamic computing nodes: the second storage units of the N2 dynamic computing nodes are configured to store the KV cache data of the m-th layer of the LLM, where 1≤N2≤N.
[0121] It should be particularly noted that the static computing nodes and the dynamic computing nodes are not mutually exclusive. A computing node of the N computing nodes can be one of the following: solely a static computing node; solely a dynamic computing node; both a static and dynamic computing node; or neither a static nor dynamic computing node.
[0122] Storing the static weight data and KV cache data on a single computing node is the simplest approach. However, due to the data volume and storage capacity, it is hard to store all the data on a single computing node. Usually the data are stored in a plurality of computing nodes, which involves how to store the data in different computing nodes and how to perform computations on these nodes. In the present disclosure, the storage / computation of static weight data and KV cache data have some common aspects, but also exhibit unique characteristics, which will be explained in detail below.
[0123] Taking static weight data as an instance, the static weight data is shared among all users, represented as a weight matrix of S×T, where S≥32, T≥32. In most cases, S≥128, T≥128. The static weight data is stored in N1nodes, where N1≥2. There are two methods for storing the static weight data in the N1 computing nodes: partitioning by rows or partitioning by columns, which will be explained separately below.
[0124] (1) Partitioning By Rows
[0125] With this partitioning method, the weight matrix is partitioned by rows, and a first storage unit of an n-th static computing node among the N1 static computing nodes is configured to store weight row slices from an n1-th to an n2-th rows of the weight matrix, where n=1, 2, ..., N1.
[0126] In this example, the weight matrix of different computing nodes is evenly partitioned by rows, with the S rows of the weight matrix evenly distributed and stored in the N1 static computing nodes. However, the present disclosure is not limited thereto; the number of static weight matrix rows stored in different computing nodes may also vary.
[0127] FIG. 4 is a schematic diagram showing that in an LLM accelerator, a static weight matrix is partitioned by rows and stored in N1 static storage units according to an example of the present disclosure. As shown in FIG. 4, assuming the matrix size is 65, 536×65, 536, each computing node stores a row slice of size 4, 096×65, 536. In the current layer cluster, there are a total of 16 computing nodes to store the current weight. In the case where the static weight matrix is partitioned by rows, the operation unit of each computing node can directly call the static weight data of the current computing node for operations, without the need to call static weight data from other layer clusters or computing nodes. This approach reduces the requirement for transmission bandwidth and improves computational efficiency.
[0128] Furthermore, for the weight row slices described above, the current computing node does not need to obtain all the vectors to be computed, but only needs to obtain the vector slice corresponding to the weight row slice. Specifically, an input vector is also divided into a plurality slices, with each slice being sent to the computing node where the corresponding weight slice is located for computations. After all static computing nodes have completed their computations, an accumulation unit accumulates the computation results from the respective static computing nodes to obtain the result vector of the current matrix-vector multiplication operation.
[0129] Specifically, for the n-th computing node in the m-th layer cluster, when the static weight matrix is partitioned by rows, and the weight row slices are stored in the first storage unit, the process of performing matrix-vector multiplication by the operation unit is as follows:
[0130] ①reading a row slice from the storage unit of the computing node;
[0131] ②receiving the vector slice corresponding to the row slice of the vector to be computed;
[0132] ③performing the matrix-vector multiplication using the weight row slice and the corresponding vector slice;
[0133] ④the current layer cluster further includes: an accumulation computing node configured to accumulate computation results from the respective computing nodes within the m-th layer cluster to obtain the result vector of matrix-vector multiplication;
[0134] The computing nodes are static computing nodes, the storage unit is the first storage unit, and the row slice is a weight row slice, where m=1, 2, ..., M; n=1, 2, ..., N1.
[0135] The functional structure, which partitions the vector to be computed into vector slices and distributes these vector slices to the corresponding computing nodes, is refer to as an upstream computing node. The upstream computing node can be located in: the current layer cluster; or, the layer cluster of the previous layer; or, an upstream computing unit shared by M layer clusters of the LLM.
[0136] In an optimal example of the present disclosure, for the first layer cluster, the upstream computing node is the upstream processing unit; for other layer clusters, the upstream computing node is located in the current layer cluster, and is a computing node other than the static computing node.
[0137] Those skilled in the art should understand that partitioning a weight matrix by rows and storing in different computing nodes reduces communication overhead, as each node only needs to process a portion of the input vector.
[0138] (2) partitioning by columns
[0139] With this partitioning method, the weight matrix is partitioned by columns, and a first storage unit of an n-th static computing node among the N1 static computing nodes is configured to store weight column slices from an n3-th to an n4-th columns of the weight matrix, where n=1, 2, ..., N1.
[0140] In this example, the weight matrix of different computing nodes is evenly partitioned by columns, with the T columns of the weight matrix evenly distributed and stored in the N1 static computing nodes. However, the present disclosure is not limited thereto; the number of static weight matrix columns stored in different computing nodes may also vary.
[0141] FIG. 5 is a schematic diagram showing that in an LLM accelerator, a static weight matrix is partitioned by columns and stored in N1 static storage units according to an example of the present disclosure. Similarly, assuming the matrix size is 65, 536×65, 536, when the weight matrix is partitioned by columns, each column slice allocated to a chip includes a plurality of complete columns (in the above example, each computing node stores 65, 536×4, 096) . Similarly, in the case where the static weight matrix is partitioned by columns, the operation unit of each computing node can directly call the static weight data of the current computing node for operations, without the need to call static weight data from other layer clusters or computing nodes. This approach reduces the requirement for transmission bandwidth and improves computational efficiency.
[0142] Furthermore, different from the case of partitioning by rows, when the approach of partitioning by columns is used, it is necessary to read the entire vector to be computed. Additionally, after each computing node completes its computation, the results must be spliced to obtain the result vector of the computation of the current LLM layer.
[0143] Specifically, for the n-th computing node in the m-th layer cluster, when the static weight matrix is partitioned by columns, and the weight row slices are stored in the first storage unit, the process of performing matrix-vector operation by the operation unit is as follows:
[0144] ①reading a column slice from the storage unit of the computing node;
[0145] ②receiving the vector to be computed;
[0146] ③performing computation by using the column slice and the vector to be computed;
[0147] ④the m-th layer cluster further includes: a splicing computing node configured to splice computation results from the respective computing nodes in the m-th layer cluster to obtain the result vector of matrix-vector multiplication.
[0148] The computing node is a static computing node, the storage unit is a first storage unit, and the column slice is a weight row slice, where n=1, 2, ..., N1; or, if the computing node is a dynamic computing node, the storage unit is a second storage unit, and the column slice is a KV cache row slice, where n=1, 2, ..., N2.
[0149] Those skilled in the art should understand that partitioning a weight matrix by columns and storing in different computing nodes simplifies result processing, as there is no need to accumulate output data.
[0150] The above description illustrates the basic operations of storage and matrix-vector multiplication using static weight data as an instance. In practice, the processing method for KV cache data is similar to this approach. KV cache data includes a K matrix and a V matrix, which can also be partitioned by rows or columns, stored, and used in matrix-vector multiplication. The difference is that the computing nodes are replaced with dynamic computing nodes, the storage unit is replaced with the second storage unit, and the row slice is a KV cache row slice, where n=1, 2, ..., N2.
[0151] Different from the static weight matrix, the KV cache data is user-specific, meaning different users have different KV cache data. The present disclosure further addresses the issue of how data from multiple users is stored in the second storage units of a plurality of computing nodes.
[0152] It should be particularly explained that in the present disclosure, the KV cache data of the same user is not stored on a single computing node. This is because such an approach would result in matrix-vector multiplication being performed mainly by that computing node, thereby slowing down the computation speed of that node and leading to resource idling and waste of other computing nodes. In the present disclosure, the KV cache data of the same user is partitioned by rows or columns to obtain N2 KV cache row slices or KV cache column slices, and these slices are distributed across N2 dynamic computing nodes for storage. In this way, the matrix-vector multiplication operations of the KV cache data is distributed among multiple dynamic computing nodes, thereby improving resource utilization.
[0153] Furthermore, the dynamic computing nodes can also employ a batch processing method to handle matrix-vector multiplication for multiple users. Specifically, the storage space of the second storage unit is divided into u segments, with each segment used to store the KV cache data of a single user; upon receiving a batch processing request containing vectors to be computed or vector slices to be computed from a plurality of users, the dynamic computing node calls the KV cache data of the respective users stored in the corresponding segments of the second storage unit, and performs matrix-vector multiplication for the respective users either sequentially or in parallel; in the matrix-vector multiplication, the matrix is the KV cache data of the user, and the vector is the vector to be computed of the user, or a vector slice of the vector to be computed of the user.
[0154] Based on the matrix-vector multiplication using the static weight data and KV cache data of the layer cluster, the layer cluster in the LLM accelerator can realize a first computation and a second computation.
[0155] 1. First Computation
[0156] The first computation involves computation with static weight data. It should be noted that static weight data is relatively stable and does not update frequently. However, new KV cache data is generated with each user input. The newly generated KV cache data, together with the existing KV cache data, forms updated KV cache data.
[0157] The output of the first computation requires the generation of new KV cache data and updating the user's KV cache data. As described above, the KV cache data includes a K cache matrix and a V cache matrix.
[0158] The first computation includes the execution of matrix-vector multiplication. In this matrix-vector multiplication:
[0159] ①The computing nodes involved are: N1 static computing nodes, with the storage units being the first storage units.
[0160] ②The matrix to be computed is a static weight matrix, where the row slices are weight row slices or the column slices are weight column slices.
[0161] ③The vector to be computed is: the user's input token vector.
[0162] The input token vector can be normalized in advance if necessary. For the first layer cluster, the token vector is obtained from the upstream processing unit. For other layer clusters, the token vector is obtained from the previous layer cluster.
[0163] ④The result vector includes: the user's k vector, v vector, and q vector.
[0164] During the process of updating the KV cache data, the k vector is subjected to rotary positional encoding to obtain a new k vector; the new k vector and the v vector are stored in the second storage unit of the corresponding computing node in the m-th layer cluster according to an existing storage method of the KV cache; the new k vector and the user's existing K cache matrix form an updated K cache matrix, and the v vector and the user's existing V cache matrix form an updated V cache matrix.
[0165] Additionally, the q vector in the result vector will be used as the data for the matrix-vector multiplication in the second computation, which will be explained in detail below.
[0166] Those skilled in the art should understand that the above description highlights only the aspects of the first computation which are relevant to the inventive concept of this disclosure. Other elements of the first computation, such as the activation function and normalization function, can be referenced from existing technology and are not elaborated upon here.
[0167] 2. Second Computation
[0168] The second computation refers to the computation with KV cache data, also known as self-attention computation. It primarily involves matrix-vector multiplication of KV cache data and q, k, v vectors, as well as activation function.
[0169] In the second computation, the computing nodes involved are: N2 dynamic computing nodes, with storage units being the second storage units, where n=1, 2, …, N2. As mentioned above, the layer cluster performs the first computation, and the result vector from the matrix-vector multiplication also includes: the user's q vector.
[0170] The second computation performed by the layer cluster includes three stages.
[0171] Stage 1: perform matrix-vector multiplication. The matrix involved is the K cache matrix. The row slices are the row slices of the updated K cache matrix, or the column slices are the column slices of the updated K cache matrix. The vector to be computed is the q vector. The result vector is the first result vector.
[0172] Stage 2: process the first result vector through an activation function to obtain the second vector to be computed.
[0173] Stage 3: execute matrix-vector multiplication. The matrix involved is the updated V cache matrix. The row slices are the row slices of the updated V cache matrix, or the column slices are the column slices of the updated V cache matrix. The vector to be computed is the new vector to be computed. The result vector is the third result vector.
[0174] Similarly, those skilled in the art should understand that the above description highlights only the aspects of the second computation which are relevant to the inventive concept of this disclosure. Other elements of the second computation can be referenced from existing technology and are not elaborated upon here.
[0175] 3. The Output and Input of Layer Cluster
[0176] In the layer cluster, the first computation and the second computation are performed alternately and repeatedly. That is, with a single input / output of the layer cluster, the first and second computations are performed not just once, but can be performed alternately and repeatedly multiple times as set by the system.
[0177] When the second computation is performed after the first computation, the vector to be computed in the matrix-vector multiplication of the first stage of the second computation is the q vector of the user output by the first computation.
[0178] When the first computation is performed after the second computation, the vector to be computed in the matrix-vector multiplication of the first computation is the third result vector output by the matrix-vector multiplication of the third stage of the second computation.
[0179] The output token, which refers to the layer cluster result vector output by the current layer cluster is: the result vector of the first computation or the third result vector from the third stage of the second computation. Preferably, the layer cluster result vector output by the current layer cluster is the result vector of the first computation.
[0180] If the m-th layer cluster is not a last layer, the output token which is the layer cluster result vector, is sent to an (m+1) -th layer cluster as an input token which is the vector to be computed; if the m-th layer is the last layer, the output token which is the layer cluster result vector is post-processed and de-tokenized before being output to the user.
[0181] 4. The Computation Process of LLM Accelerator
[0182] Regarding the concepts of memory-intensive and compute-intensive, the present disclosure focuses on memory-intensive chips, and the compute-intensive tasks are left to the upstream operation units. Here, the processing of the LLM is divided into two phases, which are referred to as the prefill phase and the decoding phase. Once a request is initiated, the user's input is first vectorized during the prefill phase to generate the corresponding KV cache data. In the decoding phase, the data undergoes multiple decoding process. Each prediction result from a decoding process becomes the input for the subsequent process, and the above is repeated.
[0183] In these two phases, the compute-intensive type requires greater computational power, while the memory-intensive type demands faster weight and KV cache data access. Since the decoding phase is the main stage for large model inference, the present disclosure uses the prefill-decode disaggregation strategy, focusing on accelerating the decoding phase, i.e., the generation of the output token. This approach avoids the performance loss in decoding caused by accommodating prefill, thereby maximizing the acceleration of the decoding phase.
[0184] 4.1 Initialization Stage
[0185] The upstream processing unit transfers the corresponding static weight data to M layer clusters, with each layer cluster residing the received static weight data in the first storage units of its N1 computing nodes.
[0186] The upstream processing unit performs tokenization and prefill computation on the user input prompt, generating initial KV cache data and the first output token. The initial KV cache data is transferred to the M layer clusters, with each layer cluster storing the received KV cache data in the second storage units of its N2 computing nodes. The output token is then input into the layer cluster of the first layer for computation.
[0187] 4.2. Intermediate Computation
[0188] When the upstream processing unit generates the first output token, this output token is passed as the input vector to the first layer cluster, where it undergoes the first and second computations. The first and second computations are performed alternatively and repeatedly. Finally, the output token, which refers to the layer cluster result vector of the first layer cluster is: the result vector from the first computation or the second result vector from the third stage of the second computation. The output token, which is the result vector of the current layer cluster, is then used as the new input token for the second layer cluster. The second layer cluster uses this input token as the vector to be computed to perform the first and second computations. This process continues layer by layer until the final layer cluster outputs the output token vector. Details of the first and second computations are not elaborated upon here.
[0189] 4.3 Result Output
[0190] After the final layer cluster completes its computation, it outputs the output token vector. Post-processing (typically softmax) can either be performed within the final layer cluster, or the output token vector can be passed directly to the upstream processing unit, the upstream processing unit (such as a GPU) then performs de-tokenization and outputs the result to the user.
[0191] The generated output token serves as a new input token and is again transferred to the first layer cluster for a new round of computation, the process continues until the output token from the final layer cluster is a termination symbol.
[0192] 5. KV Cache Management Mechanism and Concurrency Design
[0193] The present disclosure employs two types of concurrency: first, the batch processing approach, which refers to processing requests from multiple users in a group; and second, the parallel pipeline.
[0194] 5.1 Batch Processing
[0195] Batch processing is the time parallelism of layer clusters. For batch processing, within the same layer cluster, the storage space of the second storage unit of the dynamic computing node is divided into n segments, each segment is used to store the KV cache data of a single user. In this way, the dynamic computing node sequentially perform the second computations for the corresponding users. The batch processing method has been described in detail previously and will not be repeated here.
[0196] 5.2 Parallel Pipeline
[0197] Parallel pipeline refers to the parallelism between layer clusters.
[0198] For parallel pipeline, the entire LLM accelerator can be regarded as an extremely long, multi-stage pipeline. The upstream processing unit generates an output token based on user input and sends it to the first stage of the pipeline. Each layer cluster processes and outputs the output token to the next layer cluster, and a new round of processing starts when a new input token is received from the previous layer cluster.
[0199] As a result, the number of simultaneously processable user requests is equal to the number of stages in the pipeline multiplied by the batch size.
[0200] 6. Other Aspects of the LLM Accelerator
[0201] The LLM of the current example is a transformer model based on a decoder-only structure. However, those skilled in the art should understand that the example above is merely a preferred implementation of the present disclosure. In other examples of the present disclosure, the structure of the LLM may be encoder-only or encoder-decoder, all of which can implement the present disclosure and fall within its scope of protection.
[0202] The LLM accelerator of the current example is an LLM inference accelerator. However, those skilled in the art should understand that the example above is merely a preferred implementation of the present disclosure. In other examples of the present disclosure, the LLM accelerator may also be other networks based on the transformer, particularly the decoder-only structure, or other neural network structures characterized by large intra-layer computation volume and low inter-layer data transfer, such as various cascade networks based on matrix-vector multiplication. These scenarios can implement the present disclosure and fall within the protection scope of the present disclosure.
[0203] The LLM of the present example is used in one of the following fields: text generation, dialogue system, translation, and document summarization. However, those skilled in the art should understand that the example above is merely a preferred implementation of the present disclosure. In other examples of the present disclosure, the LLM can also be used in other fields such as image generation, video generation, image recognition, and image segmentation.
[0204] In summary, the high-performance LLM accelerator provided by the present disclosure not only significantly enhances inference performance but also possesses a cascaded characteristic, which provides efficient support for LLMs of various sizes. Specifically, the technical effects of the present disclosure include:
[0205] (1) Reduced Power Consumption and Latency
[0206] The present disclosure effectively avoids the high power consumption and high latency issues caused by the conventional external storage of static weight data. Compared to conventional HBM solutions, the present disclosure has significant advantages in performance, power consumption and cost.
[0207] (2) Expandable and Highly Flexible Computing Power
[0208] In the present disclosure, each computing node includes a first operation unit and a second operation unit specifically designed for matrix and vector operations, and the cascade architecture satisfies the computational power demands of models of various sizes. The second operation unit is a programmable unit that can flexibly adapt to different LLM architectures, and can support various activation functions, normalization, and other requirements.
[0209] (3) Support for Ultra-Long Sequences
[0210] By caching the user's KV cache data in the second storage unit, the present disclosure satisfies the hot data storage requirements of ultra-long sequences.
[0211] (4) Weak Interconnection Between Layer Clusters
[0212] The present disclosure introduces the concept of layer cluster, where a chip or a group of chips forms a basic unit to process a single layer, thereby partitioning an entire LLM by layers. Since there is no interaction of static weight data or KV cache data between adjacent layer clusters but only token vectors are transmitted, the interconnection between layer clusters is weak.
[0213] This distributed implementation method effectively breaks down a large chip into multiple smaller chip groups to perform the same computations. This method not only improves both the communication and computation efficiency of the system, but also reduces the overall chip cost. By employing multiple low-cost chips to perform the same computations as a high-cost chip does, this method offers advantages in power consumption, price, and performance.
[0214] (5) Weak Interconnection Between Computing Nodes Within the Same Layer Cluster
[0215] In the present disclosure, there is no interaction of static weight data or KV cache data between computing nodes within the same layer cluster. As a result, the interconnection between the nodes is weak. This significantly enhances the computational efficiency of the nodes and decreases the demand for communication bandwidth.
[0216] (6) Stackable Architecture
[0217] The architecture of the LLM accelerator and the layer clusters provided in the present disclosure are both stackable. This means that the hardware architecture can be selected and combined according to the depth and scale of the LLM computation. Furthermore, the number of layer clusters and computing nodes can be adjusted based on the actual operational requirements of the LLM, which is more flexible.
[0218] (7) Cost-Effective Interconnection
[0219] The present disclosure reduces the need for data transmission between clusters by disaggregating prefill and decoding phases, thereby minimizing reliance on high-cost interconnection technologies.
[0220] (8) High Concurrency
[0221] The present disclosure employs batch processing and a parallel pipeline approach to handle requests from hundreds of users simultaneously.
[0222] The various examples of the present disclosure have been thoroughly described above. Based on the description, those skilled in the art should have a clear understanding of the present disclosure.
[0223] The ordinal numbers and terms such as "first, " "second, " "third, " "primary, " "secondary, " as well as Arabic numerals, letters, etc., used in the specification and claims, are intended to modify the corresponding components (or steps) . The purpose is solely to distinguish a component (or step) from another component (or step) with the same name. They do not imply any order or sequence of the components (or steps) .
[0224] Moreover, unless specifically described or the sequence of the steps is required to occur in a particular order, the order of the above steps is not limited to the sequence described above and can be modified or rearranged based on the design requirements.
[0225] The present disclosure can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for executing part or all of the methods described herein. The program that implements the present disclosure can be stored on a computer-readable medium or can be in the form of one or more signals. These signals can be obtained by downloading from an Internet website, provided on a carrier signal, or provided in any other form.
[0226] The present disclosure can be implemented using hardware comprising several different components, as well as thorough a suitably programmed computer. The examples of the components provided by the present disclosure can be implemented as hardware, or as software modules running on one or more processors, or as a combination thereof. The physical implementation of the hardware structure includes, but is not limited to physical devices such as transistors, memristors, DNA computers, microcontrollers, microprocessors, or digital signal processors (DSPs) . Furthermore, the present disclosure is not restricted to any specific programming language. It should be understood that the present disclosure can be implemented using various programming languages, and the descriptions provided herein regarding a specific language are intended to illustrate an optimal mode of implementing the present disclosure.
[0227] It should be understood by those skilled in the art that the word "comprise / include" in the claims and the description of the present disclosure does not exclude the presence of components (or steps) not explicitly listed in the claims. The use of the article "a" or "an" before a component (or step) does not exclude the presence of multiple such elements (or steps) .
[0228] If certain examples are not critical to the present disclosure and are well-known to those skilled in the art, due to space limitations, they are not described in detail in the drawings or the specification. In such cases, reference may be made to related prior art for understanding.
[0229] Similarly, it should be understood that, for the sake of brevity, in the description of the examples above, individual features of the present disclosure are sometimes grouped together in a single example, figure, or description thereof. However, this should not be interpreted as reflecting an intent that the claimed disclosure requires more features than explicitly recited in each claim. Rather, as reflected by the claims, various aspects of the disclosure lie in fewer than all features of a single foregoing example. Moreover, examples can be mixed and matched based on design and reliability considerations, or combined with other examples, which means that the technical features of different examples can be freely combined to form more examples. Therefore, the claims following specific examples are explicitly incorporated into the specific examples, where each claim itself constitutes a separate example of the present disclosure.
[0230] The specific examples described above provide a detailed explanation of the objectives, technical solutions, and beneficial effects of the present disclosure. It should be understood that the detailed description is intended to enable those skilled in the art to better understand the present disclosure and is not intended to limit the disclosure. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present disclosure shall be included within the scope of protection of the present disclosure.
Claims
1.A large language model (LLM) computing node, comprising:at least one operation unit and a first storage unit, both located within a same architecture, whereinthe operation unit is configured to perform operations;the first storage unit is configured to reside static weight data during the operations of the LLM; anda second storage unit located outside the architecture, wherein the second storage unit is configured to store KV cache data during the operations of the LLM.2.The LLM computing node of Claim 1, wherein K1≥4K2,wherein K1is interface bandwidth between the first storage unit and the operation unit, and K2is interface bandwidth between the second storage unit and the operation unit.3.The LLM computing node of Claim 1, whereinthe architecture is: a chip, wherein the at least one operation unit and the first storage unit are both located within the same chip, and the second storage unit is located outside the chip;alternatively, the architecture is: a die, wherein the at least one operation unit and the first storage unit are both located within the same die, and the second storage unit is located outside the die;alternatively, the architecture is: a card, wherein the at least one operation unit and the first storage unit are both located within the same card, and the second storage unit is located outside the card;alternatively, the architecture is a package wherein a chip where the at least one operation unit is located and a chip where the first storage unit is located are both encapsulated, and the second storage unit is located outside the package;alternatively, the architecture is a package wherein a die where the at least one operation unit is located and a die where the first storage unit is located are both encapsulated, and the second storage unit located outside the package;alternatively, the architecture is a functional module that integrates the at least one operation unit and the first storage unit, and the second storage unit is located outside the functional module.4.The LLM computing node of Claim 1, wherein T2≥4T1,wherein T1 is the storage capacity of the first storage unit, and T2 is the storage capacity of the second storage unit.5.The LLM computing node of Claim 4, whereinthe first storage unit is an SRAM;and / or, the second storage unit is one or more of DRAM, RRAM, MRAM;and / or, the storage capacity of the first storage unit is fixed, the storage capacity of the second storage unit is expandable.6.The LLM computing node of Claim 1, whereinthe architecture is: a chip, wherein the at least one operation unit and the first storage unit are both located within the same chip, and the second storage unit is located outside the chip;and / or the first storage unit is an SRAM, the second storage unit is a DRAM, wherein the DRAM exchanges data with the chip via a DDR interface;and / or the first storage unit is further configured to store intermediate computation results during the inference of the LLM.7.The LLM computing node of Claim 1, wherein the at least one operation unit comprises:a first operation unit configured to perform matrix computation tasks of the LLM computing node;a second operation unit configured to perform vector computation tasks of the LLM computing node.8.The LLM computing node of Claim 1, further comprising:an external cluster interface configured to enable communication between the LLM computing node and an upstream processing unit;an internal cluster interface configured to enable communication between the LLM computing node and other LLM computing nodes within the same cluster;wherein V1≥4V2, V1 is interface bandwidth of the internal cluster interface and V2 is interface bandwidth of the external cluster interface.9.A large language model (LLM) layer cluster, comprising:N computing nodes, wherein N≥1, and each computing node is the LLM computing node as described in any of Claims 1 to 8.10.The LLM layer cluster of Claim 9, whereinthe N computing nodes are serially connected within the LLM layer cluster through an internal cluster interface;and / or, a second storage unit of each of the computing nodes is physically independent or logically independent;and / or, the number of computing nodes in the LLM layer cluster is configured to be expandable.11.A large language model (LLM) accelerator, comprising:M layer clusters, wherein M is the number of layers of the LLM, and M≥2;each layer cluster comprises one or more of computing nodes;each computing node comprises at least one operation unit and at least one storage unit, whereinthe operation unit is configured to perform operations;the storage unit is configured to store data during operations of the LLM;wherein, the layer clusters of the M layer clusters sequentially correspond to the layers of the LLM, and the data during the operations of the LLM is stored in the storage unit of the computing node of the corresponding layer cluster.12.The LLM accelerator of Claim 11, whereindata required for operations of the LLM comprises static weight data;N computing nodes of an m-th layer cluster comprise N1 static computing nodes,the static computing nodes comprise first storage units configured to store static weight data;wherein the static weight data of the m-th layer of the LLM resides in the first storage units of the N1 static computing nodes, wherein m=1, 2, ..., M, and 1≤N1≤N.13.The LLM accelerator of Claim 12, wherein, the static weight data of the m-th layer of the LLM is a weight matrix of size S×T, wherein S≥32, T≥32 and N1≥2;the weight matrix is partitioned by rows, and a first storage unit of an n-th static computing node among the N1 static computing nodes is configured to store weight row slices from an n1-th to an n2-th rows of the weight matrix, wherein n=1, 2, ..., N1;alternatively, the weight matrix is partitioned by columns, and a first storage unit of an n-th static computing node among the N1 static computing nodes is configured to store weight column slices from an n3-th to an n4-th columns of the weight matrix, wherein n=1, 2, ..., N1.14.The LLM accelerator of Claim 12, whereinthe number of static computing nodes in different layer clusters is the same or different;and / or, the weight matrix is evenly partitioned by rows, S rows of the weight matrix are evenly stored in the first storage unit of the N1 static computing nodes; or, the weight matrix is evenly partitioned by columns, T columns of the weight matrix are evenly stored in the first storage unit of the N1 static computing nodes.15.The LLM accelerator of Claim 11, whereindata required for operations of the LLM comprises KV cache data;N computing nodes of an m-th layer cluster further comprise N2 dynamic computing nodes;the dynamic computing node comprise a second storage unit configured to store the KV cache data;wherein the KV cache data of the m-th layer of the LLM is stored in the second storage unit of the N2 dynamic computing nodes, wherein m=1, 2, ..., M, and 1≤N2≤N.16.The LLM accelerator of Claim 15, whereinthe KV cache data is a KV cache matrix of the user, wherein the KV cache matrix comprises a K cache matrix, and / or, a V cache matrix;N2≥2, the KV cache matrix of the user is partitioned by rows or columns to obtain N2 KV cache row slices or KV cache column slices, which are distributed to and stored in the N2 dynamic computing nodes.17.The LLM accelerator of Claim 16, whereinthe number of dynamic computing nodes in different layer clusters is the same or different;and / or, the KV cache matrix is evenly partitioned by rows, or evenly partitioned by columns;and / or, the number of users is greater than1, and different users correspond to different KV cache data;and / or, for different users, the partitioning method of the KV cache matrix is the same or different;and / or, for different users, the dynamic computing nodes that store the KV cache row slices or the KV cache column slices are the same or different.18.The LLM accelerator of Claim 11, whereinthe data required for operations of the specific layer comprises static weight data and KV cache data;N computing nodes in an m-th layer cluster comprise: N1 static computing nodes; the static computing node comprises: a first storage unit for storing static weight data; wherein the static weight data of the m-th layer of the LLM resides in the first storage unit of the N1 static computing nodes, wherein m=1, 2, ..., M, and 1≤N1≤N;the N computing nodes in the m-th layer cluster further comprise: N2 dynamic computing nodes; the dynamic computing node comprises: a second storage unit for storing the KV cache data; wherein the KV cache data of the m-th layer of the LLM is stored in the second storage units of the N2 dynamic computing nodes, wherein m=1, 2, ..., M and 1≤N2≤N;wherein, the computing node in the m-th layer cluster is one of the following: solely a static computing node; solely a dynamic computing node; both a static and dynamic computing node; or neither a static nor a dynamic computing node.19.The LLM accelerator of Claim 13 or 16, whereinin an n-th computing node, the operation unit is configured to perform matrix-vector multiplication, comprising:reading a row slice from the storage unit of the computing node;receiving a vector slice corresponding to the row slice of a vector to be computed;performing computation using the weight row slice and the corresponding vector slice;the m-th layer cluster further comprises: an accumulation computing node configured to accumulate computation results from the respective computing nodes within the m-th layer cluster to obtain a result vector of the matrix-vector multiplication;wherein, the computing node is a static computing node, the storage unit is a first storage unit, and the row slice is a weight row slice, wherein n=1, 2, ..., N1; or, the computing node is a dynamic computing node, the storage unit is a second storage unit, and the row slice is a KV cache row slice, wherein n=1, 2, ..., N2.20.The LLM accelerator of Claim 19, further comprising:an upstream computing node configured to partition a vector to be computed and distribute a vector slice corresponding to a specific row slice to a corresponding computing node;wherein, the upstream computing node is located in a current layer cluster, or in a layer cluster of a previous layer, or in an upstream processing unit shared by M LLM layer clusters.21.The LLM accelerator of Claim 13 or 16, whereinin an n-th computing node, the operation unit is configured to perform matrix-vector multiplication, comprising:reading a column slice from the storage unit of the computing node;receiving a vector to be computed;performing computation by using the column slice and the vector to be computed;the m-th layer cluster further comprises: a splicing computing node configured to splice computation results from the respective computing nodes within the m-th layer cluster to obtain a result vector of matrix-vector multiplication;wherein, the computing node is a static computing node, the storage unit is a first storage unit, and the column slice is a weight column slice, wherein n=1, 2, ..., N1; or, if the computing node is a dynamic computing node, the storage unit is a second storage unit, and the column slice is a KV cache column slice, wherein n=1, 2, ..., N2.22.The LLM accelerator of Claim 16, whereinthe number of users is greater than1, different users correspond to different KV cache data;for the dynamic computing node:the storage space of the second storage unit is divided into u segments, each segment being configured to store the KV cache of a single user;upon receiving a batch processing request containing vectors to be computed or vector slices of a vector to be computed from a plurality of users, the dynamic computing node calls KV cache data of the respective users stored in the corresponding segments of the second storage unit, and performs matrix-vector multiplication of the respective users either sequentially or in parallel, wherein, in the matrix-vector multiplication, the matrix is the KV cache data from the user, and the vector is the vector to be computed or the vector slices of the vector to be computed from the user.23.The LLM accelerator of Claim 11, whereinthe KV cache data comprises a K cache matrix and a V cache matrix;the layer cluster is configured to perform a first computation which comprises a matrix-vector multiplication; in the matrix-vector multiplication: a matrix to be computed is static weight data; a vector to be computed is an input token vector from the user; a result vector comprises a k vector and a v vector from the user;wherein, the k vector is subjected to rotary positional encoding to obtain a new k vector; the new k vector and the v vector are stored in the second storage unit of the corresponding computing node in m-th layer cluster according to a current storage method of the KV cache; the new k vector and the user's existing K cache matrix form an updated K cache matrix, and the v vector and the user's existing V cache matrix form an updated V cache matrix.24.The LLM accelerator of Claim 23, whereinthe layer cluster is configured to perform a first computation, wherein the result vector of the matrix-vector multiplication also comprises a q vector from the user;after the first computation is completed, the layer cluster is configured to perform a second computation, comprising:a first stage: performing matrix-vector multiplication, wherein a matrix to be computed is a KV cache matrix from the user, and a vector to be computed is a q vector from the user, and a result vector is a first result vector;a second stage: obtaining a second vector to be computed by applying an activation function to the first result vector; anda third stage: performing matrix-vector multiplication, wherein a matrix to be computed is a KV cache matrix from the user, and a vector to be computed is the second vector to be computed, and a result vector is a third result vector.25.The LLM accelerator of Claim 24, whereinthe first computation and the second computation are performed alternately and iteratively according to a preset method, wherein:when the second computation is performed after the first computation, the vector to be computed in the matrix-vector multiplication of the first stage of the second computation is the q vector from the user output by the first computation;when the first computation is performed after the second computation, the vector to be computed in the matrix-vector multiplication of the first computation is the third result vector output by the matrix-vector multiplication of the third stage of the second computation;and / or, an output token, which is the result vector output by the current layer cluster is: the result vector from the first computation or the third result vector from the third stage of the second computation; wherein, ifthe m-th layer cluster is not a last layer, the output token which is the result vector of the current layer cluster, is sent to an (m+1) -th layer cluster as an input token which is the vector to be computed; if the m-th layer of the LLM is a last layer, the output token which is the result vector of the current layer cluster is post-processed and de-tokenized before being output to the user.26.The LLM accelerator of Claim 25, wherein, the layer clusters of the M layers operate in a pipelined and parallel manner,wherein an upstream processing unit generates an output token based on the user input and sends the output token to the first layer cluster; after each layer cluster processes and outputs the output token to the next layer cluster, the layer cluster receives a new input token from a previous layer cluster and runs a new round of processing.27.The LLM accelerator of any of claims 11 to 18, 23 to 26, wherein,the LLM is a transformer model based on a decoder-only architecture;and / or, the number of computing nodes in different layer clusters is the same or different;and / or, the LLM accelerator is a LLM inference accelerator;and / or, the number of LLM layer clusters in the LLM accelerator is configured to be expandable;and / or, the number of computing nodes in the LLM layer cluster is configured to be expandable;and / or, the interconnection between layer clusters is achieved by using one or more of the following methods: chip-to-chip interconnection, die-to-die interconnection, card-level interconnection, or interconnection within a wafer through a metal layer.28.The LLM accelerator of any of claims 11 to 18 and 23 to 26, wherein, the LLM is used in one of the following fields: text generation, dialogue systems, translation, document summarization, image generation, video generation, image recognition or image segmentation.
Citation Information
Patent Citations
Large model distributed training method and system for heterogeneous hardware cluster
CN117909742A
Transform-based acceleration system and method
CN118133908A
Hardware accelerator architecture for processing very-sparse and hyper-sparse matrix data
US20180189234A1
General padding support for convolution on systolic arrays
US20210056396A1