GLM Reduce β€” reproducible CPU inference

Author: Charles Xu. Model: frozen 2026-10-09, 986,520 parameters, FP32. Packaging release: cpu-inference-v1.2.1 (2026-10-13). Inference now uses the pinned implementation's default attention selection; weights are unchanged.

This directory is the complete web/CLI inference package. The GitLab release is the canonical version; Hugging Face is published directly from a clean, pushed commit of this directory. There is no separate publication source tree.

Install and run on Windows

Tested with Windows x64, Python 3.14.7 and torch 2.14.0+xpu executing on CPU. Use Python 3.14 x64. The lock file preserves the measured environment; other platforms/builds are not claimed validated.

Set-Location <your-clone-directory>
.\setup.ps1 -Python python
.\start_web.ps1

Open http://127.0.0.1:8765/. Stop the foreground service with Ctrl+C. For an offline installation, pass -Wheelhouse <saved-reproducibility-directory> to setup.ps1. The Python interpreter and dependency packages must be available; the virtual environment is created locally and is not committed. The complete pinned upstream source is included in upstream_model/transformers/. Runtime imports directly from its src directory; upstream updates and other installed Transformers copies do not affect this package. Startup does not perform a source hash check. verify_release.py is an optional manual integrity audit.

The page accepts a reference picture, GIF or browser-decodable MP4/WebM, and a supported English question. GIF is decoded by the server; MP4/WebM is decoded in the browser. Browser resizing and original frame sampling are preserved. The 32-word vocabulary is defined in runtime.py. This synthetic research model does not support arbitrary questions or native Chinese prompts.

Fixed learning input

  • Reference: examples/0000_ref0.png (yellow circle, 64x64).
  • Video: examples/0000_video.gif (64x64, eight frames).
  • Question: what motion of reference in clip.
  • Expected model tokens: left, left (target position, then motion direction).
.\.venv\Scripts\python.exe infer.py
.\.venv\Scripts\python.exe infer.py --image examples/0000_ref1.png --video examples/0000_video.gif
.\.venv\Scripts\python.exe infer.py --question "what color of reference" --tokens 1
.\.venv\Scripts\python.exe verify_release.py

CLI supports GIF and horizontal eight-frame PNG strips. Use the web interface for MP4/WebM. Both web and CLI use the same Engine and GIF decoder. Fixed 64x64 inputs retain their original pixels; arbitrary resized images may differ between browser canvas interpolation and Pillow.

What runs

server.py handles HTTP. preprocess.py decodes GIF using the original duration-centred sampling. runtime.py normalizes pixels, lays out patches, maps the finite vocabulary, and invokes the original model forward. Joint generation is one prefill generating a position token, followed by one cached decode generating a direction token. It uses greedy argmax, not model.generate(). No true target or direction label is supplied at inference.

Core network implementation: unchanged Transformers Glm5Next, commit 0291458166a6834a37b179a24c5235f242dadea0. The archive and model file hashes are in upstream_model/source_identity.json. Only the small configuration instantiates the reduced network. The newly trained weights are in weights/model.safetensors. Official pretrained weights were not pruned or distilled. No claim of being an official GLM release is made.

Attention implementation

Runtime does not override _attn_implementation. The pinned Transformers implementation selects SDPA on the validated CPU environment. Selection can depend on environment; this is not a claim that every layer uses SDPA (KDA has its own path). Trace collection should record the actual selected backend and environment.

Current evaluation (2026-10-13)

Default SDPA, deployed Engine.predict, CPU FP32: 500 frozen independent scenes, two references and four tasks, 4,000 answers. Color 97.7%, shape 97.0%, text-selected motion 74.2%, reference-selected motion 83.2%; overall 88.025%. Weights were trained with eager and remain unchanged. This re-evaluates the existing test set; no training, tuning or checkpoint selection was performed.

For comparability, the reference-motion score counts correct direction with a valid left/right selector. Requiring both correct position and direction gives 81.2%. Reversed reference-motion accuracy: 84.0%; stationary: 96.6% (same comparable metric). Both references are evaluated in every scene; paired correctness is recorded in weights/evaluation.json. All 3,000 joint normal/reversed/stationary calls pass cached-decode versus full-prefix logit checks (atol=3e-5, rtol=3e-4), with identical argmax tokens; maximum absolute difference 1.2874603271484375e-05. This is model-forward validation, not trace replay.

Publication and reuse

.\.venv\Scripts\python.exe publish_hf.py
.\.venv\Scripts\python.exe publish_hf.py --publish

Authenticate with Hugging Face locally first. The script requires a clean Git worktree whose HEAD is pushed to origin/main. It publishes the full runnable package to gter1216/glm-reduce-1m-code, and the weight subset to gter1216/glm-reduce-1m-multimodal-fp32. Both receive the same source commit identifier. The code repository now includes weights; the separate weights repository remains a compatible download endpoint. Generated publication receipts stay local. Training and trace artifacts are not part of this package.

Trace tools should clone a fixed commit/tag and call this package. CPU reference inference can directly call model.forward; an architecture replay backend compares logits, tokens and cache/state with that reference. No hardware backend is supplied here.

Project additions and weights: Apache-2.0, Charles Xu. Preserve upstream copyright notices; see LICENSE and NOTICE.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support