Skip to main content
MindStudio
Pricing
BlogAbout
My Workspace
run ERNIE 5.5 locallyERNIE vLLM setupERNIE SGLang

How to Run ERNIE 5.5 Flash Preview Locally With vLLM or SGLang

A deployment guide to self-hosting Baidu's ERNIE 5.5 Flash Preview, covering FP4/FP8/BF16 weights, hardware needs, and server setup.

Edited by Luis Chavez-Mattos, Director of Product RSS
How to Run ERNIE 5.5 Flash Preview Locally With vLLM or SGLang

What is ERNIE 5.5 Flash Preview and can you self-host it?

ERNIE 5.5 Flash Preview is Baidu’s open-weight Mixture-of-Experts language model, built as the first post-trained checkpoint on top of ERNIE 5.5 Flash Base. It has 280 billion total parameters with only 14 billion active per token, a 1 million-token context window, and ships in three weight formats (FP4 experts, full FP8, or BF16). Yes, you can self-host it today using either vLLM or SGLang, both of which Baidu directly supports with prebuilt images and plugins.

TL;DR

  • Three weight formats are available on Hugging Face and ModelScope: the default repo mixes blockwise FP8 with FP4 expert weights, a separate FP8 repo skips FP4 entirely, and a BF16 repo exists mainly for fine-tuning.
  • Mixture-of-Experts architecture means only 14B of the 280B total parameters activate per token, which keeps inference costs down relative to a dense model of similar size.
  • Hardware without FP4 kernels needs the FP8 or BF16 repo, since the default checkpoint assumes FP4 support on the GPU.
  • DSpark speculative decoding is baked into the released weights and ships enabled by default in both the SGLang and vLLM launch commands, cutting decode latency by proposing multiple tokens per step.
  • Context length defaults to 131,072 tokens in the example server commands but both engines support scaling up to the full 1,048,576-token window by raising a single flag.
  • Sparse attention layers (DSA) combined with a lightweight indexer give a 40% speedup at 1M-token context by limiting attention to the 2,048 highest-scoring past tokens instead of the full history.
  • Tensor parallelism and expert parallelism settings differ between the two engines, so the launch commands aren’t interchangeable without adjusting flags like --tp, --attn-dp-size, or --data-parallel-size.
Developers have their tools. Enterprises have Remy.
Developers · AI coding tools
Claude Code
Codex
Cursor
GitHub Copilot
Enterprises · built into Remy
⌂Self-hosted
✓SOC 2
✚HIPAA
☰Audit log

Which weight format should you choose?

Baidu publishes three separate repositories for ERNIE 5.5 Flash Preview, and picking the right one depends on your GPU, not just your preference:

  • ERNIE-5.5-Flash-Preview (default): blockwise FP8 for most weights, with the 512 routed experts stored in MXFP4 and run as W4A8 (4-bit weights, 8-bit activations). This is the cheapest to serve, but it requires hardware with FP4 kernel support.
  • ERNIE-5.5-Flash-Preview-FP8: blockwise FP8 throughout, no FP4 experts. This is the fallback for GPUs that support FP8 but not FP4.
  • ERNIE-5.5-Flash-Preview-BF16: full precision weights. Baidu recommends this one specifically as the starting point for fine-tuning, not for low-latency serving.

All three include the DSpark draft head for speculative decoding, and all three share the same architecture and tokenizer as ERNIE 5.5 Flash Base, so existing tooling built for the Base model should carry over without modification.

The practical rule: if your GPU has FP4 tensor core support, use the default repo for the best throughput and lowest memory footprint. If it doesn’t, drop to FP8. If you’re training or fine-tuning rather than serving, start from BF16.

What hardware do you actually need?

The model card doesn’t publish a single VRAM number, which makes sense given it’s a 280B-parameter MoE model where the exact footprint depends heavily on which weight format you load and how you split it across GPUs. What the documentation does make explicit is the serving approach: both the SGLang and vLLM example commands use multi-GPU parallelism, with --tp 4 (tensor parallel) and --attn-dp-size 4 in the SGLang case, and --data-parallel-size 4 with --enable-expert-parallel in the vLLM case.

That alone tells you this isn’t a model you run on a single consumer GPU. A 280B-parameter MoE model, even with aggressive quantization (FP4 experts, FP8 everything else, FP8 KV cache), needs a multi-GPU node to hold both the weights and a usable KV cache at longer context lengths. The example configs assume four GPUs as a baseline; scaling to the full 1M-token context window will push memory requirements higher still, since KV cache size grows with context length even with the model’s compressed attention design.

If you don’t have a multi-GPU server with FP4-capable accelerators, the realistic options are the FP8 repo on FP8-capable hardware, or renting cloud GPU capacity sized to match one of Baidu’s documented configurations (the SGLang Cookbook references a B300 hardware target for the FP8 low-latency single-node setup).

How do you deploy it with SGLang?

Baidu ships a prebuilt Docker image through lmsysorg/sglang:latest, which simplifies the setup considerably. The flow is:

  1. Launch the container with GPU access, host networking, and your Hugging Face cache mounted in:
