This repository contains an unofficial PyTorch implementation of BitNet a4.8: 4-bit Activations for 1-bit LLMs (Wang et al., 2024).
BitNet a4.8 is a groundbreaking approach that enables 4-bit activations for 1-bit Large Language Models (LLMs). The method employs a hybrid quantization and sparsification strategy to mitigate quantization errors from outlier channels while maintaining model performance.
Key features:
This implementation includes:
# Create a BitNet a4.8 model
model = create_model(
hidden_size=4096,
intermediate_size=11008,
num_hidden_layers=32,
num_attention_heads=32
)
Key components:
git clone https://github.com/yourusername/bitnet-a48
cd bitnet-a48
pip install -r requirements.txt
This implementation is part of the Agora initiative, where researchers and developers collaborate to implement cutting-edge ML papers. By joining Agora, you can:
The implementation achieves performance comparable to BitNet b1.58 while enabling:
from bitnet_a48 import create_model
# Initialize model
model = create_model(
hidden_size=4096,
intermediate_size=11008,
num_hidden_layers=32,
num_attention_heads=32
)
# Forward pass
outputs = model(input_ids, attention_mask)
The model uses a two-stage training recipe:
We welcome contributions! Please:
Join the discussion on the Agora Discord!
This project is licensed under the MIT License - see the LICENSE file for details.
@article{wang2024bitnet,
title={BitNet a4.8: 4-bit Activations for 1-bit LLMs},
author={Wang, Hongyu and Ma, Shuming and Wei, Furu},
journal={arXiv preprint arXiv:2411.04965},
year={2024}
}
Join us in implementing more cutting-edge ML research at Agora!
3 commits
Python
100.0%
This repository contains an unofficial PyTorch implementation of BitNet a4.8: 4-bit Activations for 1-bit LLMs (Wang et al., 2024).
BitNet a4.8 is a groundbreaking approach that enables 4-bit activations for 1-bit Large Language Models (LLMs). The method employs a hybrid quantization and sparsification strategy to mitigate quantization errors from outlier channels while maintaining model performance.
Key features:
This implementation includes:
# Create a BitNet a4.8 model
model = create_model(
hidden_size=4096,
intermediate_size=11008,
num_hidden_layers=32,
num_attention_heads=32
)
Key components:
git clone https://github.com/yourusername/bitnet-a48
cd bitnet-a48
pip install -r requirements.txt
This implementation is part of the Agora initiative, where researchers and developers collaborate to implement cutting-edge ML papers. By joining Agora, you can:
The implementation achieves performance comparable to BitNet b1.58 while enabling:
from bitnet_a48 import create_model
# Initialize model
model = create_model(
hidden_size=4096,
intermediate_size=11008,
num_hidden_layers=32,
num_attention_heads=32
)
# Forward pass
outputs = model(input_ids, attention_mask)
The model uses a two-stage training recipe:
We welcome contributions! Please:
Join the discussion on the Agora Discord!
This project is licensed under the MIT License - see the LICENSE file for details.
@article{wang2024bitnet,
title={BitNet a4.8: 4-bit Activations for 1-bit LLMs},
author={Wang, Hongyu and Ma, Shuming and Wei, Furu},
journal={arXiv preprint arXiv:2411.04965},
year={2024}
}
Join us in implementing more cutting-edge ML research at Agora!
3 commits
Python
100.0%