模型概述
模型特點
模型能力
使用案例
🚀 EXAONE-4.0-32B
EXAONE 4.0 集成了 非推理模式 和 推理模式,既具備 EXAONE 3.5 的出色可用性,又擁有 EXAONE Deep 的高級推理能力。為了迎接智能體人工智能時代,EXAONE 4.0 融入了智能體工具使用等關鍵特性,並且其多語言能力得到擴展,除英語和韓語外,還支持西班牙語。
EXAONE 4.0 模型系列有兩種規格:為高性能優化的中型 32B 模型,以及專為設備端應用設計的小型 1.2B 模型。
🎉 許可證更新!我們很高興地宣佈推出了更靈活的許可條款 🤗
✈️ 前往 FriendliAI 進行試用
🚀 快速開始
你需要安裝從原始版本分叉而來的 transformers
庫,該庫可在我們的 PR 中獲取。一旦此 PR 合併併發布,我們將更新此部分內容。
你可以通過以下命令安裝支持 EXAONE 4.0 的最新版本 transformers
:
pip install git+https://github.com/lgai-exaone/transformers@add-exaone4
非推理模式
對於一般使用場景,你可以使用以下示例代碼來使用 EXAONE 4.0 模型:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "LGAI-EXAONE/EXAONE-4.0-32B"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="bfloat16",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# 選擇你的提示語
prompt = "Explain how wonderful you are"
prompt = "Explica lo increíble que eres"
prompt = "너가 얼마나 대단한지 설명해 봐"
messages = [
{"role": "user", "content": prompt}
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
)
output = model.generate(
input_ids.to(model.device),
max_new_tokens=128,
do_sample=False,
)
print(tokenizer.decode(output[0]))
推理模式
EXAONE 4.0 模型具備處理複雜問題的推理能力。你可以通過在 tokenizer
中使用 enable_thinking=True
參數來激活推理模式,這將開啟一個以 <think>
標籤開頭的推理塊,且無需手動關閉。
messages = [
{"role": "user", "content": "Which one is bigger, 3.12 vs 3.9?"}
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
enable_thinking=True,
)
output = model.generate(
input_ids.to(model.device),
max_new_tokens=128,
do_sample=True,
temperature=0.6,
top_p=0.95
)
print(tokenizer.decode(output[0]))
⚠️ 重要提示
推理模式下的模型生成結果會受到採樣參數的顯著影響,因此為了獲得更好的質量,請參考 使用指南。
智能體工具使用
EXAONE 4.0 模型可以作為智能體使用,具備工具調用能力。你可以向模型提供工具架構,以實現有效的工具調用。
import random
def roll_dice(max_num: int):
return random.randint(1, max_num)
tools = [
{
"type": "function",
"function": {
"name": "roll_dice",
"description": "Roll a dice with the number 1 to N. User can select the number N.",
"parameters": {
"type": "object",
"required": ["max_num"],
"properties": {
"max_num": {
"type": "int",
"description": "Max number of the dice"
}
}
}
}
}
]
messages = [
{"role": "user", "content": "Roll D6 dice twice!"}
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
tools=tools,
)
output = model.generate(
input_ids.to(model.device),
max_new_tokens=1024,
do_sample=True,
temperature=0.6,
top_p=0.95,
)
print(tokenizer.decode(output[0]))
✨ 主要特性
模型架構特性
在 EXAONE 4.0 架構中,與之前的 EXAONE 模型相比,我們進行了以下新的架構更改:
- 混合注意力機制:對於 32B 模型,我們採用混合注意力方案,將 局部注意力(滑動窗口注意力) 與 全局注意力(全注意力) 以 3:1 的比例結合。為了更好地理解全局上下文,我們在全局注意力中不使用 RoPE(旋轉位置嵌入)。
- QK 重排序歸一化:我們在 Transformer 塊中採用後層歸一化(Post-LN)方案,而非前層歸一化(Pre-LN),並在 Q 和 K 投影后立即添加 RMS 歸一化。儘管這會消耗更多計算資源,但有助於在下游任務中取得更好的性能。
多語言支持
支持英語、韓語和西班牙語,滿足不同語言用戶的需求。
推理與非推理模式
集成了推理模式和非推理模式,適應不同的使用場景。
智能體工具使用
具備工具調用能力,可以作為智能體使用。
📦 安裝指南
你需要安裝從原始版本分叉而來的 transformers
庫,該庫可在我們的 PR 中獲取。一旦此 PR 合併併發布,我們將更新此部分內容。
你可以通過以下命令安裝支持 EXAONE 4.0 的最新版本 transformers
:
pip install git+https://github.com/lgai-exaone/transformers@add-exaone4
💻 使用示例
基礎用法
以下是在非推理模式下使用 EXAONE 4.0 模型的基礎示例:
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "LGAI-EXAONE/EXAONE-4.0-32B"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="bfloat16",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# 選擇你的提示語
prompt = "Explain how wonderful you are"
prompt = "Explica lo increíble que eres"
prompt = "너가 얼마나 대단한지 설명해 봐"
messages = [
{"role": "user", "content": prompt}
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt"
)
output = model.generate(
input_ids.to(model.device),
max_new_tokens=128,
do_sample=False,
)
print(tokenizer.decode(output[0]))
高級用法
推理模式
messages = [
{"role": "user", "content": "Which one is bigger, 3.12 vs 3.9?"}
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
enable_thinking=True,
)
output = model.generate(
input_ids.to(model.device),
max_new_tokens=128,
do_sample=True,
temperature=0.6,
top_p=0.95
)
print(tokenizer.decode(output[0]))
智能體工具使用
import random
def roll_dice(max_num: int):
return random.randint(1, max_num)
tools = [
{
"type": "function",
"function": {
"name": "roll_dice",
"description": "Roll a dice with the number 1 to N. User can select the number N.",
"parameters": {
"type": "object",
"required": ["max_num"],
"properties": {
"max_num": {
"type": "int",
"description": "Max number of the dice"
}
}
}
}
}
]
messages = [
{"role": "user", "content": "Roll D6 dice twice!"}
]
input_ids = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
tools=tools,
)
output = model.generate(
input_ids.to(model.device),
max_new_tokens=1024,
do_sample=True,
temperature=0.6,
top_p=0.95,
)
print(tokenizer.decode(output[0]))
📚 詳細文檔
模型配置
- 參數數量(不包括嵌入層):309.5 億
- 層數:64
- 注意力頭數量:採用 GQA 架構,40 個頭和 8 個鍵值頭
- 詞彙表大小:102,400
- 上下文長度:131,072 個標記
部署
TensorRT-LLM
TensorRT-LLM 在最新提交中正式支持 EXAONE 4.0 模型。在其發佈之前,你需要克隆 TensorRT-LLM 倉庫並從源代碼進行構建。
git clone https://github.com/NVIDIA/TensorRT-LLM.git
克隆倉庫後,你需要構建源代碼以進行安裝。請參考 官方文檔 來構建 TensorRT-LLM 環境。
你可以按照以下步驟運行 TensorRT-LLM 服務器:
- 編寫額外的配置 YAML 文件
# extra_llm_api_config.yaml kv_cache_config: enable_block_reuse: false
- 使用配置文件運行服務器
trtllm-serve serve [MODEL_PATH] --backend pytorch --extra_llm_api_options extra_llm_api_config.yaml
有關更多詳細信息,請參考 TensorRT-LLM 中 EXAONE 的文檔。
⚠️ 重要提示
目前包括
vllm
和sglang
在內的其他推理引擎尚未正式支持 EXAONE 4.0。我們將在這些庫更新後立即進行更新。
性能
以下表格展示了每個模型在推理和非推理模式下的評估結果。評估詳情可在 技術報告 中找到。
- ✅ 表示該模型具備混合推理能力,可根據需求選擇推理/非推理模式。
- 為了評估韓語的 實用 和 專業 知識,我們採用了 KMMLU-Redux 和 KMMLU-Pro 兩個基準測試。這兩個數據集均已公開發布!
32B 推理模式
EXAONE 4.0 32B | Phi 4 reasoning-plus | Magistral Small-2506 | Qwen 3 32B | Qwen 3 235B | DeepSeek R1-0528 | |
---|---|---|---|---|---|---|
模型大小 | 320 億 | 147 億 | 236 億 | 328 億 | 2350 億 | 6710 億 |
混合推理 | ✅ | ✅ | ✅ | |||
世界知識 | ||||||
MMLU-Redux | 92.3 | 90.8 | 86.8 | 90.9 | 92.7 | 93.4 |
MMLU-Pro | 81.8 | 76.0 | 73.4 | 80.0 | 83.0 | 85.0 |
GPQA-Diamond | 75.4 | 68.9 | 68.2 | 68.4 | 71.1 | 81.0 |
數學/編碼 | ||||||
AIME 2025 | 85.3 | 78.0 | 62.8 | 72.9 | 81.5 | 87.5 |
HMMT Feb 2025 | 72.9 | 53.6 | 43.5 | 50.4 | 62.5 | 79.4 |
LiveCodeBench v5 | 72.6 | 51.7 | 55.8 | 65.7 | 70.7 | 75.2 |
LiveCodeBench v6 | 66.7 | 47.1 | 47.4 | 60.1 | 58.9 | 70.3 |
指令遵循 | ||||||
IFEval | 83.7 | 84.9 | 37.9 | 85.0 | 83.4 | 80.8 |
Multi-IF (EN) | 73.5 | 56.1 | 27.4 | 73.4 | 73.4 | 72.0 |
智能體工具使用 | ||||||
BFCL-v3 | 63.9 | N/A | 40.4 | 70.3 | 70.8 | 64.7 |
Tau-bench (Airline) | 51.5 | N/A | 38.5 | 34.5 | 37.5 | 53.5 |
Tau-bench (Retail) | 62.8 | N/A | 10.2 | 55.2 | 58.3 | 63.9 |
多語言能力 | ||||||
KMMLU-Pro | 67.7 | 55.8 | 51.5 | 61.4 | 68.1 | 71.7 |
KMMLU-Redux | 72.7 | 62.7 | 54.6 | 67.5 | 74.5 | 77.0 |
KSM | 87.6 | 79.8 | 71.9 | 82.8 | 86.2 | 86.7 |
MMMLU (ES) | 85.6 | 84.3 | 68.9 | 82.8 | 86.7 | 88.2 |
MATH500 (ES) | 95.8 | 94.2 | 83.5 | 94.3 | 95.1 | 96.0 |
32B 非推理模式
EXAONE 4.0 32B | Phi 4 | Mistral-Small-2506 | Gemma 3 27B | Qwen3 32B | Qwen3 235B | Llama-4-Maverick | DeepSeek V3-0324 | |
---|---|---|---|---|---|---|---|---|
模型大小 | 320 億 | 147 億 | 240 億 | 274 億 | 328 億 | 2350 億 | 4020 億 | 6710 億 |
混合推理 | ✅ | ✅ | ✅ | |||||
世界知識 | ||||||||
MMLU-Redux | 89.8 | 88.3 | 85.9 | 85.0 | 85.7 | 89.2 | 92.3 | 92.3 |
MMLU-Pro | 77.6 | 70.4 | 69.1 | 67.5 | 74.4 | 77.4 | 80.5 | 81.2 |
GPQA-Diamond | 63.7 | 56.1 | 46.1 | 42.4 | 54.6 | 62.9 | 69.8 | 68.4 |
數學/編碼 | ||||||||
AIME 2025 | 35.9 | 17.8 | 30.2 | 23.8 | 20.2 | 24.7 | 18.0 | 50.0 |
HMMT Feb 2025 | 21.8 | 4.0 | 16.9 | 10.3 | 9.8 | 11.9 | 7.3 | 29.2 |
LiveCodeBench v5 | 43.3 | 24.6 | 25.8 | 27.5 | 31.3 | 35.3 | 43.4 | 46.7 |
LiveCodeBench v6 | 43.1 | 27.4 | 26.9 | 29.7 | 28.0 | 31.4 | 32.7 | 44.0 |
指令遵循 | ||||||||
IFEval | 84.8 | 63.0 | 77.8 | 82.6 | 83.2 | 83.2 | 85.4 | 81.2 |
Multi-IF (EN) | 71.6 | 47.7 | 63.2 | 72.1 | 71.9 | 72.5 | 77.9 | 68.3 |
長上下文處理 | ||||||||
HELMET | 58.3 | N/A | 61.9 | 58.3 | 54.5 | 63.3 | 13.7 | N/A |
RULER | 88.2 | N/A | 71.8 | 66.0 | 85.6 | 90.6 | 2.9 | N/A |
LongBench v1 | 48.1 | N/A | 51.5 | 51.5 | 44.2 | 45.3 | 34.7 | N/A |
智能體工具使用 | ||||||||
BFCL-v3 | 65.2 | N/A | 57.7 | N/A | 63.0 | 68.0 | 52.9 | 63.8 |
Tau-Bench (Airline) | 25.5 | N/A | 36.1 | N/A | 16.0 | 27.0 | 38.0 | 40.5 |
Tau-Bench (Retail) | 55.9 | N/A | 35.5 | N/A |
🔧 技術細節
更多詳細信息,請參考我們的 技術報告、博客 和 GitHub。
📄 許可證
本項目採用 exaone 許可證。



