DEV Community

Cover image for Running GLM-5.3-Flash Locally: Memory Budgets, Runtime Choices, and Working Commands
Ryan Cole
Ryan Cole

Posted on Originally published at cometapi.com

Running GLM-5.3-Flash Locally: Memory Budgets, Runtime Choices, and Working Commands

The first number I would check before deploying GLM-5.3-Flash is 306 GiB: the approximate size of its native FP8 weights. Its 18B active parameters per token describe compute usage, but the full model has about 320B parameters that still need somewhere to live.

The weights are available under the MIT license. Local deployment is possible; the useful question is which combination of RAM, VRAM, quantization, and runtime makes sense for your workload.

My starting point:

  • Server GPUs: vLLM or SGLang.
  • Hundreds of gigabytes of RAM plus consumer GPUs: KTransformers.
  • Quantized workstation experiments: llama.cpp or Ollama.

A 24 GB or 32 GB GPU cannot hold the model alone. Single-GPU deployment relies on system RAM, offloading, and possibly quantization.

Budget for the checkpoint and the requests

The official vLLM recipe puts native FP8 weights at approximately 306 GiB. KTransformers recommends at least 350 GB of available system memory for its native FP8 CPU-GPU path.

GGUF gives you more sizing options. These are approximate model-file sizes, not total runtime requirements:

Quantization Model size How I would budget
BF16 642 GB Server-class memory
Q8_0 341 GB Large-memory server or workstation
Q6_K_XL 292 GB High-memory workstation/server
Q5_K_XL 240 GB 256 GB RAM is likely too tight after overhead
Q4_K_XL 200 GB Roughly 256 GB+ system-memory class
IQ4_XS 157 GB More realistically a 192–256 GB-class system
Q3_K_XL 148 GB Large-memory workstation, with a growing quality trade-off
Q2_K_XL 109 GB 128 GB leaves little room beyond the file
IQ2_XXS 102 GB Aggressive compression
IQ1_S 93.1 GB Extreme compression; task-specific validation required

Those planning notes are not official minimum specifications. Runtime buffers, metadata, multimodal components, KV cache, and the operating system all need memory. Context length, concurrency, GPU offload, and the quantization implementation change the actual fit.

For a machine with 32–64 GB of system RAM, I would choose a smaller model or hosted access. At 128 GB, the smallest GGUF builds approach the available capacity, but predictable quality and long context are difficult targets. Around 256 GB or more, Q4_K_XL becomes a more practical starting point.

Why 18B active parameters does not solve the memory problem

GLM-5.3-Flash routes each token through only part of its expert capacity. Its hybrid linear and sparse attention, including IndexPool, also reduces long-context costs.

Z.ai reports lower attention compute and KV-cache usage than GLM-5.3. That helps, but cache still grows with context and concurrent requests. A deployment that works at 8K can run out of memory on a much longer conversation.

The official model card lists the following:

Property Value
Architecture Native multimodal Mixture-of-Experts
Total / active parameters 320B / 18B per token
Language-model layers 45
Attention Hybrid linear + sparse attention with IndexPool
Maximum context 1,048,576 tokens
Training corpus 30T multimodal tokens
Inputs / output Text, images, video, files / text
Weights and license Open weights, MIT
Official model ID zai-org/GLM-5.3-Flash
Reasoning effort low, high, max; default max

I would configure context around the application’s actual input size. Allocating the full supported window during initial setup makes memory debugging harder.

Start with GGUF for workstation experiments

For a local experiment, I would start here unless matching the native checkpoint is a requirement. Unsloth publishes GGUF builds ranging from 1-bit through BF16.

llama.cpp offers CPU-GPU offloading; Ollama provides a short launch command. Both still need enough total memory for the selected build.

llama.cpp

Install on macOS or Linux:

curl -LsSf https://llama.app/install.sh | sh
Enter fullscreen mode Exit fullscreen mode

On Windows:

winget install llama.cpp
Enter fullscreen mode Exit fullscreen mode

Start the Q4_K_XL server:

llama serve -hf unsloth/GLM-5.3-Flash-GGUF:UD-Q4_K_XL
Enter fullscreen mode Exit fullscreen mode

Or run it directly in the terminal:

llama cli -hf unsloth/GLM-5.3-Flash-GGUF:UD-Q4_K_XL
Enter fullscreen mode Exit fullscreen mode

This build is about 200 GB. Before starting the download, check the quantization tag, repository file size, and available disk space.

Ollama

Unsloth documents direct Hugging Face loading:

ollama run hf.co/unsloth/GLM-5.3-Flash-GGUF:UD-Q4_K_XL
Enter fullscreen mode Exit fullscreen mode

