ERNIE 4.5

View as Markdown

ERNIE 4.5 is Baidu’s dense and Mixture-of-Experts language model family with long-context text checkpoints on Hugging Face.

TaskText Generation
ArchitecturesErnie4_5ForCausalLM, Ernie4_5_MoeForCausalLM
Parameters0.36B dense; 21B total / 3B active MoE
Context Length131,072 tokens
HF Orgbaidu

Available Models

  • ERNIE-4.5-0.3B-PT: dense text checkpoint with 0.36B parameters.
  • ERNIE-4.5-21B-A3B-PT: text MoE checkpoint with 21B total parameters and 3B activated parameters per token.

Architectures

  • Ernie4_5ForCausalLM: dense Hugging Face implementation path.
  • Ernie4_5_MoeForCausalLM: custom NeMo AutoModel implementation with expert parallelism support.

Example HF Models

ModelHF ID
ERNIE 4.5 0.3B PTbaidu/ERNIE-4.5-0.3B-PT
ERNIE 4.5 21B A3B PTbaidu/ERNIE-4.5-21B-A3B-PT

Example Recipes

RecipeDescription
ernie4_5_0p3b_hellaswag.yamlSFT — ERNIE 4.5 0.3B on HellaSwag with the Hugging Face implementation
ernie4_5_21b_a3b_hellaswag.yamlSFT — ERNIE 4.5 21B A3B on HellaSwag with TE attention and DeepEP

Try with NeMo AutoModel

1. Install (full instructions):

$pip install nemo-automodel

2. Clone the repo to get the example recipes:

$git clone https://github.com/NVIDIA-NeMo/Automodel.git
$cd Automodel

3. Run a dense recipe from inside the repo:

$automodel --nproc-per-node=8 examples/llm_finetune/ernie4_5/ernie4_5_0p3b_hellaswag.yaml

4. Run the MoE recipe from inside the repo:

$automodel --nproc-per-node=8 examples/llm_finetune/ernie4_5/ernie4_5_21b_a3b_hellaswag.yaml

1. Pull the container and mount a checkpoint directory:

$docker run --gpus all -it --rm \
> --shm-size=8g \
> -v $(pwd)/checkpoints:/opt/Automodel/checkpoints \
> nvcr.io/nvidia/nemo-automodel:26.06.00

2. Navigate to the AutoModel directory:

$cd /opt/Automodel

3. Run the recipe:

$automodel --nproc-per-node=8 examples/llm_finetune/ernie4_5/ernie4_5_21b_a3b_hellaswag.yaml

See the LLM Fine-Tuning Guide and the Large MoE Fine-Tuning Guide.

Hugging Face Model Cards