00:00:00

Share Your Feedback 🏝️

Era of 1bit

Era of 1bit

MinWoo(Daniel) Park | Tech Blog

Read more
Previous: Mistral Large Next: Survey | Datasets for LLMs

Era of 1bit

  • Related Project: Private
  • Project Status: 1 Alpha
  • Date: 2024-02-29

</span>


The Era of 1-bit LLMs: All Large Language Models are in 1.58 Bits

  • url: https://arxiv.org/abs/2402.17764
  • pdf: https://arxiv.org/pdf/2402.17764
  • abstract: Recent research, such as BitNet, is paving the way for a new era of 1-bit Large Language Models (LLMs). In this work, we introduce a 1-bit LLM variant, namely BitNet b1.58, in which every single parameter (or weight) of the LLM is ternary {-1, 0, 1}. It matches the full-precision (i.e., FP16 or BF16) Transformer LLM with the same model size and training tokens in terms of both perplexity and end-task performance, while being significantly more cost-effective in terms of latency, memory, throughput, and energy consumption. More profoundly, the 1.58-bit LLM defines a new scaling law and recipe for training new generations of LLMs that are both high-performance and cost-effective. Furthermore, it enables a new computation paradigm and opens the door for designing specific hardware optimized for 1-bit LLMs.

Contents

TL;DR


  • 종합적 데이터 수집과 고도의 훈련 전략을 통해 개발된 대규모 오픈소스 코드 모델
    • 1-bit 대규모 언어모델(BitNet b1.58) 도입, 메모리와 에너지 효율성 개선
    • 저비트 가중치와 활성화를 통한 높은 처리량과 낮은 지연 시간 제공
    • FIM 기법과 광범위한 벤치마크를 활용한 향상된 성능 검증
    • 지속적인 성능 개선을 위한 추가 프리트레이닝 실행
    • 성능 유지하면서 비용 및 에너지 소비 최소화하는 새로운 연산 패러다임 제시

1. 서론

코드 지능의 새 시대를 연 대규모 언어모델의 발전은 소프트웨어 개발 분야에 혁신적인 변화를 가져왔습니다. 이런 모델은 다양한 자연어 처리 작업에서 향상된 성능을 보여주고 있으나, 그 크기의 증가는 배포에 있어서의 도전과 높은 에너지 소비로 인한 환경적, 경제적 우려를 낳고 있습니다.

이런 챌린지를 극복하기 위한 접근 방식 중 하나는 훈련 후 양자화(post-training quantization)를 사용하여 인퍼런스를 위한 저비트 모델을 생성하는 것입니다. 이 기술은 가중치와 활성화의 Precision를 줄여 LLM의 메모리 및 계산 요구사항을 크게 줄입니다. 특히, BitNet과 같은 1-bit 모델 아키텍처의 최근 작업은 비용을 줄이면서 성능을 유지하는 유망한 방향을 제시합니다.

이런 모델들은 버그 탐지에서 코드 생성까지 다양한 코딩 작업을 자동화하고 효율화할 수 있는 잠재력을 갖고 있습니다. 특히, 공개소스와 폐쇄소스 모델 간의 성능 격차는 주요한 챌린지로 남아 있습니다. 이에 대응하여, DeepSeek-Coder 시리즈를 개발하였습니다. 이 시리즈는 1.3B부터 33B까지 다양한 크기의 모델을 포함하며, 2조 토큰에 걸쳐 87개 프로그래밍 언어로부터 트레이닝되었습니다. 모델의 코드 완성 능력을 강화하기 위해 FIM(Fill-In-Middle) 접근 방식을 통합하였으며, 다양한 공개 코드 관련 벤치마크를 사용하여 광범위한 실험을 수행하였습니다.


2 BitNet b1.58 기술 논문 요약

  • BitNet b1.58: 1.58비트 가중치, 8비트 활성화를 적용한 변형 Transformer 구조
  • 절대평균(absmean) 양자화 기능 도입: 가중치를 -1, 0, +1로 제한
  • LLaMA 구조 채택: RMSNorm, SwiGLU, 회전 임베딩 사용 및 모든 편향 제거

2.1 양자화 함수