The memory budget is the same underlying problem regardless of how short the command is.

If Q4 does not fit, 3-bit, 2-bit, and 1-bit builds exist. I would select the highest-quality quantization that leaves room for runtime buffers and cache, then compare it against a native or hosted reference.

Aggressive quantization can affect reasoning reliability, generated code, tool-call formatting, and multimodal behavior. A model that loads has passed only the capacity check.

Use KTransformers when the weights belong in system RAM

KTransformers reads the official FP8 weights directly and distributes expert inference across CPU and GPU. This is the route I would investigate for a workstation with very large RAM capacity and one or more consumer GPUs.

The GLM-5.3-Flash tutorial documents:

  • Approximately 306 GiB of FP8 weights and a recommendation for 350 GB of available system memory.
  • NVIDIA SM89 and SM120 support, including RTX 40- and 50-series GPUs.
  • AVX-512 FP8 CPU expert kernels.
  • Single-GPU and four-GPU configurations.

An RTX 4090 or RTX 5090 can participate, but most model state still sits outside VRAM. CPU capability, RAM bandwidth, and memory placement matter considerably.

Install and prepare the checkpoint

Create a Python 3.11 environment and install the SGLang integration:

conda create -n glm53flash python=3.11 -y
conda activate glm53flash

pip install "ktransformers[sglang]"
Enter fullscreen mode Exit fullscreen mode

Download zai-org/GLM-5.3-Flash to local storage. Allow sufficient disk space for the checkpoint and available RAM for the server configuration.

Launch the documented single-GPU configuration

MODEL_PATH=/path/to/GLM-5.3-Flash

CUDA_VISIBLE_DEVICES=0 python -m sglang.launch_server \
  --model-path "$MODEL_PATH" \
  --kt-weight-path "$MODEL_PATH" \
  --served-model-name GLM-5.3-flash \
  --host 0.0.0.0 \
  --tp-size 1 \
  --context-length 501025 \
  --mem-fraction-static 0.65 \
  --chunked-prefill-size 2048 \
  --kt-method FP8 \
  --kt-cpuinfer 64 \
  --kt-threadpool-count 2 \
  --kt-num-gpu-experts 0 \
  --kt-gpu-prefill-token-threshold 2048 \
  --cuda-graph-bs 1 2 4 \
  --limit-mm-data-per-request '{"image":8,"video":1}' \
  --mm-process-config '{"image":{"max_pixels":1254400}}' \
  --tool-call-parser glm47 \
  --reasoning-parser glm45
Enter fullscreen mode Exit fullscreen mode

The tutorial validates this 501,025-token configuration. The model’s 1,048,576-token limit does not mean every deployment should allocate that much context.

Check discovery:

curl http://localhost:30000/v1/models
Enter fullscreen mode Exit fullscreen mode

The OpenAI-compatible chat endpoint is http://localhost:30000/v1/chat/completions. This launch command serves the model as GLM-5.3-flash, so use that identifier for chat requests.

If generation is extremely slow, investigate NUMA placement, RAM bandwidth, CPU instruction support, and storage behavior during loading. With substantial expert work on the CPU, memory capacity alone does not guarantee usable interactive performance.

Serve native weights on GPU infrastructure

For production serving, I would start with vLLM when throughput and ecosystem compatibility dominate. SGLang is also worth testing for agent workloads, structured generation, multimodal requests, and concurrency.

Both serve the native checkpoint and support strong multi-GPU scaling. Their focus on CPU offload is more limited than KTransformers or llama.cpp.

vLLM

Use Linux, a supported NVIDIA stack, sufficient aggregate GPU memory, and a recent supported vLLM build or the container specified in the current recipe.

pip install vllm

vllm serve "zai-org/GLM-5.3-Flash" \
  --tensor-parallel-size 8 \
  --served-model-name zai-org/GLM-5.3-Flash
Enter fullscreen mode Exit fullscreen mode

This is a reference launch configuration. Eight GPUs do not automatically imply enough usable memory or support for every feature.

Verify the endpoint:

curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/GLM-5.3-Flash",
    "messages": [
      {"role": "user", "content": "Reply with OK"}
    ]
  }'
Enter fullscreen mode Exit fullscreen mode

The vLLM recipe also covers FP8 KV cache on supported Blackwell systems, MTP speculative decoding, tool and reasoning parsers, and prefill/decode disaggregation. I would take those flags from the current recipe because support changes quickly.

SGLang

Install:

pip install sglang
Enter fullscreen mode Exit fullscreen mode

Launch:

python3 -m sglang.launch_server \
  --model-path "zai-org/GLM-5.3-Flash" \
  --host 0.0.0.0 \
  --port 30000
Enter fullscreen mode Exit fullscreen mode

