20 4 days ago

GLM-4.7 Flash 30B text model with tool-calling support, quantized to Q3_K_XL and optimized for 16 GB VRAM. The model supports up to 202,752 tokens context window, with approximately 136K fitting within 16 GB in suitable configurations.

tools thinking 30b
ollama run byczech/glm-4.7-flash-16G-UD-Q3_K_XL:30b

Details

4 days ago

c4dcf3da003e · 14GB ·

deepseek2
·
29.9B
·
Q3_K_M
{{ .Prompt }}
MIT License Copyright (c) [year] [fullname] Permission is hereby granted, free of charge, to any per
{ "min_p": 0.01, "repeat_penalty": 1, "temperature": 1, "top_p": 0.95 }

Readme

GLM-4.7 Flash 30B — 16 GB VRAM, Q3_K_XL

A compact text-only build of GLM-4.7 Flash 30B, prepared for local use with Ollama.

This model supports tool calling and is intended for agentic workflows, coding, automation, structured tasks and general-purpose text generation.

It uses Q3_K_XL quantization and is optimized for systems with approximately 16 GB of VRAM. The model supports a maximum context window of 202,752 tokens. In suitable configurations, the practical context size that fits within the target VRAM is approximately 136,000 tokens.

Model

byczech/glm-4.7-flash-16G-UD-Q3_K_XL:30b

Highlights

  • GLM-4.7 Flash 30B
  • Text-only model
  • Tool-calling support
  • Q3_K_XL quantization
  • Optimized for approximately 16 GB of VRAM
  • Maximum context window of 202,752 tokens
  • Practical context within the target VRAM: approximately 136,000 tokens
  • Suitable for coding, agents, automation, structured output, document analysis and general chat

Run

ollama run byczech/glm-4.7-flash-16G-UD-Q3_K_XL:30b

Recommended Ollama configuration

Flash Attention and a quantized KV cache can significantly reduce memory usage and allow a larger practical context window:

OLLAMA_FLASH_ATTENTION=1 \
OLLAMA_KV_CACHE_TYPE=q4_0 \
OLLAMA_CONTEXT_LENGTH=136000 \
OLLAMA_NUM_PARALLEL=1 \
ollama serve

Then run the model in another terminal:

ollama run byczech/glm-4.7-flash-16G-UD-Q3_K_XL:30b

You can verify whether the model is fully loaded on the GPU with:

ollama ps

The PROCESSOR column should ideally report 100% GPU.

API example

curl http://localhost:11434/api/chat -d '{
  "model": "byczech/glm-4.7-flash-16G-UD-Q3_K_XL:30b",
  "messages": [
    {
      "role": "user",
      "content": "Analyze this task and choose the appropriate tool."
    }
  ],
  "options": {
    "num_ctx": 136000
  },
  "stream": false
}'

Tool-calling example with Python

Install the Ollama Python package:

pip install ollama
from ollama import chat


def get_weather(city: str) -> str:
    """Return a mock weather report for a city."""
    return f"The weather in {city} is sunny."


response = chat(
    model="byczech/glm-4.7-flash-16G-UD-Q3_K_XL:30b",
    messages=[
        {
            "role": "user",
            "content": "What is the weather in Prague?",
        }
    ],
    tools=[get_weather],
)

print(response.message)

Tool execution is handled by the client application. The model selects a tool and generates its arguments, while your application remains responsible for executing the function and returning the result.

Recommended settings for tool calling

For tool-calling and agentic workflows, the following sampling parameters are recommended:

temperature 0.7
top_p 1.0
min_p 0.01
repeat_penalty 1.0

These settings provide more consistent and reliable tool selection and argument generation than the default general-purpose configuration.

The model defaults are tuned for broader conversational and text-generation use:

temperature 1.0
top_p 0.95
min_p 0.01
repeat_penalty 1.0

Use the lower temperature and top_p 1.0 configuration when predictable tool calls are more important than response diversity.

Context length

The model architecture supports up to 202,752 tokens, but the practical context that fits fully within GPU memory depends on the quantization and runtime configuration.

For this build, the expected practical context within approximately 16 GB of VRAM is approximately 136,000 tokens.

The exact maximum may vary depending on:

  • Ollama version
  • GPU architecture and driver
  • Compute backend
  • KV-cache type
  • Runtime overhead
  • Other applications using GPU memory
  • Parallel requests and loaded models

If the model does not fit fully on the GPU, reduce OLLAMA_CONTEXT_LENGTH or the per-request num_ctx value (or you can create your own Modelfile with num_ctx parameter).

Quality and memory trade-off

The Q3_K_XL quantization was selected to balance model quality, VRAM usage and available context length.

Using a Q4_0 KV cache further reduces memory consumption and allows a significantly larger context window than the default F16 KV cache. For higher KV-cache precision, use q8_0, but expect higher VRAM use and a smaller practical context.

Notes

  • The stated practical context is an estimate based on fitting the model within the target VRAM.
  • The maximum context may change between Ollama releases, GPUs and backends.
  • Keep OLLAMA_NUM_PARALLEL=1 for the lowest memory usage.
  • Close other GPU-intensive applications when using the largest possible context.
  • Very long prompts increase processing time even when they fit in memory.