신경망의 효율성과 성능을 향상시키기 위해 가중치 및 활성화 값을 제한된 숫자 세트로 제한하는 양자화 과정이 필요합니다. 이는 모델의 크기를 줄이고, 계산 복잡성을 감소시키며, 저전력 하드웨어에서의 실행을 용이하게 합니다.

가중치 행렬 $W$를 그 행렬의 평균 절대값 $\gamma$로 스케일링하고, 가장 가까운 정수 {-1, 0, +1}로 반올림합니다.

\[\gamma = \frac{1}{nm} \sum_{i,j} |W_{ij}|, \quad (3)\]

$n$과 $m$은 각각 가중치 행렬 $W$의 행과 열의 수입니다. 이후 스케일링된 가중치는 다음과 같이 양자화됩니다.

\[W_f = \text{RoundClip}\left(\frac{W}{\gamma + \epsilon}, -1, 1\right), \quad (1)\] \[\text{RoundClip}(x, a, b) = \max(a, \min(b, \text{round}(x))), \quad (2)\]

이런 접근 방식은 계산 비용을 크게 줄이면서 모델의 정확도를 유지하는 데 도움이 됩니다.

양자화는 모델의 메모리 요구 사항을 감소시키고, 병렬 처리를 용이하게 하며, 저전력 하드웨어에서의 효율적인 실행을 가능하게 합니다. 실험에서는 성능에 미치는 영향이 미미하였습니다.

2.2 LLaMA와 같은 구성 요소

오픈 소스 대규모 언어모델(LLM) 커뮤니티와의 호환성을 위해, 표준화된 구성 요소를 사용하여 소프트웨어 통합을 간소화할 필요가 있습니다.

BitNet b1.58은 다음과 같은 LLaMA와 유사한 구성 요소를 사용합니다.

  • RMSNorm (ZS19): 배치 내 샘플 간의 스케일을 정규화합니다.
  • SwiGLU (Sha20): 비선형 게이트 유닛을 사용하여 효율적인 학습을 돕습니다.
  • 회전 임베딩 (SAL+24): 위치 정보를 보다 효과적으로 모델에 통합합니다.
  • 모든 편향 제거: 모델의 단순성과 일관성을 높이기 위해 편향을 제거합니다.

이런 구성 요소의 적용은 BitNet b1.58을 Huggingface와 같은 유명한 오픈 소스 소프트웨어와 쉽게 통합할 수 있게 하여, 공동체 내에서의 사용과 확장을 용이하게 합니다.


3. 데이터 수집

3.1 GitHub 데이터 크롤링 및 필터링

GitHub에서 공개된 리포지토리를 대상으로 데이터를 수집하고, 일정 기준에 따라 필터링을 수행하여 데이터의 질을 관리합니다. 이는 필터 규칙을 적용하여 데이터의 양을 원래 크기의 32.8%로 줄이는 과정을 포함합니다.

3.2 의존성 파싱

[체크 필요]

이 과정은 파일들 사이의 의존성을 토폴로지 정렬을 사용하여 분석합니다. 아래는 의존성 분석을 위한 토폴로지 정렬 알고리즘입니다. 위에서 제시된 절차 TOPOLOGICAL_SORT는 위상 정렬 알고리즘을 구현하는 것 같습니다. 위상 정렬은 주로 방향성이 있는 비순환 그래프(DAG, Directed Acyclic Graph)에서 노드를 선형 순서로 배열하는 알고리즘입니다.

주요 추가 단계는 다음과 같습니다.

  1. 그래프의 각 간선에 대하여, 의존성을 업데이트하고 진입 차수(inDegree)를 증가시킵니다.
  2. 진입 차수가 0인 노드(의존성이 없는 파일)를 찾아 큐에 삽입합니다.
  3. 큐에서 노드를 꺼내 결과 목록에 추가하고, 해당 노드에서 출발하는 간선을 제거하면서 연결된 노드의 진입 차수를 감소시킵니다.
  4. 큐가 비어있을 때까지 3번 과정을 반복합니다.
  5. 모든 노드가 결과 목록에 포함되면 종료합니다.

Algorithm