Verify:

curl -X POST "http://localhost:30000/v1/chat/completions" \
  -H "Content-Type: application/json" \
  --data '{
    "model": "zai-org/GLM-5.3-Flash",
    "messages": [{"role": "user", "content": "Give me three local deployment checks."}]
  }'
Enter fullscreen mode Exit fullscreen mode

The official model card includes multimodal SGLang examples. For tool calling, check the parser configuration for the current integration. Parser flags from an older GLM release are not a reliable template.

Test the application contract before tuning throughput

I would validate a deployment in this order: text generation, intended context length, tool schemas, multimodal inputs, and concurrent traffic.

For the vLLM endpoint above:

curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org/GLM-5.3-Flash",
    "messages": [
      {"role": "user", "content": "Return exactly: LOCAL_OK"}
    ],
    "reasoning_effort": "low"
  }'
Enter fullscreen mode Exit fullscreen mode

Adjust the port and served model name for your runtime.

The model defaults to reasoning_effort: "max". Keep max when reproducing benchmarks. For workstation iteration, low or high can be more practical.

My acceptance checks would include:

Check What to exercise
Context A document or repository-sized prompt near the application’s intended limit
Tools Argument JSON, tool selection, repeated calls, recovery from tool errors
Multimodal Actual image/video formats and resolution ranges
Concurrency Latency and memory with multiple active requests
Quantization Identical prompts against the selected GGUF and a native or hosted reference

Separate memory tuning from latency tuning

To reduce memory pressure, lower configured context and concurrency first. A small concurrency target with an explicit queue can suit a workstation better than server-style parallelism.

Quantization reduces weight memory. CPU offload moves substantial model state into RAM, shifting performance pressure toward the CPU and memory bandwidth.

Lowering reasoning_effort can shorten generated reasoning, reduce latency, and consume fewer tokens. It does not reduce the memory needed to load the weights. Any cache savings are indirect, from generating a shorter sequence.

Diagnose failures by when they happen

Symptom First checks
Loads, then crashes on a long prompt KV-cache headroom; reduce context and concurrency, then increase gradually
GGUF fits on disk but fails in RAM Runtime buffers, cache, operating-system headroom
Single-GPU KTransformers is too slow NUMA, RAM bandwidth, CPU support, CPU expert workload
Tool calls contain malformed JSON Current runtime parser configuration
Download is hundreds of gigabytes Expected file size and selected quantization tag

I would monitor both system RAM and GPU memory while increasing workload size. Otherwise, it is easy to mistake a successful checkpoint load for a viable serving configuration.

Decide whether the capability justifies the deployment

The benchmark case for this model is mainly coding, tool-driven automation, long-context document work, and multimodal workflows.

These are Z.ai’s reported scores, not measurements from a local quantized deployment:

Benchmark GLM-5.3-Flash GLM-5.2 Difference
Terminal-Bench 2.1 84.3 81.0 +3.3
DeepSWE v1.1 63.4 46.2 +17.2
NL2Repo 56.3 48.9 +7.4
Toolathlon Verified 78.4 59.9 +18.5
AutomationBench v1.0.6 48.8 26.2 +22.6
Agents' Last Exam 26.3 20.4 +5.9
HLE with Tools 55.3 54.7 +0.6
GDPval-AA v2 1773 1504 +269 Elo

I would use those results to decide what to evaluate locally, then let workload-specific tests determine whether the hardware and operating costs are justified.

Where hosted access fits

Self-hosting gives control over data residency, offline operation, quantization, and inference settings. It also makes hardware capacity, maintenance, and scaling your responsibility.

Hosted access removes the upfront hardware requirement and provider-side maintenance, but sends data to the selected service, uses provider-selected quantization, and scales within provider limits.

If I needed a unified multi-model API for reference comparisons or a fallback during deployment work, CometAPI provides an OpenAI-compatible endpoint using model ID glm-5.3-flash:

from openai import OpenAI
import os

client = OpenAI(
    base_url="https://api.cometapi.com/v1",
    api_key=os.environ["COMETAPI_KEY"],
)

response = client.chat.completions.create(
    model="glm-5.3-flash",
    messages=[{"role": "user", "content": "Reply with OK"}],
)

print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

Local hosting can make financial sense with suitable owned hardware, consistently high utilization, or a firm requirement to keep data inside your infrastructure. For intermittent workloads, I would weigh the fixed hardware and operational burden carefully.

My deployment gate would be concrete: the chosen checkpoint fits with headroom, the runtime handles the required tools and inputs, and latency stays acceptable at the intended context and concurrency. Until those checks pass, a running server is still an experiment.


Originally published at cometapi.com

Top comments (0)