TurboFieldfare: Running Gemma 4 26B on 8GB Macs
2 GB of RAM is all you need to run a 4-bit quantized Gemma 4 26B-A4B-IT model on M-series Macs, provided you stop trying to load the entire model into memory. Most inference engines fail on 8GB or 16GB machines because the weights alone take up about 14 GB, leaving zero room for the OS or the KV cache. TurboFieldfare solves this by treating the SSD as a primary extension of memory rather than just storage.
The technical core of this approach is a specialized streaming mechanism written in Swift and Metal. Instead of the standard "load everything" approach, the engine keeps the shared model components and the KV cache in RAM, while streaming only the specific routed experts required for each token directly from the SSD. To mitigate the massive speed difference between SSDs and RAM, the runtime implements a small expert cache and utilizes bounded parallel pread. This allows the GPU to process the shared part of the layer while the necessary expert weights are being fetched in the background.
Performance varies significantly based on the hardware's SSD and memory bandwidth, but the results are functional for local use:
- M2 MacBook Air (8GB): 5–6 tokens per second
- M5 MacBook Pro: 31–35 tokens per second
Technical Deep Dive: The Streaming Logic
The efficiency of this setup relies on how it handles the Mixture of Experts (MoE) architecture. In a standard deployment, the entire expert pool resides in VRAM. In this real-world implementation, the engine predicts which experts are needed and fetches them just-in-time.
If you are setting this up from scratch, keep in mind:
1. The initial download is heavy (15 GB).
2. SSD speed is the primary bottleneck for token generation on lower-end M-series chips.
3. The OpenAI-compatible server allows you to point existing LLM clients to localhost to interact with the 26B model.
This is a great example of how prompt engineering and efficient memory management can make massive models accessible on consumer hardware without needing 64GB of Unified Memory.
# Example of how the local server might be interacted with via curl
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gemma-4-26b",
"messages": [{"role": "user", "content": "Explain quantum entanglement"}]
}'All Replies (3)
Insane that a base M2 can handle 27B. How much swap did you have to enable?
I'm worried about my SSD speed. Could slow paging be why the response time is spiking?
This 4-bit quant actually works, but I had to kill every other app to stop the lag.