\[\begin{align*} \text{procedure} & \quad \text{TOPOLOGICAL\_SORT(files, dependencies)} \\ \text{graphs} & \leftarrow \{\} \\ \text{inDegree} & \leftarrow \{\} \\ & \text{for each file in files do} \\ & \quad \text{graphs[file]} \leftarrow [] \\ & \quad \text{inDegree[file]} \leftarrow 0 \\ & \text{end for} \\ & \text{for each (src, dest) in dependencies do} \\ & \quad \text{graphs[src].append(dest)} \\ & \quad \text{inDegree[dest]} \leftarrow \text{inDegree[dest]} + 1 \\ & \text{end for} \\ \text{queue} & \leftarrow \text{new Queue()} \\ & \text{for each file in files do} \\ & \quad \text{if inDegree[file] == 0 then} \\ & \quad \quad \text{queue.enqueue(file)} \\ & \text{end for} \\ \text{allResults} & \leftarrow [] \\ & \text{while not queue.isEmpty() do} \\ & \quad \text{currentFile} \leftarrow \text{queue.dequeue()} \\ & \quad \text{allResults.append(currentFile)} \\ & \quad \text{for each dest in graphs[currentFile] do} \\ & \quad \quad \text{inDegree[dest]} \leftarrow \text{inDegree[dest]} - 1 \\ & \quad \quad \text{if inDegree[dest] == 0 then} \\ & \quad \quad \quad \text{queue.enqueue(dest)} \\ & \text{end for} \\ & \text{end while} \\ \text{return} & \quad \text{allResults} \\ \text{end procedure} \end{align*}\]

이 코드는 파일과 파일 간의 의존성이 주어졌을 때, 의존성 없이 안전하게 처리할 수 있는 순서로 파일을 정렬합니다.

3.3 리포지토리 수준 중복 제거

훈련 데이터셋의 중복을 제거하는 것은 성능 향상에 중요한 요소입니다. 리포지토리 수준에서 중복을 제거함으로써 데이터의 구조적 무결성을 유지합니다.

3.4 품질 검사 및 오염 제거

코드의 품질을 높이기 위해 컴파일러 및 품질 모델을 사용하여 낮은 품질의 데이터를 추가적으로 필터링합니다. 테스트 세트와의 정보 오염을 방지하기 위해 n-gram 필터링 프로세스를 구현합니다.


4. 훈련 정책

4.1 훈련 전략

다음 토큰 예측과 FIM을 주요 훈련 목표로 설정합니다. FIM 방법은 코드 프리트레이닝 시나리오에서 중요한 역할을 하며, PSM(Prefix-Suffix-Middle) 및 SPM(Suffix-Prefix-Middle) 두 가지 모드를 통해 텍스트의 다양한 구조적 배열을 처리할 수 있는 능력을 향상시킵니다.

4.2 토크나이저

BPE(Byte Pair Encoding) 토크나이저를 사용하여 훈련 데이터셋에 맞는 토크나이저를 구성합니다. 이 과정은 모델의 입력 처리 능력을 최적화합니다.

4.3 모델 아키텍처

다양한 파라미터 크기를 가진 모델을 개발하여 넓은 범위의 응용 프로그램 요구를 충족합니다. 모든 모델은 디코더-만 구조의 Transformer를 기반으로 하며, RoPE(Rotary Position Embedding)를 포함합니다.

4.4 최적화

AdamW 최적화 알고리즘을 사용하여 모델을 훈련합니다. 배치 크기와 학습률은 DeepSeek LLM의 스케일링 법칙을 따릅니다.

4.5 환경

NVIDIA A100 및 H800 GPU를 사용하여 모델을 훈련합니다. 이런 설정은 복잡한 연산을 효율적으로 수행할 수 있는 강력한 인프라를 제공합니다.

4.6 긴 컨텍스트 처리

모델이 더 긴 컨텍스트를 처리할 수 있도록 RoPE 파라미터를 재구성하며, 특히 프로젝트 수준의 코드 처리 시나리오에서 유용합니다.

4.7 지시 기반 튜닝

DeepSeek-Coder-Instruct는 고품질의 지시 데이터를 사용하여 파인튜닝을 거쳐 개발되었습니다. 이는 다단계 대화 시나리오에서 모델의 성능을 극대화합니다.


5. 실험 결과

DeepSeek-Coder는 다양한 벤치마크에서 최고의 성능을 보여 주었습니다. 특히, 코드 생성, FIM 코드 완성, 파일 간 코드 완성 및 프로그램 기반 수학 인퍼런스에서 향상된 결과를 도출하였습니다. 이런 결과는 DeepSeek-Coder 시리즈가 실제 프로그래밍 문제를 효과적으로 해결할 수 있음을 입증합니다.


