Run ERNIE 4.5 21B A3B on an owned Linux CPU desktop
Serve the non-Thinking post-trained text MoE using the exact Unsloth Q4_K_M derivative, publisher chat template and pinned llama.cpp 0.7.0. Allocate four CPU threads, 32 GiB RAM and 40 GiB disk for a private 4K single-sequence setup. These are planning allocations; full fit and speed are unknown.
- Hardware
- Intel Core i5-12400 desktop, 4 inference threads, 32 GiB RAM
- Runtime
- llama.cpp v0.7.0 (620d2225cc436ab0b001e3200e590e3b286ef9ab) · CPU
- Model format
- GGUF · GGUF Q4_K_M mixed quantization · Q4_K_M mixed quantization; derivative by Unsloth
- Workload
- 4,096 token context · 1 concurrent
Based on source documentation; this setup has not been executed by OpenTools. Memory: unknown. No compatible measurement available.
Read the complete setup guide
Before you start
- Use an Intel Core i5-12400 desktop (6 cores / 12 threads) with Ubuntu 24.04 x86_64, sudo and HTTPS access; allocate four inference threads, 32 GiB installed host RAM and 40 GiB free disk. Intel lists SSE4.1/SSE4.2/AVX2. Build on this same CPU with GGML_NATIVE=ON; do not copy a binary built for another CPU. RAM/disk/thread choices are author planning allocations, not vendor minimum requirements or measured fit.
- Read the Apache 2.0 publisher license. Use the exact non-Thinking post-trained PT-derived artifact; PT denotes PyTorch-format weights, not the Base checkpoint.
- This documented guide has not been executed. All weights remain CPU-resident; no measured fit, throughput or quality claim is made.
- Publisher specifies 21B total and 3B activated parameters per token, 28 layers, 64 routed experts with six selected and two shared experts. Total artifact residency still matters.
Exact model and requirements
- Artifact:
- Unsloth (quantizer); Baidu (base model) / ERNIE-4.5-21B-A3B-PT Q4_K_M · checkpoint unsloth/ERNIE-4.5-21B-A3B-PT-GGUF
- Publisher revision:
- de45a831ceac3c876bb63f39bc60406a7d07e3bb
- Artifact digest:
- sha256:eac44e96282fee37140f82f435d4c37c4ec0edd42fe5d93f09e6ed8786a6cff0
- Download size:
- 12.42 GiB
- Memory requirement (unknown):
- Unknown — No exact full-process peak-memory evidence for this Q4_K_M configuration.
- System RAM / disk:
- Unknown / Unknown
- Placement:
- single device. One CPU host; no tensor/pipeline sharding. CPU-only execution; --device none and zero GPU layers. No disk or accelerator offload.
- KV cache:
- F16 K and V attention cache
- Workload:
- 4,096 token context; Unknown; Unknown; concurrency 1; batch 1; cache unknown; repetitions Unknown.
- Tokenizer:
- Embedded ERNIE GGUF tokenizer with exact pinned Baidu PT chat template override · 87db95487941cb39592ee0abca3b9155a6d19c5c
- Sampling / reasoning:
- temperature 0.8, top_p 0.8, repeat_penalty 1.0, frequency/presence penalties 0; top_k 0 and min_p 0 disable extra filters. Validation output cap 128; author short workload. Non-Thinking post-trained text checkpoint. Native User:/Assistant: template, no thinking parser, tools or multimodal input.
- Runtime prerequisites:
- Ubuntu 24.04 x86_64; See prerequisites above.
Baidu publisher and Unsloth derivative metadata declare Apache 2.0. Preserve the license and required notices, identify modifications and review patent/NOTICE conditions for redistribution. This is an Unsloth quantization, not a Baidu-published GGUF.
- The complete 21B-total-parameter MoE artifact includes routed and shared expert weights; 3B active per token does not imply 3B storage or RAM.
- The 13,331,015,456-byte file excludes runtime buffers, attention cache, OS and other allocations. 32 GiB RAM and 40 GiB disk are author resource choices, not measured minimums or fit guarantees.
One-time setup and hardware
- hardware
- Unknown — Existing desktop purchase price and incremental hardware cost depend on the reader; unknown.
- Existing desktop purchase price and incremental hardware cost depend on the reader; unknown. Tax: unknown.
- setup
- Unknown — Initial provisioning/build time and labor cost are unknown.
- Initial provisioning/build time and labor cost are unknown. Tax: unknown.
Recurring costs
- electricity
- Unknown — Actual wall power, electricity rate and powered hours are unknown; no TDP-to-wall-power conversion.
- Actual wall power, electricity rate and powered hours are unknown; no TDP-to-wall-power conversion. Tax: unknown.
- storage
- Unknown — Incremental cost of local disk capacity is unknown. The 40 GiB free-disk walkthrough allocation is an author choice, not a measured requirement.
- Incremental cost of local disk capacity is unknown. The 40 GiB free-disk walkthrough allocation is an author choice, not a measured requirement. Tax: unknown.
- egress
- Unknown — Data transfer price, allowances and traffic volume are unknown.
- Data transfer price, allowances and traffic volume are unknown. Tax: unknown.
- administration
- Unknown — Maintenance labor rate and hours are unknown.
- Maintenance labor rate and hours are unknown. Tax: unknown.
Install the runtime
1. Build the pinned CPU server
Install build dependencies and compile the exact official source revision. These packages are system shared dependencies; no CUDA/GPU driver is required. GGML_NATIVE=ON selects -march=native for this GNU/Linux x86 build, compiling for the host CPU. Build and run on the same machine; no AVX-512 requirement is imposed on the i5-12400.
Commandsudo apt-get update sudo apt-get install -y build-essential cmake git curl ca-certificates openssl mkdir -p "$HOME/ernie45-hosting/models" cd "$HOME/ernie45-hosting" git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp git checkout --detach 620d2225cc436ab0b001e3200e590e3b286ef9ab cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_METAL=OFF -DGGML_NATIVE=ON cmake --build build --config Release -j 4 ./build/bin/llama-server --versionExpected result: Build succeeds and server version identifies pinned source. Stop if checkout or build fails.
Download the model
1. Download and verify the exact GGUF
Download the complete Unsloth derivative, then fetch the independently pinned Baidu chat template. Metadata reports public ungated repositories. Do not substitute Thinking, Base or Paddle weights.
Commandcd "$HOME/ernie45-hosting" curl --fail --location --output models/ERNIE-4.5-21B-A3B-PT-Q4_K_M.gguf 'https://huggingface.co/unsloth/ERNIE-4.5-21B-A3B-PT-GGUF/resolve/de45a831ceac3c876bb63f39bc60406a7d07e3bb/ERNIE-4.5-21B-A3B-PT-Q4_K_M.gguf' printf '%s %s\n' 'eac44e96282fee37140f82f435d4c37c4ec0edd42fe5d93f09e6ed8786a6cff0' 'models/ERNIE-4.5-21B-A3B-PT-Q4_K_M.gguf' | sha256sum --check curl --fail --location --output ernie-chat.jinja 'https://huggingface.co/baidu/ERNIE-4.5-21B-A3B-PT/raw/87db95487941cb39592ee0abca3b9155a6d19c5c/chat_template.jinja' printf '%s %s\n' '471fb571976770318fe6f27749e37940be8d29c0a7770558140f141f5906f2a2' 'ernie-chat.jinja' | sha256sum --checkExpected result: Both SHA-256 checks report OK; GGUF size 13,331,015,456 bytes. Stop on mismatch.
Configure
1. Create a private service credential
Generate this only on your own host when following the guide. It is a local service password, not an OpenAI/provider credential. Keep it private and never paste it into tickets. Create it only when absent; preserve an existing key so a repeated setup does not silently rotate access. It is not created during this documentation run.
Commandcd "$HOME/ernie45-hosting" umask 077 if [ ! -e .api-key ]; then openssl rand -hex 32 > .api-key fi test -s .api-key || { echo 'Existing .api-key is empty; restore it before continuing.'; exit 1; } chmod 600 .api-keyExpected result: A non-empty private .api-key file exists; existing key preserved. No secret is printed.
Start the model
1. Start one CPU-only sequence
Use the native ERNIE4.5 MoE implementation at the pinned runtime revision. Force the exact Baidu User:/Assistant: chat template through Jinja, with one CPU slot and 4,096 total context tokens. Reserve 128 tokens for output. No thinking parser, tool executor or accelerator is configured.
Commandcd "$HOME/ernie45-hosting" export ERNIE45_SERVICE_KEY="$(cat .api-key)" ./llama.cpp/build/bin/llama-server -m models/ERNIE-4.5-21B-A3B-PT-Q4_K_M.gguf --alias ernie45-21ba3b --host 127.0.0.1 --port 8080 --api-key "$ERNIE45_SERVICE_KEY" --device none -ngl 0 -t 4 -c 4096 -np 1 --cache-type-k f16 --cache-type-v f16 --jinja --chat-template-file ernie-chat.jinja --reasoning off --temp 0.8 --top-k 0 --top-p 0.8 --min-p 0.0 --repeat-penalty 1.0 --frequency-penalty 0.0 --presence-penalty 0.0Expected result: Model initializes and listener starts. Pass health and authenticated chat checks before relying on the service. Command-line credentials may be visible to privileged/local users; trusted host required.
Connect to your endpoint
http://127.0.0.1:8080/v1
Same desktop loopback only; no LAN/public listener. Use on a trusted single-user host.
Access: loopback. Reader-generated private service key in Authorization: Bearer header for chat; /health is public on loopback. Run the client on this same desktop. Keep the key private; this is not an OpenAI API key.
Verify the setup
1. Check readiness and authenticated text generation
Run checks from a second terminal on the server. Health is public on loopback. Check the authenticated chat’s non-empty final content against the supplied passage and ensure finish_reason is not length; no exact wording is guaranteed. This is a short functional summarization check, not a quality benchmark.
Commandcd "$HOME/ernie45-hosting" export ERNIE45_SERVICE_KEY="$(cat .api-key)" curl --fail http://127.0.0.1:8080/health curl --fail http://127.0.0.1:8080/v1/chat/completions -H "Authorization: Bearer $ERNIE45_SERVICE_KEY" -H 'Content-Type: application/json' -d '{"model":"ernie45-21ba3b","messages":[{"role":"user","content":"Summarize this supplied passage in one sentence without adding facts: The community library opens at 9am on weekdays and closes at 6pm. On Saturday it opens at 10am and closes at 4pm. It is closed on Sunday."}],"max_tokens":128,"temperature":0.8,"top_k":0,"top_p":0.8,"min_p":0.0,"repeat_penalty":1.0}' curl -o /dev/null -s -w '%{http_code}\n' http://127.0.0.1:8080/v1/chat/completions -H 'Content-Type: application/json' -d '{"model":"ernie45-21ba3b","messages":[{"role":"user","content":"Hello"}]}'Expected result: Health HTTP 200 when ready; authorized response contains non-empty choices[0].message.content accurately summarizing the supplied opening hours, with finish_reason not length; unauthorized chat returns HTTP 401. Inspect facts yourself; generated text can be wrong.
Performance evidence
No compatible measurement available. Documented support and estimated memory do not establish response speed.
Limits and troubleshooting
- Documented architecture support only. Exact full-process memory, fit, latency, throughput and answer quality are unknown. No model execution occurred.
- This is the text post-trained non-Thinking checkpoint. Publisher overview lists 21B total / 3B active per token. Training-family multimodal discussion does not make this text model a vision guide.
- The source config supports 131,072 positions; this recipe deliberately configures 4,096 combined prompt/output tokens, one sequence and a 128-token validation output cap.
- Baidu generation_config gives temperature 0.8, top_p 0.8, repetition penalty 1.0 and zero frequency/presence penalties. Additional top-k/min-p filtering is disabled explicitly. No sibling sampler or speed is transferred.
- Native template emits begin-of-sentence, User:, Assistant: and end-of-sentence tokens. The pinned original template is explicitly loaded; do not replace it with a generic or Thinking template.
- 32 GiB RAM and 40 GiB disk are planning allocations, not measured requirements. Full experts and runtime state remain relevant despite 3B active computation.
- System packages and build dependencies resolve at installation. Save versions and build logs on execution; build GGML_NATIVE on the same CPU used for inference.
- The quantizer is Unsloth; its own derivative card and metadata link the Baidu base and Apache 2.0 license. Quantization quality has not been measured here.
- Loopback and a private service key require a trusted host. Shared/public production access needs separately designed isolation, TLS and operations.
- Whole-model coverage is not final; this pair documents one useful private CPU text configuration.
- Download or checksum failure
- Check exact pinned Unsloth GGUF and Baidu template URLs, filename case and both hashes. Do not serve mismatched bytes.
- Unsupported architecture or build failure
- Use exact llama.cpp commit 620d2225cc436ab0b001e3200e590e3b286ef9ab with native ERNIE4.5 MoE support. Do not silently substitute an older package.
- Out of memory or context overflow
- Stop the service and inspect host memory. Shorten prompt/output within 4,096 total tokens or explicitly change allocation. Full fit remains unknown.
- HTTP 401 or connection refused
- Check foreground server startup, loopback port 8080 and matching Bearer service key. Run the client on the same desktop.
- Poor or truncated summary
- Confirm non-Thinking PT-derived GGUF, exact publisher template and sampler. Inspect finish_reason and supplied facts. Increase output cap only within total context and record the changed workload; smoke checks do not establish reliable quality.
Stop the model
1. Stop the service
Press Ctrl+C in server terminal. Unset key in each shell. Confirm this desktop localhost:8080 no longer serves the model.
Commandunset ERNIE45_SERVICE_KEYExpected result: Server stops and localhost:8080 stops serving.
Uninstall
1. Remove dedicated model, build and credential files
Back up wanted logs/files first. Remove only this walkthrough directory after confirming its path. Shared apt packages can remain; do not remove other workloads.
Commandrm -r -- "$HOME/ernie45-hosting"Expected result: Dedicated files and local service credential removed; shared system dependencies remain.
Sources and verification
Sources checked Oct 16, 2026. Verification source
- https://huggingface.co/baidu/ERNIE-4.5-21B-A3B-PT/raw/87db95487941cb39592ee0abca3b9155a6d19c5c/README.mdpublisher · retrieved Oct 16, 2026 · revision 87db95487941cb39592ee0abca3b9155a6d19c5c
- https://huggingface.co/baidu/ERNIE-4.5-21B-A3B-PT/raw/87db95487941cb39592ee0abca3b9155a6d19c5c/config.jsonpublisher · retrieved Oct 16, 2026 · revision 87db95487941cb39592ee0abca3b9155a6d19c5c
- https://huggingface.co/baidu/ERNIE-4.5-21B-A3B-PT/raw/87db95487941cb39592ee0abca3b9155a6d19c5c/generation_config.jsonpublisher · retrieved Oct 16, 2026 · revision 87db95487941cb39592ee0abca3b9155a6d19c5c
- https://huggingface.co/baidu/ERNIE-4.5-21B-A3B-PT/raw/87db95487941cb39592ee0abca3b9155a6d19c5c/chat_template.jinjapublisher · retrieved Oct 16, 2026 · revision 87db95487941cb39592ee0abca3b9155a6d19c5c
- https://huggingface.co/baidu/ERNIE-4.5-21B-A3B-PT/raw/87db95487941cb39592ee0abca3b9155a6d19c5c/LICENSEpublisher · retrieved Oct 16, 2026 · revision 87db95487941cb39592ee0abca3b9155a6d19c5c
- https://huggingface.co/api/models/unsloth/ERNIE-4.5-21B-A3B-PT-GGUFpublisher · retrieved Oct 16, 2026
- https://huggingface.co/api/models/unsloth/ERNIE-4.5-21B-A3B-PT-GGUF/tree/de45a831ceac3c876bb63f39bc60406a7d07e3bb?recursive=true&expand=falsepublisher · retrieved Oct 16, 2026 · revision de45a831ceac3c876bb63f39bc60406a7d07e3bb
- https://huggingface.co/unsloth/ERNIE-4.5-21B-A3B-PT-GGUF/raw/de45a831ceac3c876bb63f39bc60406a7d07e3bb/README.mdpublisher · retrieved Oct 16, 2026 · revision de45a831ceac3c876bb63f39bc60406a7d07e3bb
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/src/models/ernie4-5-moe.cppruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/conversion/ernie.pyruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/common/chat.cppruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/common/arg.cppruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab
- https://www.intel.com/content/www/us/en/products/sku/134586/intel-core-i512400-processor-18m-cache-up-to-4-40-ghz/specifications.htmlmanufacturer · retrieved Oct 16, 2026
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/ggml/src/ggml-cpu/CMakeLists.txtruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab
- https://docs.liquid.ai/lfm/inference/llama-cppruntime maintainer · retrieved Oct 16, 2026
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/docs/build.mdruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab
- https://raw.githubusercontent.com/ggml-org/llama.cpp/620d2225cc436ab0b001e3200e590e3b286ef9ab/tools/server/README.mdruntime maintainer · retrieved Oct 16, 2026 · revision 620d2225cc436ab0b001e3200e590e3b286ef9ab
- https://api.github.com/repos/ggml-org/llama.cpp/releases/latestruntime maintainer · retrieved Oct 16, 2026