docker run -d -it --name ernie55 \
  --gpus all \
  --network host \
  --ipc host \
  -v ~/.cache/huggingface:/root/.cache/huggingface \
  lmsysorg/sglang:latest

docker exec -it ernie55 bash
  1. Inside the container, start the server with speculative decoding and the ERNIE-specific parsers enabled:
sglang serve \
  --model-path baidu/ERNIE-5.5-Flash-Preview \
  --host 0.0.0.0 \
  --port 30000 \
  --tp 4 \
  --attn-dp-size 4 \
  --context-length 131072 \
  --max-running-requests 128 \
  --speculative-algorithm DSPARK \
  --reasoning-parser ernie55 \
  --tool-call-parser ernie55 \
  --enable-dp-lm-head \
  --trust-remote-code
› Build a safety-inspection app for 60 plants.
already included:✓ SOC 2✓ role-based access✓ audit log✓ self-hosted
The enterprise platform for building software with AI.

The --speculative-algorithm DSPARK flag turns on the draft head shipped with the model weights, and --reasoning-parser / --tool-call-parser handle the model’s thinking mode and function-calling output format. To extend past the 131K-token default, raise --context-length up to the model’s 1,048,576-token maximum.

How do you deploy it with vLLM?

vLLM requires an extra plugin since ERNIE 5.5’s architecture (Heavily Compressed Attention, sparse DSA layers, Multi-Router Latent MoE) needs custom kernel support that isn’t in vanilla vLLM yet.

uv venv --python 3.12 ernie5-venv
source ernie5-venv/bin/activate

uv pip install vllm==0.32.0
uv pip install git+https://github.com/baidu/vLLM-ERNIE.git

Then start the server:

export VLLM_ENGINE_READY_TIMEOUT_S=3600
vllm serve baidu/ERNIE-5.5-Flash-Preview \
    --trust-remote-code \
    --host 0.0.0.0 \
    --port 30000 \
    --data-parallel-size 4 \
    --enable-expert-parallel \
    --kv-cache-dtype fp8 \
    --max-model-len 131072 \
    --reasoning-parser ernie5 \
    --tool-call-parser ernie5 \
    --enable-auto-tool-choice \
    --attention-config '{"indexer_kv_dtype":"mxfp4"}' \
    --speculative-config '{"method":"dspark","num_speculative_tokens":7,"draft_sample_method":"probabilistic"}'

Notice the --speculative-config block sets num_speculative_tokens to 7, which matches Baidu’s own recommendation of using larger draft blocks (up to 7 tokens) at low concurrency. If you expect high concurrent request volume, the model card suggests shrinking that to 2-3 tokens instead, since smaller draft blocks perform better under load.

The VLLM_ENGINE_READY_TIMEOUT_S environment variable is worth noting too: a 280B-parameter MoE model takes a while to load and initialize, so the default timeout needs extending.

Is DSpark speculative decoding worth enabling?

Yes, in almost all cases, because it’s included in the model weights at no extra cost and both official launch commands enable it by default. DSpark is a draft head that proposes a block of tokens in parallel rather than one at a time, and the main model verifies that block in a single forward pass. According to Baidu’s documentation, with 7 draft steps the model reaches an average acceptance length above 5.5 on real-world multi-turn conversations, meaning more than five tokens get accepted per verification step on average.

The tradeoff is concurrency-dependent: longer draft blocks help more when you’re serving fewer simultaneous requests (because verification is cheap relative to the latency savings), while shorter blocks make more sense under high concurrency where GPU compute is already saturated. Baidu’s own guidance of 7 tokens for low concurrency and 2-3 for high concurrency lines up with this.

Frequently Asked Questions

Can ERNIE 5.5 Flash Preview run on a single GPU?

The documented launch commands for both SGLang and vLLM use four-way parallelism (--tp 4 or --data-parallel-size 4), which strongly suggests this model is designed for multi-GPU serving rather than a single card, especially given its 280B total parameter count.

What’s the difference between the FP4 default repo and the FP8 repo?

The default repo stores routed expert weights in MXFP4 and runs them as W4A8, while the FP8 repo keeps everything in blockwise FP8 with no FP4 components. Use the FP8 repo if your hardware lacks FP4 kernel support.

Do I need the BF16 weights to run inference?

No. BF16 is intended as the starting point for fine-tuning, not for serving. For inference, the FP8 or FP4 repos are lighter and faster.

How long of a context window can I actually use?

› Build a claims-review app for 400 adjusters.
already included:✓ HIPAA✓ access control✓ audit log✓ self-hosted
The enterprise platform for building software with AI.

Both SGLang and vLLM support up to the model’s full 1,048,576-token context window. The example commands cap it at 131,072 tokens by default, so you need to raise --context-length (SGLang) or --max-model-len (vLLM) to go longer.

Does enabling DSpark hurt output quality?

Baidu trains DSpark continuously alongside the main model and uses online distillation to keep acceptance rates high, with the stated goal of raising acceptance length by more than 10% in production without degrading accuracy. The company reports little loss in accuracy from using FP4 expert weights combined with DSpark.

Editorial standards

Presented by MindStudio

No spam. Unsubscribe anytime.