WayToClawEarn
Medium impactHacker News

Practical guide for running AI models locally on M4 MacBook: 24GB of memory can run 128K context smoothly

A developer shared his complete experience of running a local AI model on an M4 MacBook Pro (24GB memory): Qwen 3.5-9B Q4 quantized model can achieve an inference speed of 40 tokens/s, supports 128K context windows and tool calls, and can be used with LM Studio and OpenCode to build a practical local AI development environment.

WayToClawEarn EditorialPublished May 11, 2026Updated Aug 8, 2026

Editorial review of public sources · AI-assisted drafting. How we work · Original source

Core conclusion

Local AI models are no longer toys. In May 2026, a developer (Johanna Larsson) successfully ran the Qwen 3.5-9B Q4 quantization model on an M4 MacBook Pro (24GB memory), achieving 40 tokens/s inference speed, 128K context window and available Tool Use capabilities. This practice shows that owning a mid-range MacBook is enough to build an AI development assistant that does not rely on cloud services.

Key Points

  • Event source: Hacker News hot post (229 likes), posted by Johanna Larsson on jola.dev
  • Core Findings: Qwen 3.5-9B Q4_K_S quantified as the only model that combines speed, context width, and tool availability on a 24GB M4 MacBook
  • Applicable people: Content creators, independent developers, small teams, who need local AI assistance but don’t want to pay for cloud APIs
  • Cost comparison: one-time hardware investment (M4 MacBook ≈ ¥12,000), no subsequent API fees

Background: The "Impossible Triangle" of local AI

For a long time, running AI models locally has faced an "impossible triangle":

DimensionsCloud API (such as GPT-5.5)Local model (Qwen 3.5-9B)Real-world impact
Reasoning quality✅ SOTA level⚠️ Needs step-by-step guidanceThe cloud API is stronger for complex tasks, and the local one is sufficient for regular tasks
Context window✅ 128K+✅ 128K (available in actual testing)There is not much difference in long document processing capabilities
Cost❌ GPT-5.5 price increase by 100%✅ Zero running costsLocal models have huge advantages in high-frequency usage scenarios
Privacy❌ Data sent to third party✅ Completely localThe only local choice for sensitive data scenarios
Response speed⚠️ Network delay 1-5s✅ 40 tokens/sContinuous interaction scenes are smoother locally
Setting complexity✅ Ready to use out of the box⚠️ Requires configuration of quantification/inference frameworkCertain technical threshold required

Best solution tested: Qwen 3.5-9B + LM Studio

After many attempts (Qwen 3.6 Q3, GPT-OSS 20B, Devstral Small 24B, Gemma 4B), the author finally confirmed that Qwen 3.5-9B Q4_K_S is currently the most balanced choice on the 24GB M4 MacBook.

Recommended configuration

json
// LM Studio
temperature: 0.6
top_p: 0.95
top_k: 20
min_p: 0.0
presence_penalty: 0.0
repetition_penalty: 1.0

// Thinking
// → → Prompt Template
// {% raw %}{% set enable_thinking = true %}{% endraw %}

Pi

json
{
  "providers": {
    "lmstudio": {
      "baseUrl": "http://localhost:1234/v1",
      "api": "openai-completions",
      "apiKey": "lm-studio",
      "models": [
        {
          "id": "qwen3.5-9b@q4_k_s",
          "reasoning": true,
          "compat": {
            "thinkingFormat": "qwen-chat-template"
          }
        }
      ]
    }
  }
}

OpenCode

json
{
  "provider": {
    "lmstudio": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "LM Studio (local)",
      "options": {
        "baseURL": "http://127.0.0.1:1234/v1"
      },
      "models": {
        "qwen3.5-9b@q4_k_s": {
          "name": "Qwen 3.5 9B Q4_K_S",
          "tools": true,
          "context_length": 131072,
          "max_tokens": 32768
        }
      }
    }
  },
  "model": "lmstudio/qwen3.5-9b@q4_k_s"
}

AI

vs SOTA

、****。

****。

「 SOTA ,,。,——。」

Hacker News 「Task Paralysis and AI」(221 )AI 。

  • ****、、
  • ****、、
  • ****、、

  1. LM Studio
  2. Hugging Face Qwen 3.5-9B Q4_K_S
  3. , Thinking
  4. API (LM Studio )
  5. AI (Pi OpenCode)

Apple Silicon (M4 Ultra / M5)(GGUF Q3/Q2),。,「 80% + API 20% 」,。

LM StudioOpenCodeQwenHugging FaceClaudeChatGPTOllamallama.cpp

Internal link guidance

Reference material

View source →

Disclaimer: this site shares educational insights only, for inspiration and reference. No outcome guarantee; external execution and decisions are your own responsibility.