6. 일반 LLM에서 계속되는 프리트레이닝

DeepSeek-Coder 모델의 자연어 이해 및 수학적 인퍼런스 능력을 향상시키기 위해 추가 프리트레이닝을 수행합니다. 이 과정은 모델의 성능을 더욱 향상시키는 데 기여합니다.


7. 결론

DeepSeek-Coder 시리즈는 코드 지능을 위해 특별히 설계된 LLM으로, 다양한 표준 테스트에서 우수한 성능을 보여 주었습니다. 추가적인 자연어 처리 기능을 갖춘 새로운 버전의 모

델 개발을 통해 이런 성능을 지속적으로 개선할 계획입니다. 이는 코드 중심의 LLM이 자연어 지시를 효과적으로 해석하고 실행할 수 있도록 하는 데 중요합니다.

가중치 타입 설명 양자화 함수
원본 가중치 FP16 또는 BF16의 16-bit 부동 소수점 값 없음
BitNet 가중치 1-bit, 값이 {1, -1}로 제한됨 round(weight matrix)
BitNet b1.58 1.58-bit, 값이 {-1, 0, 1}로 확장됨. 이 추가적인 ‘0’ 값은 모델의 성능과 메모리 효율성을 향상시키는 데 도움을 줌. round(weight matrix / average absolute value)

BitNet b1.58 모델의 가중치 변형을 타입별 정리


1 1-bit 대규모 언어모델의 시대

수학적 이해 및 논리

기존 LLM은 16-bit 부동 소수점 값(FP16 또는 BF16)을 사용하고, LLM의 대부분 연산은 행렬 곱셈으로 구성됩니다. 이는 부동 소수점 덧셈 및 곱셈 연산에서 주요 계산 비용이 발생합니다. 반면, BitNet의 행렬 곱셈은 정수 덧셈만을 포함하므로 LLM의 에너지 비용을 절감할 수 있습니다. 또한, DRAM에서 칩 내 메모리(e.g., SRAM)로 모델 파라미터를 전송하는 과정도 비용이 많이 듭니다. 1-bit LLM은 용량 및 대역폭 측면에서 훨씬 낮은 메모리 발자국을 가지므로 가중치를 DRAM에서 불러오는 비용과 시간을 크게 줄일 수 있습니다.

방법

BitNet b1.58은 각 파라미터가 삼진법(-1, 0, 1)을 취하도록 설계되었습니다. 이는 원래 1-bit BitNet에 추가적인 0 값을 포함하여 1.58 bits로 만들어, 거의 모든 곱셈 연산 없이 행렬 곱셈을 수행할 수 있으며 메모리 소비, 처리량 및 지연 시간 측면에서 FP16 Baseline Model보다 효율적입니다.


2 BitNet b1.58

BitNet b1.58은 BitNet 아키텍처를 기반으로 하며, nn.Linear 대신 BitLinear를 사용하는 Transformer입니다. 이 모델은 1.58-bit 가중치와 8-bit 활성화로 처음부터 훈련됩니다. 가중치를 -1, 0, +1 중 가장 가까운 정수로 제한하기 위해 absmean 양자화 함수를 채택합니다.

\[\text{Quantization} = \text{round}\left(\text{\text{weight matrix}}{\text{average absolute value}}\right)\]

이 양자화 함수는 성능에 거의 영향을 주지 않으면서 구현과 시스템 수준 최적화 모두에 편리함을 제공합니다.


3 결과

BitNet b1.58과 FP16 LLaMA LLM을 다양한 크기에서 비교했습니다. RedPajama 데이터셋에서 1000억 토큰으로 사전 훈련을 실시했으며, 여러 언어 작업에서 0-shot 성능을 평가했습니다. BitNet b1.58은 FP16 Baseline Model과 비교하여 2.71배 빠르며, 3.55배 적은 GPU 메모리를 사용합니다.


4 토론 및 미래 작업

