Instructions to use RomanPokora/shapeq-q4lut-models with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use RomanPokora/shapeq-q4lut-models with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf RomanPokora/shapeq-q4lut-models # Run inference directly in the terminal: llama cli -hf RomanPokora/shapeq-q4lut-models
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf RomanPokora/shapeq-q4lut-models # Run inference directly in the terminal: llama cli -hf RomanPokora/shapeq-q4lut-models
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf RomanPokora/shapeq-q4lut-models # Run inference directly in the terminal: ./build/bin/llama cli -hf RomanPokora/shapeq-q4lut-models
Use Docker
docker model run hf.co/RomanPokora/shapeq-q4lut-models
- Llama new
- LM Studio
- Jan
- vLLM
How to use RomanPokora/shapeq-q4lut-models with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RomanPokora/shapeq-q4lut-models" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RomanPokora/shapeq-q4lut-models", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/RomanPokora/shapeq-q4lut-models
- Ollama
How to use RomanPokora/shapeq-q4lut-models with Ollama:
ollama run hf.co/RomanPokora/shapeq-q4lut-models
- Unsloth Desktop
- Pi
How to use RomanPokora/shapeq-q4lut-models with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RomanPokora/shapeq-q4lut-models
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "RomanPokora/shapeq-q4lut-models" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use RomanPokora/shapeq-q4lut-models with Docker Model Runner:
docker model run hf.co/RomanPokora/shapeq-q4lut-models
- Lemonade
How to use RomanPokora/shapeq-q4lut-models with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull RomanPokora/shapeq-q4lut-models
Run and chat with the model
lemonade run user.shapeq-q4lut-models-{{QUANT_TAG}}List all available models
lemonade list
- Hermes Agent
How to use RomanPokora/shapeq-q4lut-models with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RomanPokora/shapeq-q4lut-models
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default RomanPokora/shapeq-q4lut-models
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use RomanPokora/shapeq-q4lut-models with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf RomanPokora/shapeq-q4lut-models
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "RomanPokora/shapeq-q4lut-models" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Install from WinGet (Windows)
winget install llama.cpp
# Start a local OpenAI-compatible server with a web UI:
llama serve -hf RomanPokora/shapeq-q4lut-models# Run inference directly in the terminal:
llama cli -hf RomanPokora/shapeq-q4lut-modelsBuild from source code
git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -B build
cmake --build build -j --target llama-app# Start a local OpenAI-compatible server with a web UI:
./build/bin/llama serve -hf RomanPokora/shapeq-q4lut-models# Run inference directly in the terminal:
./build/bin/llama cli -hf RomanPokora/shapeq-q4lut-modelsUse Docker
docker model run hf.co/RomanPokora/shapeq-q4lut-modelsSHAPEQ / Q4_LUT model zoo โ fitted 16-level grids
Author: Roman S. Pokora ยท Independent researcher.
Paper: https://stiggigy-jpg.github.io/shapeq-paper/ ยท Code and paper repo: https://github.com/stiggigy-jpg/shapeq-paper ยท Runtime: https://github.com/stiggigy-jpg/shapeq-q4lut.
Two GGUF quantizations in Q4_LUT, the experimental weight-only format used by SHAPEQ
(shape-adaptive quantization). Every linear tensor decodes its 4-bit codes through a
fitted non-uniform 16-level grid (lookup table) plus an fp16 scale per group:
group 96 โ Q4_LUT, group 64 โ Q4_LUT64. The fit is deterministic, rests on classical
LloydโMax theory, needs no training or gradients, and changes only the alphabet, so it
composes with GPTQ, AWQ, rotations, sparse corrections, and mixed-precision allocation.
Requires our llama.cpp fork. These are not standard GGUF quant types. Upstream
llama.cppcannot load them; upstream support is not planned because the type ids are private. Build theshapeq-q4lutbranch and run as usual.
Files in this repository
| file | role |
|---|---|
smollm-135m-q4lut.gguf |
96-weight blocks, type Q4_LUT (44) |
qwen2.5-0.5b-q4lut.gguf |
64-weight blocks, type Q4_LUT64 (45) |
b4_smollm_shapeq.pt |
fitted pack: codes, scales, grids; hash in SHA256SUMS.txt |
b4_qwen_shapeq.pt |
fitted pack for Qwen2.5-0.5B |
b4_qwen_shapeq.pt.json |
perplexity and greedy-64 anchors for a rerun |
pack_q4lut.py |
repacks a fitted .pt into GGUF |
REPRODUCE.md |
baseline quants, fitting, packing, measurement |
SHA256SUMS.txt |
hashes of both GGUFs, both packs, and the anchor JSON |
The pre-fitted packs mean the GGUFs can be rebuilt without rerunning the fitter.
The fitter, its qb/ library, and all raw CSV/JSON results are in https://github.com/stiggigy-jpg/shapeq-paper.
SmolLM-135M (smollm-135m-q4lut.gguf)
| item | value |
|---|---|
| type id | GGML_TYPE_Q4_LUT (= 44, fork-private) |
| block | 96 weights = 1 fp16 scale + 48 bytes of 4-bit codes (50 B/block) |
| payload rate | 4.167 bits/weight on linear layers |
| per tensor | 16 fp32 grid values in GGUF metadata (q4lut.* keys) |
| what is quantized | 210 linear tensors (55.3 MB); embeddings/output stay f16 |
| file | smollm-135m-q4lut.gguf, 108.6 MB, 134.5 M params |
| pack | b4_smollm_shapeq.pt, 55.5 MB |
Measured with the fork's CPU build, AVX2, i7-10850H, 6 threads; corpus = first 240 KB of WikiText-2, ctx 512:
| quant | file, MB | ppl | pp512 t/s | tg128 t/s |
|---|---|---|---|---|
| q4lut | 108.6 | 20.73 | 229 | 54 |
| Q4_0 | 87.5 | 21.64 | 533 | 105 |
| IQ4_NL | 87.8 | 20.43 | 565 | 98 |
| Q4_K_M | 100.6 | 19.06 | 269 | 99 |
q4lut beats Q4_0 by about 0.9 ppl at a similar bit rate. It is slower to decode than the tuned upstream kernels (no repack-GEMM path), and IQ4_NL remains a stronger all-round point. These files demonstrate a fitted grid inside a real runtime, not a speed win. Full protocol: paper ยง6.11.
Qwen2.5-0.5B (qwen2.5-0.5b-q4lut.gguf)
Qwen2.5 hidden sizes are not divisible by 96, so this model uses the 64-weight block
variant (GGML_TYPE_Q4_LUT64, type id 45, 4.25 bpw), fitted with the same
Hessian-weighted procedure.
| item | value |
|---|---|
| type id | GGML_TYPE_Q4_LUT64 (= 45, fork-private) |
| block | 64 weights = 1 fp16 scale + 32 bytes of 4-bit codes (34 B/block) |
| payload rate | 4.25 bits/weight on linear layers |
| per tensor | 16 fp32 grid values in GGUF metadata (q4lut.* keys) |
| what is quantized | 168 linear tensors; embeddings/output stay f16 |
| file | qwen2.5-0.5b-q4lut.gguf, 446.9 MiB, 494.0 M params |
| pack | b4_qwen_shapeq.pt, 190.3 MB |
Measured with the same machine and settings (16-chunk ctx-512 slice):
| run | PPL | pp512 t/s | tg128 t/s |
|---|---|---|---|
| stock f16 GGUF | 15.83 | 210.0 | 12.8 |
| f16 dequantized (same grid, no LUT kernel) | 17.13 | โ | โ |
| q4lut (this file) | 17.13 | 67.1 | 13.2 |
| Q4_0 (reference) | 17.65 | 190.9 | 33.4 |
The q4lut kernel reproduces its own dequantized reference to 0.001 PPL; greedy 64-token continuations match the PyTorch fake-quant model token-for-token (EN and RU). The speed gap to Q4_0 is reported openly in paper ยงยง6.9โ6.11: this is a grid-shape study, not a kernel-speed study.
Loading
git clone -b shapeq-q4lut https://github.com/stiggigy-jpg/shapeq-q4lut llama.cpp && cd llama.cpp
cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j
./build/bin/llama-cli -m smollm-135m-q4lut.gguf -p "Hello" -n 64
Not supported on purpose
llama-quantizecannot produce or re-export this type (nofrom_float/to_float).- GPU backends have no kernel; CPU only.
- Upstream llama.cpp rejects the file as an unknown quant type.
Reproducibility
REPRODUCE.md rebuilds the baseline quants and the two Q4_LUT GGUFs from the shipped
packs. SHA256SUMS.txt gates both packs and both GGUFs. The fitter and raw tables are
in https://github.com/stiggigy-jpg/shapeq-paper; the two engines (legacy, hist) match the dates of the shipped
packs. Absolute perplexity can shift in the last decimal with BLAS reduction order.
Speeds are machine-specific. The LUT kernel is a reference implementation, not an
optimized one (paper ยง8).
Provenance and license
Weights derived from SmolLM-135M and Qwen2.5-0.5B (both Apache-2.0 upstream); these
derivatives are Apache-2.0 as well. Calibration used WikiText-2 train only. Model card,
format spec, and kernel: paper https://stiggigy-jpg.github.io/shapeq-paper/, fork FORMAT.md.
- Downloads last month
- 52
We're not able to determine the quantization variants.
Model tree for RomanPokora/shapeq-q4lut-models
Base model
HuggingFaceTB/SmolLM-135M
Install (macOS, Linux)
# Start a local OpenAI-compatible server with a web UI: llama serve -hf RomanPokora/shapeq-q4lut-models# Run inference directly in the terminal: llama cli -hf RomanPokora/shapeq-q4lut-models