模型简介
模型特点
模型能力
使用案例
🚀 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 许可证。



