Instructions to use leok7v/gemma-4-12b-it-qat 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 leok7v/gemma-4-12b-it-qat 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 leok7v/gemma-4-12b-it-qat # Run inference directly in the terminal: llama cli -hf leok7v/gemma-4-12b-it-qat
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf leok7v/gemma-4-12b-it-qat # Run inference directly in the terminal: llama cli -hf leok7v/gemma-4-12b-it-qat
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 leok7v/gemma-4-12b-it-qat # Run inference directly in the terminal: ./llama-cli -hf leok7v/gemma-4-12b-it-qat
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 leok7v/gemma-4-12b-it-qat # Run inference directly in the terminal: ./build/bin/llama-cli -hf leok7v/gemma-4-12b-it-qat
Use Docker
docker model run hf.co/leok7v/gemma-4-12b-it-qat
- LM Studio
- Jan
- Ollama
How to use leok7v/gemma-4-12b-it-qat with Ollama:
ollama run hf.co/leok7v/gemma-4-12b-it-qat
- Unsloth Studio
How to use leok7v/gemma-4-12b-it-qat 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 leok7v/gemma-4-12b-it-qat 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 leok7v/gemma-4-12b-it-qat to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for leok7v/gemma-4-12b-it-qat to start chatting
- Pi
How to use leok7v/gemma-4-12b-it-qat with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf leok7v/gemma-4-12b-it-qat
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": "leok7v/gemma-4-12b-it-qat" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use leok7v/gemma-4-12b-it-qat with Docker Model Runner:
docker model run hf.co/leok7v/gemma-4-12b-it-qat
- Lemonade
How to use leok7v/gemma-4-12b-it-qat with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull leok7v/gemma-4-12b-it-qat
Run and chat with the model
lemonade run user.gemma-4-12b-it-qat-{{QUANT_TAG}}List all available models
lemonade list
- Hermes Agent
How to use leok7v/gemma-4-12b-it-qat with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf leok7v/gemma-4-12b-it-qat
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 leok7v/gemma-4-12b-it-qat
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use leok7v/gemma-4-12b-it-qat with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf leok7v/gemma-4-12b-it-qat
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 "leok7v/gemma-4-12b-it-qat" \ --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"
Model Card for gemma-4-12B-it (QAT, GGUF)
A GGUF repack of Google's quantization-aware-trained gemma-4-12B-it build, packaged to run on device. The tokenizer, the merge table and the chat template are embedded, so nothing ships alongside the file and nothing calls out to a server at inference time.
This repository holds the repacked weights only, not training data or the original checkpoint.
Model Details
Model Description
gemma-4-12B is the "unified" member of the Gemma 4 family, and it is built differently from the E2B / E4B mobile models. There are no per-layer embeddings, no shared key/value layers, and — the part that surprises people — no vision tower and no audio tower. Multimodality is encoder-free: an image becomes 48x48 raw pixel patches through a LayerNorm/Dense pair plus a factorized 2-D position table, and audio is a 640-sample frame of raw 16 kHz waveform through a single projection. Both land directly in the language model's embedding space.
Attention alternates five sliding-window layers to one full-attention layer, and the two kinds differ in more than the window. A sliding layer is 16 query heads over 8 key/value heads at 256 wide with a RoPE base of 10 000. A full layer is 16 query heads over one key/value head at 512 wide, with proportional RoPE at base 1 000 000, and it carries no value projection at all: key and value share one projection, the value branch taking it before the key norm and the rotation.
The upstream checkpoint is quantization-aware TRAINED, not post-hoc quantized.
- Developed by: Google (base model); GGUF repack by leok7v
- Model type: Multimodal (text, image, audio) causal language model
- Language(s): the languages of the base model
- License: Apache 2.0, inherited from the base model; see the Gemma 4 license
- Repacked from model: google/gemma-4-12B-it-qat-q4_0-unquantized
Model Sources
- Repository (this build): https://huggingface.co/leok7v/gemma-4-12b-it-qat
- Base model: google/gemma-4-12B-it-qat-q4_0-unquantized
Uses
Direct Use
On-device assistants and chat in offline or privacy-sensitive settings where prompts must not leave the device.
Out-of-Scope Use
Not for tasks requiring verified factual accuracy, and not a basis for legal, medical, financial, or safety decisions. Not intended for high-stakes automated decisions without human review.
Bias, Risks, and Limitations
A language model predicts plausible text; it does not verify facts and has no understanding of truth. Output can be confident and still be wrong, incomplete, or biased. The base model's biases and limitations carry over; see the base model card.
Recommendations
Treat every response critically and check important output against a trusted source.
How to Get Started with the Model
The tokenizer (262 144 tokens, 514 906 merges, byte fallback and metaspace) and
the chat template are embedded in the file, so a runtime reads both from the
GGUF rather than from sibling files. The checkpoint's own config.json,
generation_config.json, processor_config.json and tokenizer_config.json
are carried verbatim as metadata, which is where the reasoning and tool-call
parsing contract lives.
Follow the base model card's guidance: sampling at temperature 1.0,
top_p 0.95, top_k 64 (these are recorded in the file), thinking enabled by
a <|think|> token at the start of the system prompt, image content placed
before the text and audio content after it.
Technical Specifications
Model Architecture and Objective
| Property | Value |
|---|---|
| Objective | Autoregressive next-token prediction |
| Hidden size | 3840 |
| Layers | 48 (40 sliding-window + 8 full attention) |
| Feed-forward | 15360, gated GELU |
| Attention heads | 16 query; 8 key-value sliding, 1 key-value full |
| Head width | 256 sliding, 512 full |
| Key equals value | yes, on the full-attention layers |
| Sliding window | 1024 |
| RoPE base | 10 000 sliding, 1 000 000 full (proportional, 0.25) |
| Vocabulary | 262 144, embeddings tied to the output head |
| Logit softcap | 30 |
| Context | 262 144 |
| Vision | encoder-free: 48x48 pixel patches, factorized 2-D positions |
| Audio | encoder-free: 640 raw samples per token, one projection |
Weight format
6.823 GB, 677 tensors, GGUF v3, 16384-byte tensor alignment.
| Type | Tensors | Covers |
|---|---|---|
| Q4_0 | 329 | every attention and MLP projection, the embedding table |
| BF16 | 348 | norms, layer scalars, both multimodal projections |
Repacking, and why it is lossless
-q4_0-unquantized does not mean "not quantized". Training rounded every
weight of a 32-wide block onto a 16-level grid w = (q - 8) * d, and the
checkpoint then stored the product in bf16. The codes are still in there.
So this repack recovers (q, d) rather than quantizing again. That
distinction is measurable: ggml's quantizer picks d from the block's signed
extreme as max / -8, which is lossy for any block whose extreme is positive,
and would choose fresh codes for weights that were trained where they sit.
Every block is verified individually — a block is written only if q * d,
with d already cast to the fp16 a block header stores, reproduces all 32
values to within one bf16 ulp. All 11.8 billion weights passed. A single
mis-assigned code would land at least d/2 away, eight times that tolerance,
so the check cannot pass a corrupted tensor.
The consequence is that the reconstructed weights are closer to the trained
values than the bf16 checkpoint is: the checkpoint holds
round_bf16(d * (q - 8)) while this file holds (d, q) and reconstructs in
fp32.
Measured against Google's own 4-bit release
Google also publishes
gemma-4-12B-it-qat-w4a16-ct,
a compressed-tensors int4 build (group 32, symmetric, memoryless_minmax
observer) intended for vLLM. It and this file derive from the same
q4_0-unquantized
checkpoint, so both can be scored against it directly.
Relative weight error against that bf16 checkpoint:
| tensor | this repack | w4a16-ct |
|---|---|---|
gate_proj layer 0 |
1.03e-03 | 6.66e-02 |
q_proj layer 0 |
1.07e-03 | 6.67e-02 |
down_proj layer 30 |
1.10e-03 | 6.66e-02 |
About 65x closer to the trained weights.
That is not a better search. The int4 codes agree 99.40% between the two
files, so both recover the same trained grid; w4a16-ct is an independent
witness that the recovery is right. The scales are what differ, its own
running a median 1.0645x larger: a min/max observer takes d from the block's
extreme, where this repack refits d by least squares over the settled codes.
Same codes, different d.
w4a16-ct is better on exactly one tensor. It leaves token_embd in bf16 and
therefore exact, at 1.88 GiB against 0.53 GiB here, which is most of the
difference between its 9.56 GiB and this file's 6.35 GiB.
Both files leave the same modules unquantized: the vision patch dense, both multimodal projections, and the position table.
Citation
Please cite the upstream Gemma model. See the base model card at google/gemma-4-12B-it-qat-q4_0-unquantized for the canonical reference and license.
Model Card Contact
leok7v on Hugging Face.
- Downloads last month
- 583
We're not able to determine the quantization variants.
Model tree for leok7v/gemma-4-12b-it-qat
Base model
google/gemma-4-12B