1-bit MoE LLMs와 같은 기술은 LLMs의 계산 FLOPs를 줄이면서도 높은 메모리 소비와 칩 간 통신 오버헤드의 제한을 극복할 수 있습니다. 또한, 1.58-bit LLM은 모바일 및 엣지 장치에서의 언어 모델 성능을 대폭 향상시킬 수 있는 잠재력을 갖고 있습니다. 이런 장치들은 메모리 및 계산 능력에 제한이 있지만, 1.58-bit LLM의 도입으로 이전에는 불가능했던 다양한 응용 프로그램을 가능하게 할 수 있습니다.


1 The Era of 1-bit LLMs

In recent years, the field of AI has seen a rapid growth in the size and capabilities of Large Language Models (LLMs). These models have demonstrated remarkable performance in a wide range of natural language processing tasks, but their increasing size has posed challenges for deployment and raised concerns about their environmental and economic impact due to high energy consumption. One approach to address these challenges is to use post-training quantization to create low-bit models for inference [XLS+23, FAHA23, CCKS23, TCS+24]. This technique reduces the precision of weights and activations, significantly reducing the memory and computational requirements of LLMs. The trend has been to move from 16 bits to lower bits, such as 4-bit variants [FAHA23, LTT+23]. However, post-training quantization is sub-optimal, even though it is widely used in industry LLMs. Recent work on 1-bit model architectures, such as BitNet [WMD+23], presents a promising direction for reducing the cost of LLMs while maintaining their performance. Vanilla LLMs are in 16-bit floating values (i.e., FP16 or BF16), and the bulk of any LLMs is matrix multiplication. Therefore, the major computation cost comes from the floating-point addition and multiplication operations. In contrast, the matrix multiplication of BitNet only involves integer addition, which saves orders of energy cost for LLMs. As the fundamental limit to compute performance in many chips is power, the energy savings can also be translated into faster computation.

Figure 1: 1-bit LLMs (e.g., BitNet b1.58) provide a Pareto solution to reduce inference cost (latency, throughput, and energy) of LLMs while maintaining model performance. The new computation paradigm of BitNet b1.58 calls for actions to design new hardware optimized for 1-bit LLMs.

In addition to computation, the process of transferring model parameters from DRAM to the memory of an on-chip accelerator (e.g., SRAM) can be expensive during inference. There have been attempts to enlarge SRAM to improve throughput, but this introduces significantly higher costs than DRAM. Compared to full-precision models, 1-bit LLMs have a much lower memory footprint from both a capacity and bandwidth standpoint. This can significantly reduce the cost and time of loading weights from DRAM, leading to faster and more efficient inference.

In this work, we introduce a significant 1-bit LLM variant called BitNet b1.58, where every parameter is ternary, taking on values of {-1, 0, 1}. We have added an additional value of 0 to the original 1-bit BitNet, resulting in 1.58 bits in the binary system. BitNet b1.58 retains all the benefits of the original 1-bit BitNet, including its new computation paradigm, which requires almost no multiplication operations for matrix multiplication and can be highly optimized. Additionally, it has the same energy consumption as the original 1-bit BitNet and is much more efficient in terms of memory consumption, throughput and latency compared to FP16 LLM baselines. Furthermore, BitNet b1.58 offers two additional advantages. Firstly, its modeling capability is stronger due to its explicit support for feature filtering, made possible by the inclusion of 0 in the model weights, which can significantly improve the performance of 1-bit LLMs. Secondly, our experiments show that BitNet b1.58 can match full precision (i.e., FP16) baselines in terms of both perplexity and end-task performance, starting from a 3B size, when using the same configuration (e.g., model size, training tokens, etc.).

2 BitNet b1.58

BitNet b1.58 is based on the BitNet architecture, which is a Transformer that replaces nn.Linear with BitLinear. It is trained from scratch, with 1.58-bit weights and 8-bit activations. Compared to the original BitNet, it introduces some modifications that we summarize below.

Quantization Function. To constrain the weights to -1, 0, or +1, we adopt an absmean quantization function. It first scales the weight matrix by its average absolute value, and then round each value to the nearest integer among {-1, 0, +1}:

The quantization function for activations follows the same implementation in BitNet, except that we do not scale the activations before the non-linear functions to the range [0, Qb]. Instead, the activations are all scaled to [−Qb, Qb] per token to get rid of the zero-point quantization. This is more convenient and simple for both implementation and system-level optimization, while introduces negligible effects to the performance in our experiments.

Table 2: Zero-shot accuracy of BitNet b1.58 and LLaMA LLM on the end tasks.

