It is such an incredible point in human history to be deeply interested in technology and software engineering. As a veteran generalist with a relatively deep understanding of internet infrastructure, operating systems, security, software engineering, design, product ownership, and human collaboration, I have never been as excited about our future as I am today. Sure, there are substantial downsides to artificial intelligence, but in my opinion the reward potential far exceeds the drawbacks we have yet to overcome (i.e., copyright, environmental, misuse, abuse).
Today’s cloud coding harnesses and models are truly awesome. I have spent so many hours with claude, copilot, and agy. The problem we all end up running into is monthly subscription/token spends, hitting rate limits mid-task, or the inability to use these tools when you’re working on a codebase or task that can’t leave your local machine.
If you’re running Apple Silicon with a decent amount of unified memory, local models have reached the point where they can power an agentic terminal harness without feeling like you’re driving a Model T. Personally, I am still using an old 2021 MacBook Pro M1 Pro with 32 GB of RAM. The sweet spot for me seems to be a sparse Mixture-of-Experts (MoE) model that is large enough to hold the framework knowledge, but activating only a few billion parameters per token so generation is as fast as possible on the M1 Pro’s slower 200 GB/s memory bandwidth.
Out of everything I have read and tested, my current local setup consists of:
- LM Studio — as the local OpenAI-compatible inference server, running its native Apple Silicon MLX backend.
- Google’s
gemma-4-26b-a4b-qat(4-bit MLX) — 25.2B total / 3.8B active Mixture-of-Experts (MoE) model with 128 routed experts, native thinking mode, vision support, and reliable function calling that fits comfortably inside my 32 GB memory restrictions. - Pi — a fast, minimal terminal coding agent that doesn’t burn 6,000 tokens of system prompt boilerplate on every turn.
If you’re interested in finding out exactly how to run this, including my recommended model tuning options, please continue reading.
Step 1: Install and Configure LM Studio
- Download and install LM Studio for Apple Silicon.
- Open Settings (the gear icon in the bottom-left)
- Click Runtime to make sure the LM Studio MLX runtime pack is installed and up to date so it supports the
gemma4architecture. - Next (still in Settings), click Model Defaults and set Default Context Length to Custom value:
65536. Why cap it?gemma-4-26b-a4b-qatsupports up to 256K context natively. Leaving LM Studio on Model maximum on a 32 GB MacBook Pro will push past your available unified memory and force macOS into SSD swap. Capping at 32K–64K leaves ~12–14 GB free for macOS, Docker, and your editor. - Leave Model loading guardrails at Balanced (or set to Relaxed), so LM Studio warns you before loading anything that exceeds physical RAM.
Step 2: Download Gemma 4 26B A4B QAT (4-bit MLX)
- In LM Studio, open the Model Search (magnifying glass) tab and search for: Gemma 4 26B A4B QAT
- Select the
[MLX] Gemma 4 26B A4B Instruct QAT [4bit]build (~15.64 GB) and download it.
Make sure that you select this specific build: LM Studio’s curated packaging automatically wires up its thinking parser (<|channel>thought), tool-calling template, and model presets out of the box. It is also a free quality upgrade at the exact same RAM footprint—because QAT trains the model specifically to resist 4-bit rounding errors, you get noticeably sharper multi-file reasoning and cleaner tool-call formatting in Pi while using the exact same ~16 GB of memory.
Step 3: Tune LM Studio’s Load & Inference Settings
Before starting the local server, open the model’s right-hand configuration drawer and verify both tabs:
In the Load Tab
- Context Length:
65536 - Max Concurrent Predictions:
2 - Seed: Unchecked
- KV Cache Quantization: Disabled
- Prompt Disk Cache: Enabled
In the Inference Tab
- Custom Fields →
- Enable Thinking: Enabled
- Settings →
- Temperature:
0.5(or 0.6, which prevents argument drift and missing parameters when Pi emits multi-stepreadandedittool calls) - Context Overflow: Stop at Limit (this prevents LM Studio from silently dropping files mid-session and lets Pi trigger its own compaction cleanly)
- Temperature:
- Sampling →
- Repeat Penalty: Unchecked (anything above
1.0breaks closing braces, variable names, and repeated code patterns)
- Repeat Penalty: Unchecked (anything above
Click Load Model, then open the Developer (terminal icon) tab on the left sidebar and toggle Start Server on http://localhost:1234.
Step 4: Install Pi
Pi is a minimal agent harness. While I really like OpenCode, I prefer Pi on an M1 Pro because its minimal system prompt (~1,200 tokens) means it’s the fastest option I can find on this particular hardware. Installation is pretty typical. You can read the full quickstart guide if you want more details, but essentially:
curl -fsSL https://pi.dev/install.sh | sh
Verify the install:
pi --version
Step 5: Wire Pi to LM Studio (models.json)
Create a ~/.pi/agent/models.json file to register your local LM Studio server:
mkdir -p ~/.pi/agent
Add the following configuration:
{
"providers": {
"lmstudio": {
"baseUrl": "http://localhost:1234/v1",
"api": "openai-completions",
"apiKey": "local",
"models": [
{
"id": "google/gemma-4-26b-a4b-qat",
"name": "Gemma 4 26B-A4B QAT (LM Studio)",
"reasoning": true,
"input": [
"text"
],
"contextWindow": 65536,
"maxTokens": 16384,
"compat": {
"supportsDeveloperRole": false,
"supportsReasoningEffort": false,
"maxTokensField": "max_tokens"
}
}
]
}
}
}
Two settings here prevent subtle headaches:
maxTokens: 16384:Gemma 4 26B-A4B QATuses interleaved thinking before and between tool calls. Capping output at4096or8192can clip a turn mid-thought before it emits anedittool call.supportsDeveloperRole: false: Prevents Pi from sending OpenAI’s newerdeveloperrole, which local servers often drop—causing the model to ignore Pi’s tool instructions.
Step 6: Launch Pi and Start Coding
Navigate to any local repository and launch Pi:
cd ~/Projects/your-repo
pi
Once Pi starts:
- Press
Ctrl+L(or type/model) to open the model selector and pickGemma 4 26B-A4B QAT (LM Studio), which is typically at the very bottom of the list. - Press
Shift+Tabto cycle the thinking level—the editor border color changes to reflect the active reasoning level (lowis usually plenty for fast day-to-day coding tasks). - Test the full loop—file reads, reasoning, and exact-match edits—with a focused read-only task:
Read the authentication configuration files and summarize how authentication is handled. Don't modify anything yet.
You should see Pi render a collapsible thinking block as gemma-4-26b-a4b-qat plans its inspection, execute read or bash (rg/find) tool calls cleanly without raw delimiter tags, and return a structured summary—running 100% locally and offline on your 32 GB M1 Pro.
For a walkthrough of Pi’s model switching, thinking levels, and terminal workflow, check out Pi Agent – Crash Course | Minimal Coding Agent, which covers the core REPL shortcuts and customization basics.
If you’ve been exclusively using your favourite Cloud-based coding harness for any length of time, using this setup will feel different. Slower. Perhaps a bit more like last year. Don’t let that deter you though. The gemma-4-26b-a4b model is great, and you get used to the speed in a few weeks. Another thing you can do is use your local models to implement the planning work done by your favourite frontier model. Spend the time doing your planning up front, then pass off the specs and plans to your local model to implement overnight.
Do you have any improvements to share with my local setup? Please reach out by email, leave a comment below, or connect with me on Mastodon.