Instructions to use Myric/granite-4.0-h-tiny-APEX-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Myric/granite-4.0-h-tiny-APEX-GGUF", filename="granite-4.0-h-tiny-APEX-handroll.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Myric/granite-4.0-h-tiny-APEX-GGUF 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 Myric/granite-4.0-h-tiny-APEX-GGUF # Run inference directly in the terminal: llama cli -hf Myric/granite-4.0-h-tiny-APEX-GGUF
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Myric/granite-4.0-h-tiny-APEX-GGUF # Run inference directly in the terminal: llama cli -hf Myric/granite-4.0-h-tiny-APEX-GGUF
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Myric/granite-4.0-h-tiny-APEX-GGUF # Run inference directly in the terminal: ./llama-cli -hf Myric/granite-4.0-h-tiny-APEX-GGUF
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Myric/granite-4.0-h-tiny-APEX-GGUF # Run inference directly in the terminal: ./build/bin/llama-cli -hf Myric/granite-4.0-h-tiny-APEX-GGUF
Use Docker
docker model run hf.co/Myric/granite-4.0-h-tiny-APEX-GGUF
- LM Studio
- Jan
- vLLM
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Myric/granite-4.0-h-tiny-APEX-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Myric/granite-4.0-h-tiny-APEX-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Myric/granite-4.0-h-tiny-APEX-GGUF
- Ollama
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with Ollama:
ollama run hf.co/Myric/granite-4.0-h-tiny-APEX-GGUF
- Unsloth Studio
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Myric/granite-4.0-h-tiny-APEX-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Myric/granite-4.0-h-tiny-APEX-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Myric/granite-4.0-h-tiny-APEX-GGUF to start chatting
- Pi
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Myric/granite-4.0-h-tiny-APEX-GGUF
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Myric/granite-4.0-h-tiny-APEX-GGUF" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Myric/granite-4.0-h-tiny-APEX-GGUF
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:8080/v1 hermes config set model.default Myric/granite-4.0-h-tiny-APEX-GGUF
Run Hermes
hermes
- Atomic Chat new
- OpenClaw new
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf Myric/granite-4.0-h-tiny-APEX-GGUF
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:8080/v1 \ --custom-model-id "Myric/granite-4.0-h-tiny-APEX-GGUF" \ --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"
- Docker Model Runner
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with Docker Model Runner:
docker model run hf.co/Myric/granite-4.0-h-tiny-APEX-GGUF
- Lemonade
How to use Myric/granite-4.0-h-tiny-APEX-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Myric/granite-4.0-h-tiny-APEX-GGUF
Run and chat with the model
lemonade run user.granite-4.0-h-tiny-APEX-GGUF-{{QUANT_TAG}}List all available models
lemonade list
Granite-4.0-H-Tiny โ APEX GGUF
MoE-aware, mixed-precision APEX quantization of
ibm-granite/granite-4.0-h-tiny
โ IBM's hybrid Mamba-2 / Transformer MoE (granitemoehybrid): 40 layers = 36
Mamba-2 + 4 attention, a 64-routed + shared-expert MoE FFN on every layer, ~7B
total / ~1B active, Apache-2.0.
To my knowledge this is the first APEX quant of a Granite hybrid Mamba-2/MoE. APEX assigns precision per tensor role and per layer; here that meant teaching the recipe about the Mamba-2 mixer tensors the stock generator doesn't know (see Method).
Results
Perplexity on wikitext-2-raw (test, 200ร512-token windows), llama-perplexity.
| File | Size | BPW | PPL | ฮ vs bf16 |
|---|---|---|---|---|
| bf16 (reference) | 13 GB | 16.0 | 8.868 | โ |
| APEX i-quality (ssm@Q6) | 4.4 GB | 5.40 | 8.901 | +0.38% |
| APEX i-quality โ torch-imatrix | 4.4 GB | 5.40 | 8.864 | โ0.04% |
| APEX hand-roll (ssm@Q8) | 4.5 GB | 5.54 | 8.913 | +0.51% |
The torch-imatrix row is the same APEX i-quality recipe, quantized with an
importance matrix computed independently in PyTorch (see The torch-imatrix
variant) instead of llama-imatrix. Its PPL (8.864)
is inside the ยฑ0.11 error bar of both bf16 and the standard i-quality โ i.e. the
two imatrices are interchangeable in quality.
Within 0.38% of full-precision perplexity at ~3ร smaller, and it runs comfortably
on modest hardware (~14 GB bf16 โ 4.4 GB). Coherent, ~110 tok/s on a single GPU.
Built with a diverse imatrix (Bartowski calibration_datav3), full expert coverage.
Usage (llama.cpp)
llama-cli -m granite-4.0-h-tiny-APEX-i-quality.gguf -ngl 999 -p "Hello"
llama-server -m granite-4.0-h-tiny-APEX-i-quality.gguf -ngl 999 --host 0.0.0.0 --port 8080
Requires a llama.cpp build supporting the granitemoehybrid (a.k.a. granitehybrid)
architecture.
Method
APEX is a bit-allocation recipe over stock llama-quantize --tensor-type-file.
Granite-H needed the Mamba-2 mixer tensors added to the map, which the stock
APEX generator omits:
- Mamba-2 (36 layers):
ssm_in,ssm_conv1d,ssm_outat mixer precision (Q6_K); 1-D state (ssm_a,ssm_d,ssm_dt,ssm_norm) left F32. - Attention (4 layers): standard
attn_q/k/v/output(Q6_K). - MoE (all 40 layers): routed
ffn_*_expson a layer-depth precision gradient (Q6_K/Q5_K/IQ4_XS), shared expertsffn_*_shexpat Q8_0 (always active โ protect), router left high. Routed intermediate dim 512 is 256-divisible โ no IQ4_NL workaround.
Config generation + patcher: configs/, patch_granite_config.py, REPRODUCE.md.
Baseline: IBM's own bf16 GGUF.
Which file to pick, and a null result
Use i-quality โ smaller and better. The hand-roll tier (also shipped) pins
the Mamba-2 recurrence tensors (ssm_in/out/conv1d) to Q8_0 to test whether protecting
the linear-recurrence state helps: it doesn't โ it's larger and slightly worse
(4.5 GB, PPL 8.913 vs 8.901). Same null result seen on Kimi-Linear's KDA, so across two
hybrid architectures the SSM/recurrence tensors just aren't precision-sensitive. The
hand-roll is included to document the experiment; i-quality is the recommended tier.
The torch-imatrix variant
granite-4.0-h-tiny-APEX-i-quality-torch.gguf (+ granite-4.0-h-tiny-torch.imatrix)
is a companion build that answers one question: can the calibration imatrix be
produced without llama.cpp, and does that change the result?
What it is. An importance matrix (imatrix) records, per weight tensor, the
per-input-channel sum of squared activations over calibration text โ it tells
llama-quantize where to spend bits. Normally you get it from llama-imatrix,
which needs the whole model resident in RAM+VRAM. Here it was instead computed
directly from the Hugging Face model in PyTorch, by registering forward hooks
on every matmul (attention, Mamba-2 in/out projections, router, shared experts,
and per-expert routed FFNs) and accumulating ฮฃxยฒ as calibration text streams
through. The generator is band-serialized: it loads a few decoder layers at a
time, runs all calibration chunks through them, caches activations, frees them,
and moves on โ so peak VRAM is a few layers, not the whole model (this run
peaked at ~6.4 GB on a 16 GB card, vs the ~14 GB a full-resident forward needs).
That decouples imatrix generation from llama.cpp's memory model: you can calibrate
a model far larger than your GPU by streaming it in bands.
Everything else is identical. Same bf16 base, same APEX --tensor-type-file
recipe, same calibration_datav3, same 126ร512 calibration windows. The only
difference from the standard i-quality file is which tool produced the imatrix.
The two quants therefore differ only in the tensors whose quantization
consumes an imatrix (the K-/I-quant expert, attention and Mamba weights); the
Q8_0 shared experts and F32 tensors are bit-identical.
Validation. The PyTorch imatrix matches llama-imatrix's output tensor-for-
tensor (368/368 names) with median per-tensor correlation 0.995. The handful
of lower-correlation tensors are the post-nonlinearity inputs (ffn_down_shexp,
attn_output) where transformers' naive Mamba scan and SiLU-gated intermediates
differ numerically from llama.cpp's kernels โ a known wrinkle that does not affect
quality, since the quantizer only needs relative per-channel importance. The
proof is in the table above: the torch-imatrix quant scores PPL 8.864, inside
the ยฑ0.11 error bar of both bf16 and the standard i-quality. The two imatrices are
interchangeable.
Pick whichever you like โ they are equivalent in quality. The standard
i-quality is the reference; the torch build is provided for anyone who wants a
llama.cpp-free, VRAM-bounded path to the same result (e.g. calibrating very large
MoEs on modest hardware).
Attribution & licenses
See LICENSE (Apache-2.0) and NOTICE.
- Base: IBM (@ibm-granite) โ granite-4.0-h-tiny (Apache-2.0)
- Engine: llama.cpp (@ggml-org) (MIT)
- APEX: Ettore Di Giacinto / LocalAI (@mudler) โ localai-org/apex-quant (MIT)
- Calibration: Bartowski (@bartowski) โ calibration_datav3
Unofficial community quantization; not affiliated with or endorsed by IBM.
- Downloads last month
- 354
We're not able to determine the quantization variants.
Model tree for Myric/granite-4.0-h-tiny-APEX-GGUF
Base model
ibm-granite/granite-4.0-h-tiny