🚀 トランスフォーマーライブラリによるLlama3-8B-1.58モデル
Llama3-8B-1.58 モデルは、ベースモデル Llama-3-8B-Instruct から始まり、BitNet 1.58bアーキテクチャ でファインチューニングされた大規模言語モデルです。
方法と結果の詳細については、ブログ記事 をご覧ください。
🚀 クイックスタート
Transformersで簡単にモデルをロードしてテストできます。以下のコードに従ってください。
まず、bitnetモデルをロードするための正しい設定でtransformersバージョンをインストールします。
pip install git+https://github.com/huggingface/transformers.git@refs/pull/33410/head
次に、モデルをロードします。
model = AutoModelForCausalLM.from_pretrained("HF1BitLLM/Llama3-8B-1.58-100B-tokens", device_map="cuda", torch_dtype=torch.bfloat16)
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
input_text = "Daniel went back to the the the garden. Mary travelled to the kitchen. Sandra journeyed to the kitchen. Sandra went to the hallway. John went to the bedroom. Mary went back to the garden. Where is Mary?\nAnswer:"
input_ids = tokenizer.encode(input_text, return_tensors="pt").cuda()
output = model.generate(input_ids, max_length=10, do_sample=False)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
✨ 主な機能
このモデルは、高度な量子化技術を用いており、1000億トークンでのトレーニングにより、半精度モデルに近い性能を発揮します。
📦 インストール
pip install git+https://github.com/huggingface/transformers.git@refs/pull/33410/head
💻 使用例
基本的な使用法
model = AutoModelForCausalLM.from_pretrained("HF1BitLLM/Llama3-8B-1.58-100B-tokens", device_map="cuda", torch_dtype=torch.bfloat16)
tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
input_text = "Daniel went back to the the the garden. Mary travelled to the kitchen. Sandra journeyed to the kitchen. Sandra went to the hallway. John went to the bedroom. Mary went back to the garden. Where is Mary?\nAnswer:"
input_ids = tokenizer.encode(input_text, return_tensors="pt").cuda()
output = model.generate(input_ids, max_length=10, do_sample=False)
generated_text = tokenizer.decode(output[0], skip_special_tokens=True)
print(generated_text)
📚 ドキュメント
モデルの詳細
モデルのソース
トレーニングの詳細
トレーニングデータ
このモデルは、FineWeb-edu のサブセットでトレーニングされました。
トレーニングプロセス
- 開始地点
- 線形ラムダスケジューラを使用した100億トークンのランで最良のパフォーマンスを示したチェックポイント
- トレーニング期間
- さらに45,000ステップでファインチューニング
- 合計1000億トークンに達成
- データセット
- バッチサイズ
- ステップごとに200万トークン
- 1ランあたりの合計: 45,000ステップ * 200万トークン = 900億トークン
- 初期の100億トークンと合わせて1000億トークンに達成
- 学習率の実験
- 最適な設定を見つけるために様々な学習率をテスト。実験によると、最良のピーク学習率は1e-5です。
- パフォーマンス
- いくつかの指標でLlama3 8Bに近いパフォーマンスを示す
- 全体的な平均パフォーマンスではLlama3 8Bに劣る
- 評価
- 評価指標には、パープレキシティ、MMLUスコア、およびその他の標準的なベンチマークが含まれます。
これらの1000億トークンでの拡張トレーニングランは、高度に量子化されたモデルの限界を押し広げ、Llama3のような半精度モデルに近いパフォーマンスをもたらします。
評価
モデルの評価は、LightEvalを使用してnanotronチェックポイントで行われます。

🔧 技術詳細
このモデルは、BitNet 1.58bアーキテクチャを使用しており、高度な量子化技術を用いています。トレーニングは、FineWeb-eduデータセットのサブセットで行われ、1000億トークンでのトレーニングにより、半精度モデルに近いパフォーマンスを発揮します。
📄 ライセンス
@misc{,
title={1.58-Bit LLM: A New Era of Extreme Quantization},
author={Mohamed Mekkouri and Marc Sun and Leandro von Werra and Thomas Wolf},
year={2024},
}