Mistral Small 3.1 24B Instruct 2503 Quantized.w8a8
M
Mistral Small 3.1 24B Instruct 2503 Quantized.w8a8
RedHatAIによって開発
これはRed HatとNeural Magicによって最適化されたINT8量子化されたMistral-Small-3.1-24B-Instruct-2503モデルで、高速応答と低遅延シナリオに適しています。
ダウンロード数 833
リリース時間 : 4/15/2025
モデル概要
このモデルはMistral-Small-3.1-24B-Instruct-2503の量子化バージョンで、重みと活性化をINT8に量子化することで、GPUメモリ要件を大幅に削減し、計算効率を向上させました。
モデル特徴
効率的な量子化
INT8量子化技術により、GPUメモリ要件を約50%削減し、計算スループットを約2倍向上
多言語サポート
24言語のテキスト生成と理解をサポート
多機能アプリケーション
対話エージェント、関数呼び出し、ドキュメント理解、視覚理解など多様なタスクに適用可能
高速応答
最適化されたモデルは特に低遅延が求められるアプリケーションシナリオに適しています
モデル能力
テキスト生成
多言語処理
対話エージェント
関数呼び出し
長文書理解
視覚理解
プログラミングと数学的推論
使用事例
対話システム
カスタマーサービスチャットボット
高速応答型カスタマーサービスエージェントの展開
応答遅延を低減し、ユーザー体験を向上
開発ツール
コードアシスタント
開発者のプログラミングとデバッグを支援
開発効率を向上
コンテンツ理解
長文書要約
長文書の内容を迅速に理解し要約
情報処理効率を向上
language:
- en
- fr
- de
- es
- pt
- it
- ja
- ko
- ru
- zh
- ar
- fa
- id
- ms
- ne
- pl
- ro
- sr
- sv
- tr
- uk
- vi
- hi
- bn license: apache-2.0 library_name: vllm base_model:
- mistralai/Mistral-Small-3.1-24B-Instruct-2503 pipeline_tag: image-text-to-text tags:
- neuralmagic
- redhat
- llmcompressor
- quantized
- int8
Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8
モデル概要
- モデルアーキテクチャ: Mistral3ForConditionalGeneration
- 入力: テキスト / 画像
- 出力: テキスト
- モデル最適化:
- 活性化量子化: INT8
- 重み量子化: INT8
- 想定用途:
- 高速応答型会話エージェント
- 低遅延関数呼び出し
- ファインチューニングによる専門家向け利用
- 機密データを扱う個人/組織向けローカル推論
- プログラミングおよび数学的推論
- 長文書理解
- 視覚的理解
- 対象外用途: 適用される法律や規制(貿易コンプライアンス法を含む)に違反するあらゆる用途。モデルが公式にサポートしていない言語での利用。
- リリース日: 2025年4月15日
- バージョン: 1.0
- モデル開発者: Red Hat (Neural Magic)
モデル最適化
このモデルはMistral-Small-3.1-24B-Instruct-2503の活性化と重みをINT8データ型に量子化して作成されました。 この最適化により、重みと活性化のビット数を16から8に削減し、GPUメモリ要件を約50%削減、行列乗算計算スループットを約2倍向上させています。 重み量子化によりディスクサイズ要件も約50%削減されます。
量子化はトランスフォーマーブロック内の線形演算子の重みと活性化にのみ適用されます。 重みは対称的静的なチャネル単位方式、活性化は対称的動的なトークン単位方式で量子化されます。 SmoothQuantとGPTQアルゴリズムを組み合わせた量子化がllm-compressorライブラリで実装されています。
デプロイメント
このモデルはvLLMバックエンドを使用して効率的にデプロイできます。以下に例を示します。
from vllm import LLM, SamplingParams
from transformers import AutoProcessor
model_id = "RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-FP8-dynamic"
number_gpus = 1
sampling_params = SamplingParams(temperature=0.7, top_p=0.8, max_tokens=256)
processor = AutoProcessor.from_pretrained(model_id)
messages = [{"role": "user", "content": "大規模言語モデルについて簡単に説明してください。"}]
prompts = processor.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
llm = LLM(model=model_id, tensor_parallel_size=number_gpus)
outputs = llm.generate(prompts, sampling_params)
generated_text = outputs[0].outputs[0].text
print(generated_text)
vLLMはOpenAI互換のサービスもサポートしています。詳細はドキュメントを参照してください。
作成
作成詳細
このモデルは以下のコードスニペットを実行して[llm-compressor](https://github.com/vllm-project/llm-compressor)で作成されました。from transformers import AutoProcessor
from llmcompressor.modifiers.quantization import GPTQModifier
from llmcompressor.modifiers.smoothquant import SmoothQuantModifier
from llmcompressor.transformers import oneshot
from llmcompressor.transformers.tracing import TraceableMistral3ForConditionalGeneration
from datasets import load_dataset, interleave_datasets
from PIL import Image
import io
# モデル読み込み
model_stub = "mistralai/Mistral-Small-3.1-24B-Instruct-2503"
model_name = model_stub.split("/")[-1]
num_text_samples = 1024
num_vision_samples = 1024
max_seq_len = 8192
processor = AutoProcessor.from_pretrained(model_stub)
model = TraceableMistral3ForConditionalGeneration.from_pretrained(
model_stub,
device_map="auto",
torch_dtype="auto",
)
# テキストのみデータサブセット
def preprocess_text(example):
input = {
"text": processor.apply_chat_template(
example["messages"],
add_generation_prompt=False,
),
"images": None,
}
tokenized_input = processor(**input, max_length=max_seq_len, truncation=True)
tokenized_input["pixel_values"] = tokenized_input.get("pixel_values", None)
tokenized_input["image_sizes"] = tokenized_input.get("image_sizes", None)
return tokenized_input
dst = load_dataset("neuralmagic/calibration", name="LLM", split="train").select(range(num_text_samples))
dst = dst.map(preprocess_text, remove_columns=dst.column_names)
# テキスト+視覚データサブセット
def preprocess_vision(example):
messages = []
image = None
for message in example["messages"]:
message_content = []
for content in message["content"]:
if content["type"] == "text":
message_content.append({"type": "text", "text": content["text"]})
else:
message_content.append({"type": "image"})
image = Image.open(io.BytesIO(content["image"]))
messages.append(
{
"role": message["role"],
"content": message_content,
}
)
input = {
"text": processor.apply_chat_template(
messages,
add_generation_prompt=False,
),
"images": image,
}
tokenized_input = processor(**input, max_length=max_seq_len, truncation=True)
tokenized_input["pixel_values"] = tokenized_input.get("pixel_values", None)
tokenized_input["image_sizes"] = tokenized_input.get("image_sizes", None)
return tokenized_input
dsv = load_dataset("neuralmagic/calibration", name="VLM", split="train").select(range(num_vision_samples))
dsv = dsv.map(preprocess_vision, remove_columns=dsv.column_names)
# サブセットをインターリーブ
ds = interleave_datasets((dsv, dst))
# 量子化アルゴリズムとスキームを設定
recipe = [
SmoothQuantModifier(
smoothing_strength=0.8,
mappings=[
[["re:.*q_proj", "re:.*k_proj", "re:.*v_proj"], "re:.*input_layernorm"],
[["re:.*gate_proj", "re:.*up_proj"], "re:.*post_attention_layernorm"],
[["re:.*down_proj"], "re:.*up_proj"],
],
),
GPTQModifier(
ignore=["language_model.lm_head", "re:vision_tower.*", "re:multi_modal_projector.*"],
sequential_targets=["MistralDecoderLayer"],
dampening_frac=0.01,
targets="Linear",
scheme="W8A8",
),
]
# データコレータを定義
def data_collator(batch):
import torch
assert len(batch) == 1
collated = {}
for k, v in batch[0].items():
if v is None:
continue
if k == "input_ids":
collated[k] = torch.LongTensor(v)
elif k == "pixel_values":
collated[k] = torch.tensor(v, dtype=torch.bfloat16)
else:
collated[k] = torch.tensor(v)
return collated
# 量子化を適用
oneshot(
model=model,
dataset=ds,
recipe=recipe,
max_seq_length=max_seq_len,
data_collator=data_collator,
num_calibration_samples=num_text_samples + num_vision_samples,
)
# 圧縮テンソル形式でディスクに保存
save_path = model_name + "-quantized.w8a8"
model.save_pretrained(save_path)
processor.save_pretrained(save_path)
print(f"モデルとトークナイザーを保存しました: {save_path}")
評価
このモデルはOpenLLMリーダーボードタスク(バージョン1)、MMLU-pro、GPQA、HumanEval、MBPPで評価されました。 非コーディングタスクはlm-evaluation-harnessで、コーディングタスクはevalplusのフォークで評価されました。 すべてのケースでvLLMがエンジンとして使用されました。
評価詳細
MMLU
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.5,max_model_len=8192,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks mmlu \
--num_fewshot 5 \
--apply_chat_template\
--fewshot_as_multiturn \
--batch_size auto
ARC Challenge
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.5,max_model_len=8192,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks arc_challenge \
--num_fewshot 25 \
--apply_chat_template\
--fewshot_as_multiturn \
--batch_size auto
GSM8k
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.9,max_model_len=8192,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks gsm8k \
--num_fewshot 8 \
--apply_chat_template\
--fewshot_as_multiturn \
--batch_size auto
Hellaswag
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.5,max_model_len=8192,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks hellaswag \
--num_fewshot 10 \
--apply_chat_template\
--fewshot_as_multiturn \
--batch_size auto
Winogrande
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.5,max_model_len=8192,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks winogrande \
--num_fewshot 5 \
--apply_chat_template\
--fewshot_as_multiturn \
--batch_size auto
TruthfulQA
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.5,max_model_len=8192,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks truthfulqa \
--num_fewshot 0 \
--apply_chat_template\
--batch_size auto
MMLU-pro
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.5,max_model_len=8192,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks mmlu_pro \
--num_fewshot 5 \
--apply_chat_template\
--fewshot_as_multiturn \
--batch_size auto
MMMU
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.9,max_images=8,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks mmmu \
--apply_chat_template\
--batch_size auto
ChartQA
lm_eval \
--model vllm \
--model_args pretrained="RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.9,max_images=8,enable_chunk_prefill=True,tensor_parallel_size=2 \
--tasks chartqa \
--apply_chat_template\
--batch_size auto
コーディング
以下のコマンドはmbppでも使用可能(データセット名を置換)
生成
python3 codegen/generate.py \
--model RedHatAI/Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8 \
--bs 16 \
--temperature 0.2 \
--n_samples 50 \
--root "." \
--dataset humaneval
サニタイズ
python3 evalplus/sanitize.py \
humaneval/RedHatAI--Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8_vllm_temp_0.2
評価
evalplus.evaluate \
--dataset humaneval \
--samples humaneval/RedHatAI--Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8_vllm_temp_0.2-sanitized
精度
カテゴリ | ベンチマーク | Mistral-Small-3.1-24B-Instruct-2503 | Mistral-Small-3.1-24B-Instruct-2503-quantized.w8a8 (本モデル) |
回復率 |
---|---|---|---|---|
OpenLLM v1 | MMLU (5-shot) | 80.67 | 80.40 | 99.7% |
ARC Challenge (25-shot) | 72.78 | 73.46 | 100.9% | |
GSM-8K (5-shot, strict-match) | 56.68 | 61.18 | 104.3% | |
Hellaswag (10-shot) | 83.70 | 82.26 | 98.3% | |
Winogrande (5-shot) | 83.74 | 80.90 | 96.6% | |
TruthfulQA (0-shot, mc2) | 70.62 | 69.15 | 97.9% | |
平均 | 75.03 | 74.56 | 99.4% | |
MMLU-Pro (5-shot) | 67.25 | 66.54 | 98.9% | |
GPQA CoT main (5-shot) | 42.63 | 44.64 | 104.7% | |
GPQA CoT diamond (5-shot) | 45.96 | 41.92 | 91.2% | |
コーディング | HumanEval pass@1 | 84.70 | 84.20 | 99.4% |
HumanEval+ pass@1 | 79.50 | 81.00 | 101.9% | |
MBPP pass@1 | 71.10 | 72.10 | 101.4% | |
MBPP+ pass@1 | 60.60 | 62.10 | 100.7% | |
視覚 | MMMU (0-shot) | 52.11 | 53.11 | 101.9% |
ChartQA (0-shot) | 81.36 | 82.36 | 101.2% |
おすすめAIモデル
Llama 3 Typhoon V1.5x 8b Instruct
タイ語専用に設計された80億パラメータの命令モデルで、GPT-3.5-turboに匹敵する性能を持ち、アプリケーションシナリオ、検索拡張生成、制限付き生成、推論タスクを最適化
大規模言語モデル
Transformers 複数言語対応

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-TinyはSODAデータセットでトレーニングされた超小型対話モデルで、エッジデバイス推論向けに設計されており、体積はCosmo-3Bモデルの約2%です。
対話システム
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
RoBERTaアーキテクチャに基づく中国語抽出型QAモデルで、与えられたテキストから回答を抽出するタスクに適しています。
質問応答システム 中国語
R
uer
2,694
98