Views
No views yet
[!NOTE] Note: This version has an increased thinking length. We strongly recommend its use in highly complex reasoning tasks.

| Key | Value |
|---|---|
| Modality | Text |
| Training Stage | Posttraining |
| Params(Total / Activated) | 21B / 3B |
| Layers | 28 |
| Heads(Q/KV) | 20 / 4 |
| Text Experts(Total / Activated) | 64 / 6 |
| Vision Experts(Total / Activated) | 64 / 6 |
| Shared Experts | 2 |
| Context Length | 131072 |
[!NOTE] To align with the wider community, this model releases Transformer-style weights. Both PyTorch and PaddlePaddle ecosystem tools, such as vLLM, transformers, and FastDeploy, are expected to be able to load and run this model.
1python -m fastdeploy.entrypoints.openai.api_server \
2 --model baidu/ERNIE-4.5-21B-A3B-Thinking \
3 --port 8180 \
4 --metrics-port 8181 \
5 --engine-worker-queue-port 8182 \
6 --load_choices "default_v1" \
7 --tensor-parallel-size 1 \
8 --max-model-len 131072 \
9 --reasoning-parser ernie_x1 \
10 --tool-call-parser ernie_x1 \
11 --max-num-seqs 321curl -X POST "http://0.0.0.0:8180/v1/chat/completions" \
2-H "Content-Type: application/json" \
3-d $'{
4 "messages": [
5 {
6 "role": "user",
7 "content": "How \'s the weather in Beijing today?"
8 }
9 ],
10 "tools": [
11 {
12 "type": "function",
13 "function": {
14 "name": "get_weather",
15 "description": "Determine weather in my location",
16 "parameters": {
17 "type": "object",
18 "properties": {
19 "location": {
20 "type": "string",
21 "description": "The city and state e.g. San Francisco, CA"
22 },
23 "unit": {
24 "type": "string",
25 "enum": [
26 "c",
27 "f"
28 ]
29 }
30 },
31 "additionalProperties": false,
32 "required": [
33 "location",
34 "unit"
35 ]
36 },
37 "strict": true
38 }
39 }]
40}'vllm serve baidu/ERNIE-4.5-21B-A3B-Thinkingreasoning-parser and tool-call-parser for vLLM Ernie are currently under development.transformers librarytransformerslibrary (version 4.54.0 or newer) installed to use this model.1import torch
2from transformers import AutoModelForCausalLM, AutoTokenizer
3model_name = "baidu/ERNIE-4.5-21B-A3B-Thinking"
4# load the tokenizer and the model
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForCausalLM.from_pretrained(
7 model_name,
8 device_map="auto",
9 torch_dtype=torch.bfloat16,
10)
11# prepare the model input
12prompt = "Give me a short introduction to large language model."
13messages = [
14 {"role": "user", "content": prompt}
15]
16text = tokenizer.apply_chat_template(
17 messages,
18 tokenize=False,
19 add_generation_prompt=True
20)
21model_inputs = tokenizer([text], add_special_tokens=False, return_tensors="pt").to(model.device)
22# conduct text completion
23generated_ids = model.generate(
24 **model_inputs,
25 max_new_tokens=1024
26)
27output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
28# decode the generated ids
29generate_text = tokenizer.decode(output_ids, skip_special_tokens=True)
30print("generate_text:", generate_text)1@misc{ernie2025technicalreport,
2 title={ERNIE 4.5 Technical Report},
3 author={Baidu-ERNIE-Team},
4 year={2025},
5 primaryClass={cs.CL},
6 howpublished={\url{https://ernie.baidu.com/blog/publication/ERNIE_Technical_Report.pdf}}
7}