zai-org

GLM-4.7-Flash

31.2B parameters · mixture-of-experts · reasoning · Base · GLM family

mit hash verified source matched revision pinned
Good for: Long context

Which version should I download?

Default pick: GGUF · Q4_K_M — Standard 4-bit (Q4_K_M) accessible lead for GLM-4.7-Flash (31B-A? MoE, ~18 GB single file). MIT.

Set your rig to confirm it fits and to see if a higher-quality quant runs fully on your hardware.

Set your rig

GGUF · IQ4_XS

15.15 GB

Est. speed
Swarm
2S / 0L webseed OK

Low-bit 4-bit option (IQ4_XS) for GLM-4.7-Flash (31.221B MoE). MIT.

GGUF · Q4_K_M

17.05 GB

Est. speed
Swarm
2S / 0L webseed OK

Standard 4-bit (Q4_K_M) accessible lead for GLM-4.7-Flash (31B-A? MoE, ~18 GB single file). MIT.

GGUF · Q5_K_M

19.94 GB

Est. speed
Swarm
2S / 0L webseed OK

5-bit option (Q5_K_M) for GLM-4.7-Flash (31.221B MoE). MIT.

GGUF · Q6_K

23.00 GB

Est. speed
Swarm
2S / 0L webseed OK

6-bit option (Q6_K) for GLM-4.7-Flash (31.221B MoE). MIT.

GGUF · Q8_0

29.66 GB

Est. speed
Swarm
2S / 0L webseed OK

near-lossless 8-bit option (Q8_0) for GLM-4.7-Flash (31.221B MoE). MIT.

Want a different quant? Request it on the board →

Runs fully on

Green = the model's best quant fits fully in GPU/unified memory at 8K context. Tap a card for its full "what runs on it" page.

Context

Advertised 198k · usable ≈ 198k (reported — maintainer docs)

How we know

Evidence grade: reported — a maintainer claim with no independent evaluation.

Z.ai developer docs: context 200K, max output 128K. Card publishes capability benchmarks only; no long-context evals.

Reviewed on Jul 18, 2026.

Capabilities (as declared by the maintainer): reasoning tool calling

Run it

Runtime completeness (IQ4_XS torrent): llama.cpp ✅ Ollama – vision sidecar –

  • Ollama — runs the GGUF directly; no Modelfile bundled
  • vision sidecar — not a vision model

Context / KV 8,192 tokens · FP16 set above the quant table

Generic commands (no rig set). GPU-offload values assume the model fits on your GPU — set your rig for values tuned to your hardware.

Start the server
llama-server -m GLM-4.7-Flash-IQ4_XS.gguf -c 8192 -ngl 999

Use llama-cli in place of llama-server for a one-shot prompt. This model compresses its KV cache, but only on llama.cpp b5137 (April 2025) or newer AND a GGUF converted after that date. Older files -- including some still-popular DeepSeek-R1 and V3-0324 quants -- fall back to the uncompressed layout and use about 5 MB per token instead of 70 KB. Check the quant repo date if long context is the point.

Save as Modelfile next to the GGUF (Modelfile)
FROM ./GLM-4.7-Flash-IQ4_XS.gguf
PARAMETER num_ctx 8192
PARAMETER num_gpu 999
PARAMETER stop "<|endoftext|>"
PARAMETER stop "<|user|>"
PARAMETER stop "<|observation|>"
PARAMETER temperature 1
# Chat template: Ollama uses the template embedded in the GGUF (no TEMPLATE directive needed).
Create
ollama create zai-org-glm-4-7-flash -f Modelfile
Run
ollama run zai-org-glm-4-7-flash

GGUF is not a first-class vLLM format.

vLLM GGUF support is experimental and single-file only; prefer safetensors/GPTQ/AWQ for production. If you must, pass the .gguf path to `vllm serve` with --load-format gguf on a recent vLLM.

transformers does not load GGUF weights.

GGUF weights run under llama.cpp, Ollama or LM Studio.

Load GLM-4.7-Flash-IQ4_XS.gguf, set the context length to 8192 tokens. Set GPU offload to Max (all layers).

MLX runs MLX-format weights only (Apple Silicon). This quant is a GGUF build.

GGUF weights run under llama.cpp, Ollama or LM Studio.

Technical details

Chat template

[gMASK]<sop>
{%- if tools -%}
<|system|>
# Tools

You may call one or more functions to assist with the user query.

You are provided with function signatures within <tools></tools> XML tags:
<tools>
{% for tool in tools %}
{{ tool | tojson(ensure_ascii=False) }}
{% endfor %}
</tools>

