Run GigaChat 4 37B-A4B Locally with llama.cpp (PR #32767 Build)
In this article
- What You're Setting Up
- Read the License Before You Download
- Choose a Path
- Size the Machine from the Actual Files
- Where the bytes go
- The cache is small (arithmetic, not a measurement)
- Will it fit?
- Path 1: llama.cpp from PR #32767
- Step 1: Build the PR head
- Step 2: Download the GGUF, pinned
- Step 3: Start llama-server on a 32 GB or larger GPU
- Step 4: Run on an 8 to 24 GB GPU with the experts in RAM
- Step 5: CPU only
- Smoke Test: Instant and Reasoning Modes
- Tool Calls and Structured Output
- Chat Format and Defaults
- Other Runtimes
- Troubleshoot with the Known Problems
- What Performance to Expect
- Benchmarks, Briefly
- Practical Verdict
- What to Read Next
What You're Setting Up
GigaChat 4 37B-A4B is the smaller of the two GigaChat 4 models that ai-sage publishes on Hugging Face. The first commit in each of its repos is dated 26 November 2026. According to the GGUF model card, it is a hybrid model that "combines a Mixture-of-Experts (MoE) architecture with DeepSeek Sparse Attention (DSA) and Gated DeltaNet (GDN)", with 37B total and 4B active parameters per token. The Hugging Face API counts 38,257,903,040 parameters in the safetensors checkpoints.
The facts that decide how it runs, from the card and the repo's config.json:
| Property | Value | What it means locally |
|---|---|---|
| Layers | 32 decoder layers, hidden size 2,560 | Small enough for a single consumer GPU once the experts are moved out. |
| Attention layout | 24 Gated DeltaNet (linear) layers and 8 DSA layers, interleaved 3:1. The DSA layers are 3, 7, 11, 15, 19, 23, 27 and 31. | Only the 8 DSA layers keep a per-token cache. The 24 GDN layers keep a fixed-size state. |
| DSA layers | Multi-head latent attention (latent rank 512, RoPE dimension 64) plus an indexer that picks 2,048 earlier tokens per query | The cache stores one 576-value latent per token per layer, plus a 128-value indexer key. |
| Experts | 192 routed, 8 active per token, 1 shared; layer 0 uses a dense feed-forward block | The routed experts are 91% of the Q4_K_M file. They can live in system RAM. |
| Context | 1,048,576 tokens (YaRN, factor 32 over a 32,768-token original window) | Set -c yourself. The full context costs about 7.4 GiB of cache with q8_0 and MTP on (see sizing). |
| Speculative decoding | One built-in MTP layer, reused recurrently; a separate DFlash2 drafter ships only in the safetensors repos | Every GGUF includes the MTP head, so --spec-type draft-mtp needs no extra download. |
| Modes | Instant and reasoning in one checkpoint, chosen per request | One file serves both; a request flag switches the mode. |
| Languages and features | Repo language tags ru and en; the card lists multilingual chat, tool calling, structured outputs, maths, coding and long-document QA | Text only: every repo is tagged text-generation and ships no vision encoder or mmproj file. |
The larger sibling, GigaChat4-708B-A41B, uses the same design at 708B total and 41B active parameters. It is MIT-licensed, but the vendor's GitHub README lists its Q4_K_M GGUF as nine shards totalling 429.4 GB, which is far beyond one desktop. This guide covers the 37B only.
December 2026 status: llama.cpp support is in draft PR #32767. On 1 December it was open, unmerged and in conflict with master. No llama.cpp release can load the model: stable v1.1.0 (26 November) and the newest build, b12867 (30 November), have no
gigachat4architecture. This guide builds the PR head,b7d68b6(29 November). That commit and the GGUF revision4462231, uploaded the same day, both drop a chat-template check that rejected reasoning-only assistant turns. Ollama has no support. vLLM support is an open PR. SGLang merged support on 26 November but has not released it, and mlx-lm has none.
How this guide was checked: The license was read from
LICENSE.txtin all three 37B repos (the files are identical) and in the 708B repo. Model facts come from the GGUF card at revision4462231, fromconfig.jsonandchat_template.jinjain ai-sage/GigaChat4-37B-A4B atf39b938, and from the vendor's GitHub README at81b0dd8. File sizes come from the Hugging Face tree API at GGUF revision4462231cfaa1a7a6c1d7794e08def8c28e6eb192. The expert and non-expert splits come from the tensor table in each GGUF header, read with HTTP range requests. For every file, tensor bytes plus header equal the file size exactly. Every llama-server flag was checked againstcommon/arg.cppat PR headb7d68b6eb1ff1d08226c0a60f5e3d2d54c83d5aa, and the cache arithmetic against that commit's model and memory code. PR, issue and discussion states were checked on 1 December 2026. Throughput figures are the vendor's or the named commenters', on their own hardware.
Requirements:
- To use it at all: you are an individual running it for a noncommercial purpose (see the next section).
- Build tools: Git, CMake and a C++ compiler. Add the CUDA Toolkit for NVIDIA or the Vulkan SDK for AMD and Intel GPUs. On Windows, llama.cpp's build documentation asks for Visual Studio 2022 with the "Desktop development with C++" workload, and for git, build and test to run from a Developer PowerShell for VS 2022.
- Memory: about 24 GB of combined VRAM and system RAM for Q4_K_M, plus cache and compute buffers (see sizing).
- Disk: 23.25 GB for Q4_K_M, and Python 3 for the Hugging Face download CLI.
Read the License Before You Download
The repos' metadata shows the license as "other". The actual terms are the Noncommercial License for individuals 1.0, in LICENSE.txt. The same file sits in the FP8, BF16 and GGUF repos. The vendor's README states the split plainly: "708B under the MIT License and 37B under the Noncommercial License for Individuals 1.0." What the 37B text says:
| Question | What LICENSE.txt says |
|---|---|
| Who gets the license? | "You refers to the individual agreeing to these terms." You must accept the terms as conditions before any license applies. |
| Can I run it at home? | Yes. "Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose." |
| Commercial use? | Prohibited, and this covers outputs too: "Using the model or Derivatives to generate outputs for commercial purposes is prohibited." |
| Use inside an organization? | "Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is prohibited." |
| Fine-tuning and distillation? | Allowed for noncommercial purposes only. "Derivatives" covers modified versions, adapters, and "models trained to reproduce or transfer its capabilities using it as a teacher or its outputs as training data". Outputs themselves are not Derivatives just because the model produced them. |
| Redistribution? | Allowed for noncommercial purposes. You must include a copy of the terms, keep the existing notices, and not grant permissions that conflict with them. The general copyright grant excludes distribution; this separate grant for the model and Derivatives is what permits it. |
| Geographic limits? | None in the text. |
| If I break the terms? | After the first written notice, you keep your licenses if you come into full compliance and take practical steps to correct past violations within 10 days. Otherwise, they end immediately. |
This table summarizes the text and is not legal advice. Read the full file before you rely on it. The licensing choice is being debated in the repo's open discussion #4, which asks for an MIT release. The rest of this guide covers the use the license clearly allows: one person running the model on their own machine for a noncommercial purpose.
Choose a Path
| Your machine | Use | Why |
|---|---|---|
| NVIDIA GPU with 8 to 24 GB, plus 32 GB of RAM | llama.cpp PR build, Q4_K_M, experts partly or fully in RAM (Step 4) | Only 4B parameters are active per token, and the non-expert part of the file is 1.90 GiB. |
| GPU with 32 GB or more | llama.cpp PR build, Q4_K_M or Q6_K, fully on the GPU (Step 3) | The 21.66 GiB of Q4_K_M weights fit with room for the cache. |
| AMD or Intel GPU | llama.cpp PR build with -DGGML_VULKAN=ON | Commenters report Vulkan runs on an RX 6800 and on two Arc A770 cards, and a 16 GB RX 7600 XT run without naming the backend (see performance). |
| CPU only, 32 GB of RAM or more | llama.cpp PR build, -ngl 0 (Step 5) | The vendor publishes CPU numbers for every format. |
| Apple silicon | llama.cpp PR build (Metal is on by default), or a community MLX conversion | Neither is vendor-tested. No Metal run is reported in the PR or the model discussions. |
| H100-class server, several users | SGLang from source or the vLLM PR, with the FP8 checkpoint | The vendor's recipes run the FP8 model on one H100 80 GB. See Other runtimes. |
Size the Machine from the Actual Files
The official GGUF repo, ai-sage/GigaChat4-37B-A4B-GGUF, is not gated. Sizes at revision 4462231 (29 November 2026):
| File | Bytes | GB | GiB |
|---|---|---|---|
GigaChat4-37B-A4B-Q4_K_M/GigaChat4-37B-A4B-Q4_K_M.gguf | 23,253,069,824 | 23.25 | 21.66 |
GigaChat4-37B-A4B-Q6_K/GigaChat4-37B-A4B-Q6_K.gguf | 31,483,633,664 | 31.48 | 29.32 |
GigaChat4-37B-A4B-Q8_0/GigaChat4-37B-A4B-Q8_0.gguf | 40,737,835,008 | 40.74 | 37.94 |
GigaChat4-37B-A4B-bf16/…-bf16-00001-of-00002.gguf + …-00002-of-00002.gguf | 49,859,029,536 + 26,722,164,384 | 76.58 | 71.32 |
There is nothing smaller than Q4_K_M from ai-sage. Requests for Q3 and imatrix IQ quants are open in the repo's discussions #1 and #3.
Where the bytes go
Each GGUF header lists every tensor with its type and shape. Summing them shows how little of the file has to sit on the GPU:
| File | Routed experts (layers 1–31) | Per expert layer | Everything else | …of which the MTP layer |
|---|---|---|---|---|
| Q4_K_M | 19.75 GiB | 0.59 or 0.68 GiB | 1.90 GiB | 0.42 GiB |
| Q6_K | 26.82 GiB | 0.87 GiB | 2.50 GiB | 0.60 GiB |
| Q8_0 | 34.74 GiB | 1.12 GiB | 3.20 GiB | 0.78 GiB |
| BF16 | 65.39 GiB | 2.11 GiB | 5.93 GiB | 1.47 GiB |
"Everything else" covers attention, the GDN and DSA projections, the shared experts, the dense layer 0, the embeddings and output head, and the MTP layer (blk.32). Q4_K_M has two expert-layer sizes. Layers whose down-projection is stored as Q6_K take 0.68 GiB, and layers that use Q4_K take 0.59 GiB. Each header is about 6 MB, most of it the 128,256-entry tokenizer.
The cache is small (arithmetic, not a measurement)
At PR head b7d68b6, llama.cpp gives this model a hybrid memory with three parts. The figures below follow from the GGUF metadata and that commit's memory code:
- DSA layers (8): a K-only MLA cache of 576 values per token per layer, since MLA layers keep no separate V cache. There is also an indexer cache of 128 values per token per layer. That is 8 × 704 = 5,632 values per token, stored in the
-ctktype. At q8_0 (34 bytes per 32 values) that is 5,984 bytes per token. At f16 it is 11,264 bytes. - GDN layers (24): a fixed F32 state per sequence of 3 × 8,192 conv values plus 128 × 4,096 recurrent values. 24 × 548,864 × 4 bytes = 50.25 MiB, whatever the context length. With MTP enabled, llama.cpp keeps
--spec-draft-n-maxextra snapshots for rollback, so--spec-draft-n-max 3makes it 4 × 50.25 = 201 MiB. - MTP draft context: layer 32's own attention and indexer cache, 704 values per token. It is stored in the draft cache type, which defaults to f16 (
--spec-draft-type-k), so 1,408 bytes per token.
Context (-c, one slot) | DSA cache, q8_0 | DSA cache, f16 | MTP cache, f16 | Total with q8_0 and MTP on |
|---|---|---|---|---|
| 32,768 | 187 MiB | 352 MiB | 44 MiB | 432 MiB |
| 131,072 | 748 MiB | 1,408 MiB | 176 MiB | 1,125 MiB |
| 1,048,576 | 5.84 GiB | 11.0 GiB | 1.38 GiB | about 7.4 GiB |
Compute buffers come on top of this and cannot be derived from the file. llama-server prints them in its memory breakdown at load time, and those printed figures beat any estimate here. To budget other models the same way, use the VRAM calculator.
Will it fit?
GPU memory sizes are binary (an "8 GB" card has 8 GiB). llama.cpp's --fit, on by default, keeps a 1,024 MiB margin per device (--fit-target). The table charges that margin, the non-expert weights and the 32K cache (0.42 GiB) to the GPU first. It then shows how many Q4_K_M expert layers fit in what is left, at 0.64 GiB on average. This is an upper bound, because compute buffers also come out of the spare space.
| Hardware | File | Fixed GPU part | Spare VRAM | Expert layers on GPU (upper bound) | Experts left in RAM |
|---|---|---|---|---|---|
| 8 GB GPU + 32 GB RAM | Q4_K_M | 2.32 GiB | 8 − 1 − 2.32 = 4.68 GiB | about 7 of 31 | at least 15 GiB |
| 12 GB GPU + 32 GB RAM | Q4_K_M | 2.32 GiB | 8.68 GiB | about 13 | at least 11 GiB |
| 16 GB GPU + 32 GB RAM | Q4_K_M | 2.32 GiB | 12.68 GiB | about 19 | at least 7.6 GiB |
| 24 GB GPU | Q4_K_M | 2.32 GiB | 20.68 GiB | all 31 (19.75 GiB), leaving 0.93 GiB for compute buffers | Probably a few layers, once buffers are counted |
| 32 GB GPU | Q4_K_M | 2.32 GiB | 28.68 GiB | all 31, with 8.93 GiB spare | None |
| 48 GB GPU | Q8_0 | 3.62 GiB | 43.38 GiB | all 31 (34.74 GiB), with 8.64 GiB spare | None |
| CPU only, 32 GB RAM | Q4_K_M | 21.66 GiB weights + 0.42 GiB cache = 22.08 GiB | About 9.9 GiB left for the OS and buffers. Q6_K (29.32 GiB) is too tight here. | ||
| CPU only, 48 GB RAM | Q8_0 | 37.94 + 0.42 = 38.36 GiB | About 9.6 GiB left. | ||
| CPU only, 96 GB RAM | BF16 | 71.32 + 0.42 = 71.74 GiB | About 24 GiB left. | ||
If you use more than one slot, the recurrent state grows per slot (201 MiB each with MTP), and -c is split across the slots.
Path 1: llama.cpp from PR #32767
Step 1: Build the PR head
No release contains the gigachat4 architecture. A stock build stops at load with unknown model architecture: 'gigachat4', the error that src/llama-model.cpp throws for any architecture it does not know. Build the PR at a fixed commit so the binary you test is the one you can rebuild. The commands follow the vendor's card, with the commit pinned.
Linux and macOS (bash):
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
git fetch origin pull/32767/head:pr-32767
git checkout b7d68b6eb1ff1d08226c0a60f5e3d2d54c83d5aa
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DLLAMA_USE_PREBUILT_UI=OFF
cmake --build build --config Release --parallel --target llama-server
./build/bin/llama-server --version
Windows (Developer PowerShell for VS 2022):
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
git fetch origin pull/32767/head:pr-32767
git checkout b7d68b6eb1ff1d08226c0a60f5e3d2d54c83d5aa
cmake -S . -B build -DGGML_CUDA=ON -DLLAMA_USE_PREBUILT_UI=OFF
cmake --build build --config Release --parallel --target llama-server
.\build\bin\Release\llama-server.exe --version
Backend switches:
- CPU only: leave out
-DGGML_CUDA=ON. - AMD or Intel: replace it with
-DGGML_VULKAN=ON. - macOS: Metal is enabled by default.
- Intel CPUs with AMX: the vendor's card says that if loading quantized weights fails with
GGML_ASSERT(*cur_backend_id != -1), add-DGGML_NATIVE=OFFto the configure command and rebuild.
-DLLAMA_USE_PREBUILT_UI=OFF comes from the vendor's commands. It stops CMake from downloading the prebuilt web UI from Hugging Face. Unless npm is installed and you turn on LLAMA_BUILD_UI, the server is built without a browser chat page, and CMake warns "UI: no assets available - building without an embedded UI". The API is unaffected.
Do not merge or rebase the PR onto current master yourself. The PR branches from master at 9fba51d (15 November) and is 452 commits behind. In the PR's comments, savvadesogle (26 November) lists three upstream changes that hit GigaChat 4 after a merge, and SkalaSkalolaz (27 November) confirms them on CUDA:
- APIs: the indexer and MoE calls have to be ported to master's changed APIs.
- MTP:
--spec-type draft-mtpaborts withGGML_ASSERT(cparams.n_rs_seq == 0) faileduntil the recurrent-rollback code is adapted. - Porting trap: dropping the explicit q/k head repeat in the GDN layers makes the model decode "fast but produces garbage".
The PR head predates those upstream changes. The vendor's benchmarks used its first commit, 0541e50.
Step 2: Download the GGUF, pinned
pip install -U huggingface_hub
hf download ai-sage/GigaChat4-37B-A4B-GGUF \
--revision 4462231cfaa1a7a6c1d7794e08def8c28e6eb192 \
--include "GigaChat4-37B-A4B-Q4_K_M/*.gguf" \
--local-dir ./gguf
In PowerShell, end each continued line with a backtick (`) instead of a backslash. For another format, change the folder in --include to GigaChat4-37B-A4B-Q6_K, GigaChat4-37B-A4B-Q8_0 or GigaChat4-37B-A4B-bf16. For BF16, pass the -00001-of-00002 file to -m.
Use revision 4462231 or later. The earlier upload (67a2535, 26 November) embeds a chat template with an empty default system message. That template also raises chatml v5: assistant turn must not contain only <think>...</think> when a client sends back an assistant turn that holds only reasoning. The 29 November upload removes that check, matching the PR's "chat fix" commit.
Step 3: Start llama-server on a 32 GB or larger GPU
This is the vendor's GPU command with one change: one slot instead of four, for a single user.
./build/bin/llama-server \
-m ./gguf/GigaChat4-37B-A4B-Q4_K_M/GigaChat4-37B-A4B-Q4_K_M.gguf \
--alias gigachat4 \
-ngl 99 --fit off -fa on \
-c 32768 -np 1 -ctk q8_0 -ctv q8_0 \
--jinja --reasoning-format deepseek \
--spec-type draft-mtp --spec-draft-n-max 3 \
--host 127.0.0.1 --port 8080
.\build\bin\Release\llama-server.exe `
-m .\gguf\GigaChat4-37B-A4B-Q4_K_M\GigaChat4-37B-A4B-Q4_K_M.gguf `
--alias gigachat4 `
-ngl 99 --fit off -fa on `
-c 32768 -np 1 -ctk q8_0 -ctv q8_0 `
--jinja --reasoning-format deepseek `
--spec-type draft-mtp --spec-draft-n-max 3 `
--host 127.0.0.1 --port 8080
What each flag does at b7d68b6:
| Flag | Why it is here |
|---|---|
--alias gigachat4 | The model name clients send in "model". The vendor's examples use it. |
-ngl 99 --fit off | Puts every layer on the GPU and turns off automatic fitting. -ngl also accepts auto and all. If you set -ngl while --fit is on, fitting gives up with a warning ("failed to fit params to free device memory: n_gpu_layers already set by user") and your values are used. --fit off skips that step. |
-fa on | Flash attention. Values are on, off or auto. |
-c 32768 | Total context across all slots. The default is 0, which means the trained 1,048,576 tokens and about 7.4 GiB of cache by the arithmetic above. |
-np 1 | One server slot. The vendor's server example uses -np 4, which gives four slots of 8,192 tokens each. Its single-stream benchmark used -c 8192 -np 1. A commenter on the PR saw decode fall to about 10 t/s with four slots (see troubleshooting). |
-ctk q8_0 -ctv q8_0 | The vendor's cache type. On this model -ctk sets both the MLA latent cache and the indexer cache. The MLA and indexer caches keep no V tensors, so -ctv has nothing to store here; it is kept to match the vendor's command. |
--jinja | Uses the chat template embedded in the GGUF. The PR adds a GigaChat4 parser (common/parsers/gigachat4.cpp) that is selected automatically from the template's markers. |
--reasoning-format deepseek | Puts the thinking text in message.reasoning_content and the answer in message.content. |
--spec-type draft-mtp --spec-draft-n-max 3 | Speculative decoding with the MTP head inside the GGUF, drafting up to three tokens per verification step. Replace both with --spec-type none to turn it off. |
--host 127.0.0.1 --port 8080 | Local only, on the port the vendor uses (the default port at this commit is 9931). If you bind to 0.0.0.0, add --api-key. |
Step 4: Run on an 8 to 24 GB GPU with the experts in RAM
There are three ways to place the experts. All of them keep the attention, GDN, shared-expert and MTP weights on the GPU, and send routed-expert work to the CPU.
Option A: let --fit decide (any GPU size). Leave out -ngl and the MoE flags. --fit is on by default. It measures the projected memory, including the MTP draft context, and moves expert layers to system RAM until the GPU keeps its 1,024 MiB margin. It only adjusts settings you have not set, so keep -c explicit.
./build/bin/llama-server \
-m ./gguf/GigaChat4-37B-A4B-Q4_K_M/GigaChat4-37B-A4B-Q4_K_M.gguf \
--alias gigachat4 \
-fa on -c 32768 -np 1 -ctk q8_0 -ctv q8_0 \
--jinja --reasoning-format deepseek \
--spec-type draft-mtp --spec-draft-n-max 3 \
--host 127.0.0.1 --port 8080
Option B: set the split yourself. --n-cpu-moe N keeps the experts of layers 0 to N−1 in RAM. Layer 0 has no experts, so 32 − N expert layers stay on the GPU. --cpu-moe keeps every expert in RAM, which is the setting for an 8 GB card. Both match tensors with llama.cpp's built-in pattern \.ffn_(up|down|gate|gate_up)_(ch|)exps, and this GGUF names its experts ffn_gate_exps, ffn_up_exps and ffn_down_exps.
# 8 GB GPU: every routed expert in system RAM
./build/bin/llama-server \
-m ./gguf/GigaChat4-37B-A4B-Q4_K_M/GigaChat4-37B-A4B-Q4_K_M.gguf \
--alias gigachat4 \
-ngl 99 --cpu-moe --fit off -fa on \
-c 32768 -np 1 -ctk q8_0 -ctv q8_0 \
--jinja --reasoning-format deepseek \
--spec-type draft-mtp --spec-draft-n-max 3 \
--host 127.0.0.1 --port 8080
On a 12 or 16 GB card, replace --cpu-moe with --n-cpu-moe N. Choose N so that 32 − N sits a few layers below the upper bound in the sizing table, then read the GPU compute buffer from the start-up log and move N down while it still loads. The same split as a regex keeps layers 14 to 31 in RAM: -ot "blk\.(1[4-9]|2[0-9]|3[01])\.ffn_(up|down|gate_up|gate)_(ch|)exps=CPU", the pattern Sdoh posted in discussion #1.
Option C: all experts in RAM with a GPU expert cache. At this commit, --moe-cache-mib N sets a "GPU cache size in MiB for the MoE experts kept in the CPU". It is off by default. --moe-cache-cpu-share F sets the share of cache misses the CPU computes instead of uploading, from 0 to 1, with a default of 0. In discussion #1, Lefox-Demod posted this combination for a 16 GB Radeon RX 7600 XT: -cmoe -ngl 99 --moe-cache-mib 12032 --moe-cache-cpu-share 0.8 -c 131072. Treat their numbers in the performance section as one person's result.
Step 5: CPU only
The vendor's CPU recipe, with the model path filled in:
./build/bin/llama-server \
-m ./gguf/GigaChat4-37B-A4B-Q4_K_M/GigaChat4-37B-A4B-Q4_K_M.gguf \
--alias gigachat4 \
-ngl 0 -fa on \
-c 8192 -np 1 -ctk q8_0 -ctv q8_0 \
--jinja --reasoning-format deepseek \
--spec-type draft-mtp --spec-draft-n-max 3 \
--host 127.0.0.1 --port 8080
The vendor's run added -t 64 -tb 64 on a 64-thread host. Without -t, llama.cpp picks its own thread count. Set -t and -tb to the number of threads you want generation and prompt processing to use.
Smoke Test: Instant and Reasoning Modes
The template turns reasoning on when no argument is given. Send chat_template_kwargs.reasoning per request to choose, using a question whose answer you can check (17 × 24 = 408):
curl -sS http://127.0.0.1:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gigachat4",
"messages": [{"role": "user", "content": "What is 17 times 24?"}],
"max_tokens": 2048,
"chat_template_kwargs": {"reasoning": false}
}'
In PowerShell, send the same body with Invoke-RestMethod. The closing '@ of the here-string must start at the beginning of its line:
$body = @'
{
"model": "gigachat4",
"messages": [{"role": "user", "content": "What is 17 times 24?"}],
"max_tokens": 2048,
"chat_template_kwargs": {"reasoning": false}
}
'@
Invoke-RestMethod -Uri http://127.0.0.1:8080/v1/chat/completions -Method Post `
-ContentType 'application/json' -Body $body | ConvertTo-Json -Depth 8
Repeat with "reasoning": true. The thinking should then arrive in choices[0].message.reasoning_content, separate from content. max_tokens covers both, so give reasoning requests room. The vendor's vLLM example uses 8,192.
Server-wide default. --reasoning off at this commit sets enable_thinking to false. The PR's GigaChat4 parser copies enable_thinking into the template's reasoning variable whenever a request does not set reasoning itself, so a per-request "reasoning": true still wins.
Tool Calls and Structured Output
The vendor's card runs its tool-call example against llama-server. The PR parser turns the model's GCML tool-call blocks into OpenAI tool_calls. It supports parallel calls, constrains the arguments with a grammar that switches on when <|GCML|tool_calls> appears, and also accepts response_format with a JSON schema. The vendor's request:
curl -sS http://127.0.0.1:8080/v1/chat/completions \
-H "Content-Type: application/json" \
--data-binary @- <<'JSON'
{
"model": "gigachat4",
"temperature": 0,
"max_tokens": 256,
"chat_template_kwargs": { "reasoning": false },
"messages": [
{ "role": "system", "content": "To get the weather, call get_weather. Pass the city name in English." },
{ "role": "user", "content": "What is the current weather in London?" }
],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather in a city.",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"],
"additionalProperties": false
}
}
}],
"tool_choice": "auto"
}
JSON
In PowerShell, put the same JSON in a @' ... '@ here-string and send it with Invoke-RestMethod, as in the smoke test. The vendor's card says the model returns a call to get_weather, which arrives in message.tool_calls. Run the function yourself and send the result back as a role: "tool" message with the matching tool_call_id. For grammar-constrained output in llama.cpp more generally, see our GBNF and Pydantic guide.
The vendor recommends Pi for agentic work, with Codex CLI and DeepSeek Harness as alternatives. Its README has the configuration for each against an OpenAI-compatible endpoint. Pi and DeepSeek Harness use Chat Completions. Codex needs a Responses API endpoint, which the vendor reached through a gateway.
Chat Format and Defaults
You rarely need the raw format, but it explains the error messages. From chat_template.jinja, the template embedded in the GGUF and the PR parser:
- Turns: each message is written as
role<|role_sep|>\n+ content +<|message_sep|>\n\n. The roles aresystem,user,assistant,function descriptions(the tool list, rendered as a TypeScript-style namespace) and function results. BOS is<s>and EOS is</s>. - Assistant turns:
<think>…</think>, then the text, then any tool calls, joined by blank lines. A call looks like<|GCML|invoke name="get_weather">with one<|GCML|parameter name="city" string="true">London</|GCML|parameter>per argument. The vertical bars are full-width characters. - Mode switch: with reasoning on, the prompt ends in
assistant<|role_sep|>\n<think>. With it off, the prompt ends with an already-closed<think></think>so the model answers directly. - Stop string: the PR's parser notes that "the turn separator is not an EOG token, so it needs a stop string" and adds
<|message_sep|>. If you drive the raw completion endpoint or another runtime, add that stop string yourself. - Default system prompt: when a request has no system message, the template at GGUF revision
4462231insertsТы — GigaChat 4. Соответствуешь законодательству Российской Федерации. Ограничение знаний: ноябрь, 2026 год.("You are GigaChat 4. You comply with the legislation of the Russian Federation. Knowledge cutoff: November 2026."). Any system message you send replaces it. - History: a template argument,
drop_history_thinking(default false), removes reasoning from assistant turns that come before the last user message.
Sampling. generation_config.json sets no sampling values, and the GGUF carries no general.sampling.* keys. llama-server's own defaults therefore apply: temperature 0.80, top-p 0.95, top-k 40, min-p 0.05. The vendor states no recommended setting. Its examples use temperature 1.0, top-p 1.0 and repetition penalty 1.0 for chat (SGLang cookbook and card), and temperature 1.0 with top-p 0.95 for the GGUF accuracy runs. The tool-call examples use temperature 0 (llama.cpp, on the GGUF card) or 0.6 (vLLM, on the FP8 card). To match the chat examples, send "temperature": 1.0, "top_p": 1.0 per request or start the server with --temp 1.0 --top-p 1.0.
Other Runtimes
- SGLang: support was merged in PR #50613 on 26 November, after the latest release, v0.5.23 (2 November). The vendor's recipe installs SGLang commit
ff14289from source. It serves the FP8 checkpoint on one H100 80 GB with--reasoning-parser auto --tool-call-parser auto, and enables recurrent MTP through--speculative-algorithm EAGLE. The card says the FP8 weights need about 40 GB of GPU memory. Details are in the SGLang cookbook. - vLLM: support is in open PR #69762, not in the latest release, v0.34.0 (16 November). The vendor builds commit
c0c9083withVLLM_USE_PRECOMPILED=1and serves with--tool-call-parser gigachat4 --reasoning-parser gigachat4on one H100. In vLLM's response, the reasoning lands inmessage.reasoning. For the multi-GPU serving pattern, see our vLLM self-hosting guide. - Ollama: ollama.com has no GigaChat 4 library page. A search of the ollama/ollama repository finds no GigaChat 4 issue or PR, and the v0.40.18, v0.40.19 and v0.40.20-rc0 release notes do not mention it. A Hugging Face GGUF will not load either, because no released llama.cpp knows the architecture.
- MLX: ml-explore/mlx-lm has no GigaChat 4 issue or PR. Community conversions exist on Hugging Face, and each ships its own
gigachat4.pymodel file to copy into the mlx-lm package. That is third-party code. skyzer4ever's card says its port leaves out the DSA indexer, "so attention is exact up to 2,048 tokens of context; beyond that, outputs can differ from the reference implementation." Xylolabs' card pinsmlx==0.32.5 mlx-lm==0.32.2and leaves out the MTP layer and the DFlash2 drafter. Both carry the same noncommercial license.
Troubleshoot with the Known Problems
States checked on 1 December 2026.
| Symptom | Where it was reported | Workaround |
|---|---|---|
unknown model architecture: 'gigachat4' | Any released llama.cpp (v1.1.0, b12867) or a tool built on one; support is in PR #32767 (open, draft) | Build PR head b7d68b6 (Step 1). |
GGML_ASSERT(cparams.n_rs_seq == 0) failed at load with --spec-type draft-mtp, on a build that merges the PR into newer master | PR #32767 comments, 26 and 27 November | Use the PR head unmerged. On a merged branch, SkalaSkalolaz reports that --spec-type none works. |
| Fast but garbage output on a self-merged branch | Same PR comments (item 3) | Keep the explicit q/k repeat in the GDN layers, or use the unmerged PR head. |
chatml v5: assistant turn must not contain only <think>...</think>, or "Assistant message must contain either 'content' or 'tool_calls'!", when a client sends back a reasoning-only turn | Template in GGUF revision 67a2535; server check before PR commit b7d68b6 ("chat fix", 29 November) | Use GGUF revision 4462231 and PR head b7d68b6 together. |
| Decode drops to about 10 t/s | savvadesogle, PR #32767: "llama-server needs -np 1 — with the default 4 slots decode drops to ~10 t/s on this hybrid recurrent memory" (Vulkan, merged branch) | Run one slot, -np 1. |
GGML_ASSERT(*cur_backend_id != -1) while loading quantized weights on Intel AMX CPUs | GGUF model card | Reconfigure with -DGGML_NATIVE=OFF and rebuild. |
No chat page at http://127.0.0.1:8080/ | Build log: "UI: no assets available - building without an embedded UI" | Expected with -DLLAMA_USE_PREBUILT_UI=OFF. Use the API or an OpenAI-compatible client. |
| MTP slows things down with many concurrent requests | Vendor's batch table: at batch 16, MTP-3 decodes at 635.2 tok/s against 676.6 off (0.94×) | Keep MTP for a single user; use --spec-type none for heavy concurrency. |
| No Q3 or IQ quant from the vendor; Q4_K_M does not fit a 24 GB card in full | GGUF discussions #1 and #3 (open) | Keep Q4_K_M and move experts to RAM (Step 4). |
| Waiting for a llama.cpp release | GGUF discussion #2 (open) | No merge date has been given. Watch PR #32767. |
What Performance to Expect
The vendor's numbers. These come from the GGUF card: llama.cpp commit 0541e50e2f, a 1,024-token prompt, single-stream greedy decoding, a q8_0 target cache, and the median of three runs. The H100 runs generate 192 tokens with every layer on the GPU. The CPU runs generate 128 tokens on 2 × AMD EPYC 9474F with -t 64 -tb 64.
| Hardware | Format | Decode, MTP off | Decode, MTP-3 | Speedup | Draft acceptance |
|---|---|---|---|---|---|
| 8 × H100 80 GB | Q4_K_M | 150.4 tok/s | 213.3 tok/s | 1.42× | 0.612 |
| 8 × H100 80 GB | Q8_0 | 139.8 tok/s | 188.9 tok/s | 1.35× | 0.585 |
| 2 × EPYC 9474F | Q4_K_M | 16.8 tok/s | 25.0 tok/s | 1.49× | 0.596 |
| 2 × EPYC 9474F | Q6_K | 17.7 tok/s | 26.6 tok/s | 1.50× | 0.638 |
| 2 × EPYC 9474F | Q8_0 | 15.7 tok/s | 24.2 tok/s | 1.54× | 0.596 |
| 2 × EPYC 9474F | BF16 | 14.1 tok/s | 19.6 tok/s | 1.39× | 0.580 |
The vendor also checked that MTP does not change answers much. On 200-example runs at temperature 1.0, GSM8K accuracy was 0.920 with MTP off and on in instant mode, and 0.950 against 0.940 in reasoning mode. MMLU was 0.845 against 0.835 (instant) and 0.890 against 0.895 (reasoning).
Consumer hardware, as reported by users. Each figure is one person's run on their own build and settings:
| Reported by | Hardware | Setup | Prefill | Decode |
|---|---|---|---|---|
| Lefox-Demod (GGUF #1) | Radeon RX 7600 XT, 16 GB | Q4, experts in RAM with --moe-cache-mib 12032, -c 131072 | 227 t/s; 420 with MTP | 40.4 t/s; 71.49 with MTP, which the poster says "may be a bit inflated" |
| Sdoh (same thread) | Radeon RX 6800, Vulkan | Q4_K_M, self-built PR branch | Not given | 25–50 t/s with MTP |
| savvadesogle (PR #32767) | 2 × Intel Arc A770, 16 GB each, Vulkan | Q4_K_M, PR merged onto master with their fixes, -ngl 999, layer split | 204–207 t/s (pp512) | 42 t/s (tg128); 46–55 with MTP; about 72 on short, predictable outputs |
Benchmarks, Briefly
These are the vendor's figures from the model card, reported as given. They have not been independently reproduced. The comparison column is Qwen3.6-35B-A3B from the same tables.
| Benchmark | GigaChat 4 37B, reasoning | Qwen3.6-35B-A3B, reasoning | GigaChat 4 37B, instant |
|---|---|---|---|
| LiveCodeBench v6 | 85.00 | 65.00 | 52.00 |
| SWE-bench Verified | 70.80 | 67.80 | 70.80 |
| Terminal-Bench 2.0 | 38.20 | 48.30 | 38.20 |
| IFBench (prompt-level loose) | 75.00 | 58.00 | 48.00 |
| JSONSchemaBench | 96.00 | 42.00 | 86.00 |
| AA-LCR | 54.00 | 60.70 | 54.00 |
| GPQA Diamond | 70.00 | 80.00 | 55.00 |
| AIME 2026 (mean@8) | 92.00 | 87.00 | 57.00 |
| HLE (text only) | 9.00 | 20.00 | 4.00 |
| BFCL (overall accuracy) | 72.00 | 67.00 | 49.00 |
| τ²-Bench (mean@3) | 73.00 | 80.00 | 60.00 |
In reasoning mode, the vendor's table puts GigaChat 4 37B ahead on code generation, instruction following, schema-following JSON and BFCL. Qwen3.6-35B-A3B leads on GPQA Diamond, HLE, Terminal-Bench and τ²-Bench. Instant mode gives up most of the maths and science scores. The card lists the same value in both modes for SWE-bench Verified, Terminal-Bench 2.0 and AA-LCR.
Practical Verdict
If the license fits your use (one person, noncommercial), GigaChat 4 37B-A4B is unusually easy on hardware for its size. Only 1.90 GiB of the Q4_K_M file has to sit on the GPU, and the 8 DSA layers keep the 32K cache under half a gigabyte. An 8 GB GPU with 32 GB of RAM can run it with --cpu-moe, and a 32 GB card holds the whole Q4_K_M file.
What makes it an evaluation setup rather than a settled one is llama.cpp. Support exists only as a draft PR that conflicts with master:
- Pin both halves: PR head
b7d68b6and GGUF revision4462231. They carry matching chat-template fixes. - Do not merge the PR into newer master unless you are ready to port the fixes the commenters describe.
- Start with one slot and MTP on. Then try
--fitagainst a manual--n-cpu-moesplit on your card.
Record the commit and revision with your results. When PR #32767 merges, the flags here should carry over, but check the release notes and rebuild from the tag.
What to Read Next
- Run Inkling 2 Mini Locally with llama.cpp, Ollama and MLX: another new MoE sized from its GGUF tensor tables
- Run DeepSeek V4.1 Flash Locally with llama.cpp: the same expert-offload method on a much larger model
- Run LLMs Locally: 6 Practical Methods: Ollama, LM Studio, vLLM, llama.cpp and others compared
- GBNF and Pydantic with llama.cpp: guaranteed JSON from a local server
- VRAM calculator: budget memory for other models before you download them
Frequently asked questions
Can I use GigaChat 4 37B-A4B commercially?
No. The 37B-A4B repos use the Noncommercial License for individuals 1.0. It licenses the individual who accepts it, for noncommercial purposes only, and states that using the model or its derivatives to generate outputs for commercial purposes is prohibited. It also prohibits use by charitable organizations, educational institutions, public research organizations, public safety or health organizations, environmental protection organizations and government institutions. Personal study, private research, hobby projects and private entertainment are listed as permitted. The larger 708B-A41B model is MIT-licensed.
Does llama.cpp support GigaChat 4?
Not in any release. Support is in draft PR #32767, which was open and unmerged on 1 December 2026. Stable v1.1.0 (26 November) and build b12867 (30 November) have no gigachat4 architecture and stop with "unknown model architecture: 'gigachat4'". Build the PR head, commit b7d68b6, as it is. Two testers on the PR report that after merging it into current master, the indexer and MoE code must be ported and MTP speculative decoding aborts until the rollback code is adapted.
How much VRAM does GigaChat 4 37B-A4B need?
The official Q4_K_M GGUF is 23.25 GB (21.66 GiB). Its tensor table puts 19.75 GiB in the routed experts and 1.90 GiB in everything else. With the experts in system RAM (--cpu-moe), the GPU holds about 2.3 GiB including a 32K-token cache, so an 8 GB card plus 32 GB of RAM is enough on paper. The cache is small because only 8 of the 32 layers keep per-token keys. These are estimates from the file and config, not measurements.
How do I turn off reasoning in GigaChat 4?
Send "chat_template_kwargs": {"reasoning": false} with the request. The chat template turns reasoning on when the argument is missing. To change the server-wide default in the llama.cpp PR build, start llama-server with --reasoning off. The PR's GigaChat4 parser copies that setting into the template's reasoning variable unless a request sets reasoning itself.
Can I run GigaChat 4 37B-A4B with Ollama, vLLM, SGLang or MLX?
Not from a release. Ollama has no GigaChat 4 model or support. vLLM support is open PR #69762, and the vendor's recipe builds commit c0c9083 from it. SGLang merged support on 26 November, after its latest release (v0.5.23), so it needs a source install. mlx-lm has no support; community MLX conversions ship their own model file to copy into mlx-lm.
Is there a GigaChat 4 37B-A4B GGUF smaller than Q4_K_M?
Not from ai-sage. The official GGUF repo has Q4_K_M, Q6_K, Q8_0 and BF16. Requests for Q3 and imatrix IQ quants are open in the repo's discussions (#1 and #3). Third-party low-bit GGUFs exist on Hugging Face, but none come from the model's authors, and each one has to match the llama.cpp build it was made for.
Related Guides
Run Tencent Hy-MT3 Locally: 30B-A3B Translation on llama.cpp v1.1.0
Run Tencent's Hy-MT3-30B-A3B translation model on llama.cpp v1.1.0: the exact prompt template, real GGUF sizes, memory math and a batch file translator.
Run Ternary Bonsai 2.5 27B Locally with llama.cpp (Q2_0, PTQ1_0, MTP)
Run Prism ML's ternary Bonsai 2.5 27B locally: which GGUF stock llama.cpp loads, pinned fork commands with MTP, exact file sizes and 8 GB GPU sizing.
Run Inkling 2 Mini Locally with llama.cpp, Ollama and MLX (v1.1.0)
Run Inkling 2 Mini locally with llama.cpp v1.1.0, Ollama or MLX: real file sizes, pinned commands, and what the op-offload fix changes on small GPUs.