GLM-OCR · GGUF (llama.cpp)
GGUF quantizations of zai-org/GLM-OCR for llama.cpp / Ollama / LM Studio. Produced by axteam.
Files
| File | Size | Notes |
|---|---|---|
GLM-OCR-Q4_K_M.gguf |
0.5 GB | 4-bit k-quant (medium) — recommended size/quality balance. |
GLM-OCR-Q8_0.gguf |
1.0 GB | 8-bit — closest to the original. |
Converted with llama.cpp
convert_hf_to_gguf.py(recognized asglm4 (text backbone)); the originalchat_templateis embedded. The vision encoder is not included in these GGUF files — this is the text-backbone LLM only, so it runs only as a text model and cannot do the OCR/image pipeline; it is not a general chat model either (see the check under Requirements). For end-to-end OCR use the original model or the FP8 buildaxteam/GLM-OCR-FP8-dynamicwith vLLM.
Quantization method
These GGUF files are post-training quantization (PTQ) made with llama.cpp (convert_hf_to_gguf.py → llama-quantize): the BF16 weights are quantized block-wise (k-quants: per-block scales with mixed bit allocation), with no retraining. The original chat_template is embedded in each file.
Measured on GPU (llama.cpp)
llama.cpp b12005 (commit e0f142d, CUDA build) on an NVIDIA B200, 2026-11-02, all layers on the GPU: perplexity over 16 windows of 2,048 tokens from the WikiText-2 test set and from a Korean Wikipedia sample (lower is better). This repo has no BF16 file, so percentages are relative to Q8_0, the file closest to the original.
| File | WikiText-2 PPL | Korean wiki PPL | vs Q8_0 (EN / KO) |
|---|---|---|---|
GLM-OCR-Q8_0.gguf |
21.32 | 18.19 | reference |
GLM-OCR-Q4_K_M.gguf |
22.41 | 18.39 | +5.1% / +1.1% |
16 windows per text is a small sample: differences of a few percent between files are within its sampling noise (re-measuring two repos with 64 windows moved such differences by up to ~19 points). This is an OCR model measured on plain text; the absolute values are not comparable with general language models — use them only to compare the files with each other.
Requirements
| llama.cpp | build ≥ b8093 — architecture glm4 (GLM-OCR text decoder) needs ≥ b8093, and the commands on this card use -fa on (≥ b6325). Run here on 2026-11-02 with b12005 (commit e0f142d, CUDA build) on an NVIDIA B200: every file in this repo loaded with all layers on the GPU, its perplexity was measured (see Measured on GPU above) and two short chat questions (capital of France / of Korea, one-word answer requested) were asked with every file: every file answered the French one (“Paris”) but only repeated the Korean question back; this is the text backbone of an OCR model, not a general chat model. |
| Memory | the chosen GGUF file (sizes in the table) plus KV cache for the context (-c); --cache-type-k/v q8_0 -fa on halves the KV cache. |
| Input | text only — no mmproj in this repo, so llama.cpp cannot do OCR / image input with it. |
| Ollama / LM Studio | not tested here. |
Run with llama.cpp
# pull one quant straight from the Hub and serve an OpenAI-compatible API on :8080
llama-server -hf axteam/GLM-OCR-GGUF:Q4_K_M -c 8192 --jinja
# or download a single file and run it in the terminal
hf download axteam/GLM-OCR-GGUF GLM-OCR-Q4_K_M.gguf --local-dir .
llama-cli -m GLM-OCR-Q4_K_M.gguf -c 8192 --jinja
These GGUF files hold only the OCR model's text backbone, so they are not general chat models: in our check they answered only the simple French question and repeated the Korean one back (see Requirements). The commands above and below only show how to load and call a file.
Query the server:
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
"messages": [{"role": "user", "content": "대한민국의 수도는 어디인가요?"}],
"max_tokens": 512
}'
Reduce KV-cache memory (optional, run-time)
KV-cache type is chosen at run time in llama.cpp (it is not baked into the file):
llama-server -hf axteam/GLM-OCR-GGUF:Q4_K_M -c 8192 --jinja --cache-type-k q8_0 --cache-type-v q8_0 -fa on
Ollama
ollama run hf.co/axteam/GLM-OCR-GGUF:Q4_K_M
LM Studio
Search for axteam/GLM-OCR-GGUF in the model browser and pick a quant (e.g. Q4_K_M).
License
Quantized derivative of zai-org/GLM-OCR (mit). Original weights & tokenizer belong to Z.ai.
한국어 요약
zai-org/GLM-OCR의 GGUF 양자화 빌드 (llama.cpp·Ollama·LM Studio용) · 제작 axteam
개요
| 항목 | 내용 |
|---|---|
| 원본 모델 | zai-org/GLM-OCR |
| 형식 | GGUF (llama.cpp) |
| 변환 도구 | llama.cpp convert_hf_to_gguf.py → llama-quantize |
| 포함 | 텍스트 백본(언어 모델)만 — 비전 인코더 미포함, 이 GGUF로는 OCR 불가 |
| 파일 수 | 2개 |
양자화 상세
- 양자화 절차: PTQ(학습 후 양자화, 재학습 없음), llama.cpp 블록 단위 양자화(k-quant
Q*_K,Q8_0) - chat template: GGUF 파일에 내장
- 품질(실측, 2026-11-02): llama.cpp PPL(WikiText-2·한국어 위키 표본, 2,048토큰×16, B200 GPU, 낮을수록 좋음, 리포에 BF16 파일이 없어 원본에 가장 가까운 Q8_0 기준) —
GLM-OCR-Q8_0.gguf영어 21.32·한국어 18.19 ·GLM-OCR-Q4_K_M.gguf영어 22.41·한국어 18.39(Q8_0 대비 +5.1%·+1.1%) — OCR 모델이라 절대값은 일반 LLM과 비교할 수 없고 파일끼리 비교용 — 텍스트당 16청크라 파일 사이 몇 % 차이는 표본 흔들림 범위
제공 파일
| 파일 | 크기 | 설명 |
|---|---|---|
GLM-OCR-Q4_K_M.gguf |
0.5 GB | 4비트 k-quant — 크기·품질 균형 (권장) |
GLM-OCR-Q8_0.gguf |
1.0 GB | 8비트 — 원본에 가장 가까움 |
요구사항
- llama.cpp: b8093 이상 (
glm4구조(GLM-OCR 텍스트 디코더) 지원 b8093부터, 예시 명령의-fa on옵션 b6325부터) - 실행 확인: 2026-11-02 b12005(커밋 e0f142d) CUDA 빌드로 NVIDIA B200에서 이 리포의 모든 파일을 전 층 GPU에 올려 실행 — PPL 측정(위 영어 본문 표), 모든 파일에 짧은 질문 2개(프랑스·대한민국 수도, 한 단어 답 요청)를 물음, 프랑스 질문은 모두 “Paris”로 맞혔으나 한국어 질문은 모두 답 대신 질문을 그대로 되풀이함, OCR 모델의 텍스트 백본이라 일반 대화용 아님
- 메모리: 선택한 GGUF 파일 크기 + 컨텍스트(
-c)만큼의 KV 캐시 (KV 캐시 줄이는 방법은 아래 사용법 참고) - 입력: 텍스트 전용(
mmproj없음) — OCR은 원본 모델이나 FP8 빌드(axteam/GLM-OCR-FP8-dynamic)를 vLLM으로 실행 - Ollama·LM Studio: 제작 측에서 실행 미확인
사용법
- 주의: OCR 모델의 텍스트 백본만 들어 있어 일반 대화용이 아님(점검에서 프랑스 질문만 맞히고 한국어 질문은 되풀이함, 요구사항의 실행 확인 참고) — 이 절의 명령은 파일을 불러 호출하는 방법 예시
- 파일 받기:
hf download axteam/GLM-OCR-GGUF GLM-OCR-Q4_K_M.gguf --local-dir .(아래-m명령에 필요, 다른 양자화는 파일명의Q4_K_M만 변경) - 서버 실행:
llama-server -hf axteam/GLM-OCR-GGUF:Q4_K_M -c 8192 --jinja— OpenAI 호환 API - 터미널 실행:
llama-cli -m GLM-OCR-Q4_K_M.gguf -c 8192 --jinja - Ollama:
ollama run hf.co/axteam/GLM-OCR-GGUF:Q4_K_M - LM Studio: 모델 검색에서
axteam/GLM-OCR-GGUF입력 후 양자화 단계 선택 - KV 캐시 절감(선택):
--cache-type-k q8_0 --cache-type-v q8_0 -fa on— KV 캐시 약 절반, GGUF 파일과 상관없이 실행 시 지정
라이선스
- 라이선스: MIT — 원본 모델의 라이선스를 그대로 따름
- 권리: 원본 가중치·토크나이저는 Z.ai 소유, 이 리포는 양자화 파생물