LLaMA-alike Components. The architecture of LLaMA [TLI+23, TMS+23] has been the defacto backbone for open-source LLMs. To embrace the open-source community, our design of BitNet b1.58 adopts the LLaMA-alike components. Specifically, it uses RMSNorm [ZS19], SwiGLU [Sha20], rotary embedding [SAL+24], and removes all biases. In this way, BitNet b1.58 can be integrated into the popular open-source software (e.g., Huggingface, vLLM [KLZ+23], and llama.cpp2) with minimal efforts.

3 Results

We compared BitNet b1.58 to our reproduced FP16 LLaMA LLM in various sizes. To ensure a fair comparison, we pre-trained the models on the RedPajama dataset [Com23] for 100 billion tokens. We evaluated the zero-shot performance on a range of language tasks, including ARC-Easy [YBS19], ARC-Challenge [YBS19], Hellaswag [ZHB+19], Winogrande [SBBC20], PIQA [BZB+19], OpenbookQA [MCKS18], and BoolQ [CLC+19]. We also reported the validation perplexity on the WikiText2 [MXBS16] and C4 [RSR+19] datasets.

We compared the runtime GPU memory and latency of both LLaMA LLM and BitNet b1.58. The results were measured using the FasterTransformer3 codebase, which is well-optimized for LLM inference latency on GPU devices. The 2-bit kernel from Ladder [WMC+23] is also integrated for BitNet b1.58. We reported the time per output token, as it is the major cost for inference.

Table 1 summarizes the perplexity and the cost for BitNet b1.58 and LLaMA LLM. It shows that BitNet b1.58 starts to match full precision LLaMA LLM at 3B model size in terms of perplexity, while being 2.71 times faster and using 3.55 times less GPU memory. In particular, BitNet b1.58 with a 3.9B model size is 2.4 times faster, consumes 3.32 times less memory, but performs significantly better than LLaMA LLM 3B.

2 https://github.com/ggerganov/llama.cpp

3 https://github.com/NVIDIA/FasterTransformer

Figure 2: Decoding latency (Left) and memory consumption (Right) of BitNet b1.58 varying the model size.

Table 3: Comparison of the throughput between BitNet b1.58 70B and LLaMA LLM 70B.

Table 2 reports the detailed results of the zero-shot accuracy on the end tasks. We followed the pipeline from lm-evaluation-harness4 to perform the evaluation. The results show that the performance gap between BitNet b1.58 and LLaMA LLM narrows as the model size increases. More importantly, BitNet b1.58 can match the performance of the full precision baseline starting from a 3B size. Similar to the observation of the perplexity, the end-task results reveal that BitNet b1.58 3.9B outperforms LLaMA LLM 3B with lower memory and latency cost. This demonstrates that BitNet b1.58 is a Pareto improvement over the state-of-the-art LLM models.

Memory and Latency We further scaled up the model size to 7B, 13B, and 70B and evaluated the cost. Figure 2 illustrates the trends of latency and memory, showing that the speed-up increases as the model size scales. In particular, BitNet b1.58 70B is 4.1 times faster than the LLaMA LLM baseline. This is because the time cost for nn.Linear grows with the model size. The memory consumption follows a similar trend, as the embedding remains full precision and its memory proportion is smaller for larger models. Both latency and memory were measured with a 2-bit kernel, so there is still room for optimization to further reduce the cost.

Energy We also estimate the arithmetic operations energy consumption of both BitNet b1.58 and LLaMA LLM. We focus mainly on the calculation for matrix multiplication, since it contributes the most to the cost of LLMs. Figure 3 illustrates the composition of the energy cost. The majority of BitNet b1.58 is INT8 addition calculation, while LLaMA LLM consists of both FP16 addition and FP16 multiplication. According to the energy model in [Hor14, ZZL22], BitNet b1.58 saves 71.4 times arithmetic operations energy consumption for matrix multiplication on 7nm chips. We further reported the end-to-end energy cost for models with 512 tokens. Our results show that as the model size scales, BitNet b1.58 becomes increasingly more efficient in terms of energy consumption compared to the FP16 LLaMA LLM baseline. This is due to the fact that the percentage of nn.Linear grows with the model size, while the cost from other components is smaller for larger models.

