Gemma 4 12B with llama.cpp: MTP setup and local tests

Learn how the speaker sets up Gemma 4 12B with MTP in llama.cpp, reporting about 40 tokens per second on an M5 Pro with 48 GB unified memory.

Player not loading? Watch on YouTube

This tutorial tests Gemma 4 12B as a local LLM using llama.cpp and an 8-bit dynamic GGUF quantization from Unsloth. The speaker runs it on an M5 Pro with 48 GB of unified memory. He cites Google's roughly 14 GB memory estimate for 8-bit weights, while reporting about 19 to 20 GB for his running server setup.

The setup uses llama-server's OpenAI-compatible endpoint, temperature 1 and multi-token prediction with a maximum draft of two. The speaker reports that MTP increased output speed by roughly 2 to 2.5 times in his testing, with a short response reaching around 40 tokens per second. A Python OpenAI client connects to the local server for the subsequent prompts.

Results vary across tasks. The model fails the car-wash reasoning question and produces an incomplete SVG. It generates a readable resume website and a boat game with waves, though shooting and game-over behavior appear incomplete. Receipt OCR gives useful structured output in the speaker's checks, but one older receipt takes over seven minutes. Financial table extraction includes incorrect and invented numbers, and a heat-map lookup also fails.

The speaker recommends keeping larger models for coding and document understanding. He suggests text-only RAG or small tool-calling tasks as possible uses, and prefers Gemma 4's larger mixture-of-experts model at 4-bit over the 12B model at 8-bit.