Back to Blog
Photo from Unsplash

Article content

You cannot paste client data or proprietary source code into a cloud AI without a compliance conversation. Increasingly, you don't have to: a well-specced laptop can run capable open-weight models entirely offline, with long context windows and zero data leaving your machine.

The Privacy Problem

For millions of developers working in regulated industries (Finance, Health, Defence), the "AI Revolution" has been stuck behind a firewall. You cannot upload sensitive customer data or proprietary source code to a model provider without a clear answer on retention and training.

The practical answer is Local AI. We have reached the point where a high-end laptop (Apple Silicon with plenty of unified memory, or an NVIDIA-powered workstation) can run useful models entirely offline.

The Modern Private Stack

Local AI moves fast. New models drop regularly, Ollama updates its supported tags, and what runs well on today's hardware changes as quantisation improves. Treat the stack below as a starting point. The underlying principles (runtime, model, hardware budget) stay stable even as the specific tools evolve.

  1. Ollama (The Runtime): Still the simplest way to download, manage, and serve local models behind an OpenAI-compatible local endpoint. LM Studio and llama.cpp are solid alternatives if you want more control.
  2. A Model Sized for Your Machine: This is where most guides oversell. The model has to fit in memory alongside its context (KV cache), so pick by hardware budget first:
    • 16 to 32GB machines: the 8B to 32B class is the sweet spot. Qwen (including its coder variants), Gemma, Llama 3.x 8B, and OpenAI's open-weight gpt-oss-20b all run well at 4-bit quantisation and handle code explanation, refactoring, and review comfortably.
    • 64GB+ unified memory or multi-GPU: this is the entry point for Llama 4 Scout. It is a Mixture-of-Experts model with 109B total parameters (17B active per token), so even a 4-bit quant is roughly 60 to 67GB on disk and needs a high-RAM Apple Silicon machine or multiple GPUs. The small active count keeps it fast, but all 109B parameters still have to be in memory.
    • Llama 4 Maverick (400B total) is a server-class model. It is not a realistic local workstation option.
  3. Google AI Edge (On-Device): Google's suite for on-device AI. Gemini Nano and the AI Edge tooling run small models directly in Chrome or on mobile hardware with no server dependency. Useful for shipping private features to users, less so as a coding assistant.
  4. Your Editor Integration: Extensions such as Continue, or any tool that accepts a custom OpenAI-compatible endpoint, can point at the local server. Check each tool's documentation, because not every AI editor supports fully local models for every feature.

How to Get "Long Context" Locally

One of the biggest blockers for local AI was the context window. Early open models could only hold a few thousand tokens.

Many current open-weight models advertise 128k-token windows. Thanks to quantisation (GGUF/EXL2) and KV cache optimisations, you can run long contexts locally, but memory is the limit: a 100k-token context on a mid-sized model can need as much RAM as the weights themselves. On a 32GB machine, expect to trade model size against context length. For whole-repo questions, retrieval (indexing the repo and feeding relevant files) usually beats stuffing everything into one prompt.

Step-by-Step Setup

A basic local setup for a senior developer:

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
 
# Pull a model that fits your hardware (check the Ollama library for current tags)
ollama run qwen2.5-coder:14b
 
# Configure your editor extension (e.g., Continue)
# Point the API endpoint to http://localhost:11434

The Trade-offs

Be honest about what you lose when you go local:

  • Hardware Cost: 24 to 32GB of RAM or VRAM gets you the 8B to 32B class. Llama 4 Scout needs roughly 64GB+ of unified memory or a multi-GPU rig. Frontier cloud models remain out of reach locally.
  • Capability Gap: Local models are good, but the best cloud models are still noticeably stronger on complex multi-file reasoning. Use local where privacy matters, not as a like-for-like replacement.
  • Update Frequency: Cloud models update constantly. Local models require a manual ollama pull and you choose when to upgrade.
  • Power Usage: Running inference locally will drain your laptop battery significantly faster than calling a cloud API.

When to Go Local vs. Cloud

Use CaseRecommended PathWhy?
Personal projectsCloud (Claude/Gemini)Lower friction, stronger models
Sensitive Customer DataLocal (8B to 32B open-weight model)Data never leaves the machine
Proprietary IP / Core CodeLocal (or an enterprise cloud tier with contractual no-training terms)Removes third-party data exposure
UI Polish / CSS / RefactoringCloud (current frontier model)Higher accuracy on visual and multi-file work

The Future: Hybrid Intelligence

The most advanced teams are moving toward Hybrid Orchestration. They use cloud models for generic tasks and route to a secure local model whenever a "Privacy Filter" detects PII (Personally Identifiable Information) or sensitive source code.

That way you get AI assistance without the risk of an enterprise data breach.


Sources & References

Newer Post

Beyond the Static Frame: Architecting for Generative Video as a UI Primitive

Older Post

Beyond the Chatbox: Why 'Full Stack' Now Includes Model Engineering

Suggested Reading

Architectural Note: Research, drafting, and code for this post were augmented by Gemini (Google DeepMind), directed and verified by Maas Mirzaa. How this workflow works →