Throughput We compare the throughput of BitNet b1.58 and LLaMA LLM with 70B parameters on two 80GB A100 cards, using pipeline parallelism [HCB+19] so that LLaMA LLM 70B could be run on the devices. We increased the batch size until the GPU memory limit was reached, with a sequence length of 512. Table 3 shows that BitNet b1.58 70B can support up to 11 times the batch size of LLaMA LLM, resulting an 8.9 times higher throughput.

4 https://github.com/EleutherAI/lm-evaluation-harness

Figure 3: Energy consumption of BitNet b1.58 compared to LLaMA LLM at 7nm process nodes. On the left is the components of arithmetic operations energy. On the right is the end-to-end energy cost across different model sizes.

Table 4: Comparison of BitNet b1.58 with StableLM-3B with 2T tokens.

BitNet b1.58 is enabling a new scaling law with respect to model performance and inference cost. As a reference, we can have the following equivalence between different model sizes in 1.58-bit and 16-bit based on the results in Figure 2 and 3.

  • 13B BitNet b1.58 is more efficient, in terms of latency, memory usage and energy consumption, than 3B FP16 LLM.
  • 30B BitNet b1.58 is more efficient, in terms of latency, memory usage and energy consumption, than 7B FP16 LLM.
  • 70B BitNet b1.58 is more efficient, in terms of latency, memory usage and energy consumption, than 13B FP16 LLM.

Training with 2T Tokens The number of training tokens is a crucial factor for LLMs. To test the scalability of BitNet b1.58 in terms of tokens, we trained a BitNet b1.58 model with 2T tokens following the data recipe of StableLM-3B [TBMR], which is the state-of-the-art open-source 3B model. Both models were evaluated on a benchmark that consists of Winogrande [SBBC20], PIQA [BZB+19], SciQ [WLG17], LAMBADA [PKL+16], and ARC-easy [YBS19]. We reported the zero-shot accuracy in Table 4. For tasks measured with accuracy and normalized accuracy, we take the average of the two. The results of StableLM 3b at 2T tokens are taken directly from its technical report. Our findings shows that BitNet b1.58 achieves a superior performance on all end tasks, indicating that 1.58-bit LLMs also have strong generalization capabilities.

4 Discussion and Future Work

1-bit Mixture-of-Experts (MoE) LLMs

Mixture-of-Experts (MoE) have proven to be a cost-effective approach for LLMs. While it significantly reduces the computation FLOPs, the high memory consumption and inter-chip communication overhead limit its deployment and application. These challenges can be addressed by 1.58-bit LLMs. Firstly, the reduced memory footprint reduces the number of devices required to deploy MoE models. Moreover, it significantly reduces the overhead of transferring activations across networks. Ultimately, there would be no overhead if the entire models could be placed on a single chip.

Native Support of Long Sequence in LLMs

In the era of LLMs, the ability to handle long sequence has become a critical demand. One major challenge for long sequence inference is the memory consumption introduced by the KV caches. BitNet b1.58 represents a significant step towards native support for long sequences, as it reduces the activations from 16 bits to 8 bits, allowing the context length to be doubled given the same resources. This can be further losslessly compressed to 4 bits or even lower for 1.58-bit LLMs, which we leave as future work.

LLMs on Edge and Mobile

The use of 1.58-bit LLMs has the potential to greatly improve the performance of language models on edge and mobile devices. These devices are often limited by their memory and computational power, which can restrict the performance and the scale of LLMs. However, the reduced memory and energy consumption of 1.58-bit LLMs allows them to be deployed on these devices, enabling a wide range of applications that were previously not possible. This can greatly enhance the capabilities of edge and mobile devices and enable new and exciting applications of LLMs. Moreover, 1.58-bit LLMs are more friendly to CPU devices, which are the main processors used in edge and mobile devices. This means that BitNet b1.58 can be efficiently executed on these devices, further improving their performance and capabilities.

New Hardware for 1-bit LLMs Recent work like Groq5 has demonstrated promising results and great potential for building specific hardware (e.g., LPUs) for LLMs. Going one step further, we envision and call for actions to design new hardware and system specifically optimized for 1-bit LLMs, given the new computation paradigm enabled in BitNet [WMD+23].

5 https://groq.com/

Previous: Mistral Large Next: Survey | Datasets for LLMs

post contain ""

    No matching posts found containing ""