For each function call, output the function name and arguments within the following XML format:
<tool_call>{function-name}<arg_key>{arg-key-1}</arg_key><arg_value>{arg-value-1}</arg_value><arg_key>{arg-key-2}</arg_key><arg_value>{arg-value-2}</arg_value>...</tool_call>{%- endif -%}
{%- macro visible_text(content) -%}
    {%- if content is string -%}
        {{- content }}
    {%- elif content is iterable and content is not mapping -%}
        {%- for item in content -%}
            {%- if item is mapping and item.type == 'text' -%}
                {{- item.text }}
            {%- elif item is string -%}
                {{- item }}
            {%- endif -%}
        {%- endfor -%}
    {%- else -%}
        {{- content }}
    {%- endif -%}
{%- endmacro -%}
{%- set ns = namespace(last_user_index=-1) %}
{%- for m in messages %}
    {%- if m.role == 'user' %}
        {% set ns.last_user_index = loop.index0 -%}
    {%- endif %}
{%- endfor %}
{% for m in messages %}
{%- if m.role == 'user' -%}<|user|>{{ visible_text(m.content) }}
{%- elif m.role == 'assistant' -%}
<|assistant|>
{%- set reasoning_content = '' %}
{%- set content = visible_text(m.content) %}
{%- if m.reasoning_content is string %}
    {%- set reasoning_content = m.reasoning_content %}
{%- else %}
    {%- if '</think>' in content %}
        {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
        {%- set content = content.split('</think>')[-1].lstrip('\n') %}
    {%- endif %}
{%- endif %}
{%- if ((clear_thinking is defined and not clear_thinking) or loop.index0 > ns.last_user_index) and reasoning_content -%}
{{ '<think>' + reasoning_content.strip() +  '</think>'}}
{%- else -%}
{{ '</think>' }}
{%- endif -%}
{%- if content.strip() -%}
{{ content.strip() }}
{%- endif -%}
{% if m.tool_calls %}
{% for tc in m.tool_calls %}
{%- if tc.function %}
    {%- set tc = tc.function %}
{%- endif %}
{{- '<tool_call>' + tc.name -}}
{% set _args = tc.arguments %}{% for k, v in _args.items() %}<arg_key>{{ k }}</arg_key><arg_value>{{ v | tojson(ensure_ascii=False) if v is not string else v }}</arg_value>{% endfor %}</tool_call>{% endfor %}
{% endif %}
{%- elif m.role == 'tool' -%}
{%- if m.content is string -%}
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
    {{- '<|observation|>' }}
{%- endif %}
{{- '<tool_response>' }}
{{- m.content }}
{{- '</tool_response>' }}
{%- else -%}
<|observation|>{% for tr in m.content %}
<tool_response>{{ tr.output if tr.output is defined else tr }}</tool_response>{% endfor -%}
{% endif -%}
{%- elif m.role == 'system' -%}
<|system|>{{ visible_text(m.content) }}
{%- endif -%}
{%- endfor -%}
{%- if add_generation_prompt -%}
    <|assistant|>{{- '</think>' if (enable_thinking is defined and not enable_thinking) else '<think>' -}}
{%- endif -%}

Sampling defaults

temperature
1

Stop strings

<|endoftext|> <|user|> <|observation|>

Evidence & provenance

Source

Revision pin
7dd20894a642a0aa287e9827cb1a1f7f91386b67
Manifest
Present

License

Name
mit
Commercial use
yes
Access
Open

How verification works →

File hashes (SHA-256)

  • glm-4.7-flash-iq4-xs/GLM-4.7-Flash-IQ4_XS.gguf 44ad6ab1885f3fd2282b1b684df729868ef2da65fd8adeab4eb848b25ac3925b
  • glm-4.7-flash-iq4-xs/LICENSE 55719438a8c5280813899cd9afe7173f934bcafd60f90197eb8be44572b9bc0c
  • glm-4.7-flash-iq4-xs/README.md c3ca90d7a4c4969a151d58f48d3672d1a2f0b95d90a5856a125c169918730aec
  • glm-4.7-flash-q4-k-m/GLM-4.7-Flash-Q4_K_M.gguf 29837ed2c0fc5f51981adf8ac8083fcf80743c598381f13e9f06cbad0498b174
  • glm-4.7-flash-q4-k-m/LICENSE 55719438a8c5280813899cd9afe7173f934bcafd60f90197eb8be44572b9bc0c
  • glm-4.7-flash-q4-k-m/README.md c3ca90d7a4c4969a151d58f48d3672d1a2f0b95d90a5856a125c169918730aec
  • glm-4.7-flash-q5-k-m/GLM-4.7-Flash-Q5_K_M.gguf 167848c4b460887d7a52c44c378d3996a0d38b3302ac2045494dc8b50869a893
  • glm-4.7-flash-q5-k-m/LICENSE 55719438a8c5280813899cd9afe7173f934bcafd60f90197eb8be44572b9bc0c
  • glm-4.7-flash-q5-k-m/README.md c3ca90d7a4c4969a151d58f48d3672d1a2f0b95d90a5856a125c169918730aec
  • glm-4.7-flash-q6-k/GLM-4.7-Flash-Q6_K.gguf f5bdc431802d7a3dab3be5a50ad0848a5569fd45c98c5e2ad83412c87cd887dc
  • glm-4.7-flash-q6-k/LICENSE 55719438a8c5280813899cd9afe7173f934bcafd60f90197eb8be44572b9bc0c
  • glm-4.7-flash-q6-k/README.md c3ca90d7a4c4969a151d58f48d3672d1a2f0b95d90a5856a125c169918730aec
  • glm-4.7-flash-q8-0/GLM-4.7-Flash-Q8_0.gguf 8c0922b03326932a40315ce92bbee01cc836ad18664268019143c898bdd7dd0b
  • glm-4.7-flash-q8-0/LICENSE 55719438a8c5280813899cd9afe7173f934bcafd60f90197eb8be44572b9bc0c
  • glm-4.7-flash-q8-0/README.md c3ca90d7a4c4969a151d58f48d3672d1a2f0b95d90a5856a125c169918730aec

Explore further

Get an email when a better quant fits your rig.

Set your rig once; we'll alert you when a new or better-fitting build lands.

Set your rig

Performance reports

Real-world throughput reported by the community (and scraped sources).

Community

Reviews, sampler presets and community runtime reports. Be the first to contribute.

Reviews (0)

Log in to write a structured review of this model.

No reviews yet.

Sampler presets

Log in to share a sampler preset or vote on presets.

No presets yet.

Community runtime reports

Unofficial, community-submitted "it loads for me" reports. These are not the official verified-working badge — an admin reviews reports before anything is marked officially verified.

Log in to report whether a quant loads in your runtime.

No community reports yet.

selected to compare · pick at least 2