Local AI Models: Hardware, Runtimes and Real Work
Local AI models explained for builders: what they are, how much memory you need, which runtime to pick, and how to give them tools and approvals.

A local AI model is a set of neural-network weights that runs on hardware you control instead of a provider's servers. Running one is a memory-sizing problem plus a runtime choice. The harder problem comes after the model answers: it needs tools, permissions and approvals before it does anything useful. Melaya is bring-your-own-model, so the same agents and tools work with Claude, GPT, Gemini, DeepSeek, Mistral, Qwen, Ollama and LM Studio. You pick the model, and Melaya supplies the controlled hands.
TL;DR
- Local AI means the model and the software around it run on computers you control. Stanford's guide splits it into hardware, model weights, an inference engine and an agent harness.
- Size memory first. At Q4 quantization a model needs about a quarter of its 16-bit footprint, and it should fill no more than roughly 65% of your GPU or unified memory.
- Most runtimes (Ollama, llama.cpp, vLLM, SGLang) expose an OpenAI-compatible API, so tools written for a cloud model can point at a local one.
- A model alone only produces text. Tools, memory, schedules and human approval turn it into automation.
- Local does not automatically mean private or offline. Check what your agent calls out to.
What local AI models are
Stanford's Guide to Local AI defines local AI as running a model and the software around it on computers you control, rather than relying on a cloud AI whose key components execute remotely. A local system can still reach the internet or cloud services when you enable them. It has four parts:
- Hardware: CPU, GPU or unified memory.
- Model: the trained weights, a file on disk.
- Inference engine: the program that loads the weights and generates tokens.
- Agent harness: the layer that manages conversations and actions.
Once the weights are on disk, inference needs no internet connection. Ollama is the common on-ramp, and llama.cpp is the C/C++ engine underneath much of the ecosystem, Ollama included.
Two terms get confused. "Open-weight" describes a license and a download. "Local" describes where inference runs. Harvard Chan School states that the two are separate concepts, and that a local agent may still call external search services or send remote logs. If privacy is the goal, audit the harness, not just the model.
Why teams run models locally
The reasons cluster into five:
- Data control. Hugging Face's docs name privacy (your data is not sent to a remote server) and speed (your hardware is the limit, not the connection).
- Compliance. Microsoft Learn notes that cloud use requires data transfer that must comply with regulations such as GDPR or HIPAA depending on data and region. Local models keep data on the device.
- Cost shape. Hardware is a fixed cost. Omdia's research says near-zero marginal cost after the initial investment enables unlimited experimentation.
- Fewer dependencies. Modular lists performance control without provider SLA limits and fewer external dependencies.
- Reproducibility. The University of Galway guide points to pinned model versions, fine-tuning and offline use.
The same Omdia report finds that three-quarters of enterprises worry about data leakage through cloud services, and that 57% of enterprise models are under 10 billion parameters, small enough for a MacBook Air or an entry-level MacBook Pro. Local is a realistic option for ordinary business workloads, not only for labs.
Sizing hardware: parameters, quantization, memory
Model size in parameters decides memory. Quantization (storing weights in fewer bits) shrinks it.
Stanford gives the arithmetic: a 16-bit (BF16) model needs roughly parameters × 2 bytes, so a 27B model needs about 54 GB. At Q4 it needs 25% of that, around 14 GB. Performance drops quickly below Q4.
AI Wiki, citing llama.cpp figures for Llama 3.1, shows the same pattern at every size:
| Llama 3.1 size | Original precision | Q4_K_M |
|---|---|---|
| 8B | 32.1 GB | 4.9 GB |
| 70B | 280.9 GB | 43.1 GB |
| 405B | 1,625.1 GB | 249.1 GB |
Rules of thumb that hold up
- Keep the model at 65% or less of available specialized memory (GPU VRAM or unified memory). The rest goes to the KV cache and runtime data. On unified-memory machines, leave 6 to 16 GB for the OS.
- The KV cache grows with context window. Ollama's default context is 4k tokens below 24 GiB VRAM, 32k at 24 to 48 GiB, and 256k at 48 GiB or more. AI Wiki recommends 64,000 tokens for agents and coding tools, so plan memory for that, not the default.
- Per the University of Galway guide: about 8 GB runs roughly 7B models, 16 GB roughly 14B, 20 to 24 GB quantized 27 to 32B models, and 48 GB or more runs 70B-class models.
A worked example
You want a 32 GB GPU box to run a Qwen-family model for an agent that needs 64k context. A 35B-class model at Q4_K_M is about 22 GB according to DIY Lab Hub's VRAM guide. That is about 69% of 32 GB, already over the 65% rule before the long-context KV cache. Drop to a 30B-class model (about 19 GB, roughly 59%) and you have headroom. Do this arithmetic before you download anything.

Choosing a model for your workload
Start from the task, not the leaderboard. Modelplane's inference guide advises matching use case to requirements: coding agents need long context and reliable tool-call parsing, chat needs low time-to-first-token. It also suggests starting with a small mixture-of-experts model to build operating experience, checking that your engine can load the model, and reading the license for commercial-use restrictions.
NVIDIA's developer guide recommends Q4_K_M checkpoints for the best performance-to-quality balance, and building a custom evaluation dataset from your own use case, graded by humans. Public benchmarks measure someone else's workload.
A practical selection loop:
- Write 30 to 50 real inputs from your workflow with the output you expect.
- Run two or three candidate models at Q4_K_M.
- Grade the outputs by hand and record tokens per second and peak memory.
- Re-test at your real context length. Modelplane warns that a model that fits at startup can run out of memory under real load days later.
The University of Galway guide adds that local models can still hallucinate and that "open weights" does not mean "no conditions" in the license. Both are reasons to add verification and approval steps, covered below.
Picking a runtime
The runtime loads the model and serves it. Hugging Face lists 18 local apps, including llama.cpp, LM Studio, Jan, Ollama, vLLM, SGLang and MLX LM. The useful split, following NVIDIA's backend guide and Union.ai's documentation:
| Runtime | Best for | Notes |
|---|---|---|
| Ollama | Minimal-setup small models | Supports NVIDIA, AMD via ROCm, Apple Metal |
| LM Studio | Desktop app with a GUI | On Windows needs AVX2, 16 GB RAM recommended |
| llama.cpp | Quantized GGUF, CPU-only, embedding | llama-server exposes an HTTP API |
| vLLM | High-throughput shared serving | Linux, NVIDIA compute capability 7.5+ |
| SGLang | Prefix-heavy chat, RAG, agent traffic | Production-grade serving |
Hardware notes come from AI Wiki. One benchmark detail matters for expectations: in a July 2026 DGX Spark test, vLLM, SGLang and TensorRT-LLM served the same 3B checkpoint within about 1 token per second of each other on single requests. Differences show up under concurrency, repeated prefixes and quantized formats. For one developer, pick the simplest runtime. For a team sharing a GPU, test vLLM and SGLang on your own traffic.
The feature that matters for automation: vLLM, SGLang, Ollama and llama.cpp all expose the OpenAI API. Code written against the OpenAI SDK reaches any of them by changing the base URL, API key and model name.
From a model that answers to a model that works
A local model, a runtime and a chat window give you text. Real work means clicking in a browser, filling an ERP form, reading a spreadsheet, or running a Tuesday-morning report. That needs an execution layer: tools, memory, triggers, permissions and a record of what happened. Your model is the brain. Melaya is the controlled pair of hands.
The connection pattern is short:
- Serve the model. Start Ollama, LM Studio or llama.cpp so it exposes an OpenAI-compatible endpoint on your machine or network.
- Point the agent at it. In the Melaya Agent Builder you select the provider, cloud or local, and the model. The tools and workflows stay as they are.
- Attach tools. Browser Control, Mobile Agents (Android only), Computer Control (through the Melaya desktop app) and native integrations such as Odoo give the model something to operate.
- Set permissions. Granular permissions define what each agent can touch.
- Gate consequential actions. Publishing, sending, paying and writing to connected apps run behind human approval in Melaya. Agents do not do these unsupervised.
- Read the trace. Runs are traceable and replayable, so you can see which step a small model got wrong.
Because tools and workflows are separate from the model, you can swap models later or move to local infrastructure without rebuilding. That matters in practice. A cloud model that is best today may be replaced by an open-weight model that is good enough next quarter, and your workflows should survive the swap. Our guide on browser automation with any AI model, even local walks through that setup, and the self-hosted AI agents guide covers the infrastructure side. For design patterns, see AI agent architecture.
Where small local models need extra guardrails
Smaller models mis-parse tool calls and invent values more often than frontier cloud models, which is why Modelplane flags tool-call parsing for coding agents. Keep tasks narrow and repetitive, which is where Crestia's engineering team finds local-first works well: standardized workflows made of simple subtasks. Put approval on anything that writes. Our write-up on preventing agent hallucinations by design covers the controls.
Local, hybrid or cloud
You do not have to choose one. Modular's view is that on-prem fits latency-sensitive SLAs, strict compliance needs and organizations that can support the infrastructure, since it brings GPU procurement, autoscaling and keeping up with fast-moving frameworks. Crestia's rule of thumb: sensitive data and on-premises requirements favor local, while bursty workloads or tasks where a hosted model clearly outperforms open ones favor hosted.
A provider-independent tool layer lets you route per task. Customer records go to a local Qwen or Mistral model. A hard reasoning step goes to Claude, GPT or Gemini. Both use the same tools, permissions and approval rules.
Perspective: why the tool layer decides the outcome
We build Melaya on one belief: the model is replaceable, the execution layer is not.
Teams that run local models usually solve the hard part first: memory, quantization, a working Ollama or llama.cpp endpoint. Then the project stalls, because the model has no safe way to operate a browser, an Android app, a desktop application or a business system. Each team writes its own glue, and the glue is tied to one model.
Our approach is bring-your-own-model. Claude, GPT, Gemini, DeepSeek, Mistral, Qwen, Ollama or LM Studio can sit behind the same agents. Tools, memory, schedules, triggers and multi-agent pipelines are defined once. Permissions are granular, every consequential action runs behind human approval, and every run is traced and replayable. That is how a smaller local model becomes usable for real work: its mistakes are visible and gated.
If you already use ChatGPT, Claude, Cursor or Codex, the Melaya MCP Server brings the same capabilities into those clients.
Melaya Team
Plans for local-model teams
If you already run a local endpoint, the next step is giving it tools. Melaya Agents is the visual builder where models, tools, memory, schedules, approvals and multi-agent pipelines come together, and the Melaya MCP Server connects them to your existing AI clients.
Published prices, per the pricing page as read on 2 November 2026: Sandbox is $0 per month, Outpost $20 per month, Forge $49 per month or $469 per year, Bastion $129 per month or $1,239 per year, and Citadel starts from $490 per month. Single-product plans are $9.99 per month each for Mobile Agents, Browser Agents and Melaya Assistant, and $14.99 per month for Melaya Marketing. Enterprises needing private, scalable deployments can start from the enterprise AI agent page.
FAQ
What is the best AI model to run locally?
It depends on your memory and your task. Match the model to your GPU or unified memory using the 65% rule, then grade two or three candidates on your own inputs at Q4_K_M. Coding agents need long context and reliable tool-call parsing, so test those specifically.
How much RAM or VRAM do I need to run AI models locally?
About 8 GB handles roughly 7B models, 16 GB handles about 14B, and 20 to 24 GB handles quantized 27 to 32B models, per the University of Galway guide. Add headroom for the KV cache, which grows with context length.
Is a local AI model automatically private?
No. The model runs on your hardware, but an agent can still call external search services or send logs to remote servers. Review every tool and connection the agent uses, and keep sensitive writes behind approval.
Can I use a local model with Melaya?
Yes. Melaya works with any cloud or local model, including Ollama and LM Studio, as well as Claude, GPT, Gemini, DeepSeek, Mistral and Qwen. You bring the model, and every consequential action still runs behind human approval.
Sources
- A Guide to Local AI, Stanford
- What Is a Local LLM?, AI/TLDR
- How do local and hosted models differ?, Harvard Chan School
- Use AI Models Locally, Hugging Face
- Choose between cloud-based and local AI models, Microsoft Learn
- Rethinking Critical AI Infrastructure, Omdia
- On-prem LLM deployments, Modular
- Running AI Models Locally, University of Galway
- How to Run LLMs Locally, AI Wiki
- Which Local LLM Fits Your GPU?, DIY Lab Hub
- Build Local AI With NVIDIA GPUs
- An Open Field Guide to Inference Engineering, Modelplane
- AI Inference Backends, NVIDIA
- Self-hosted endpoints, Union.ai
- Local LLM Inference Engines on DGX Spark, Kubesimplify
- Local AI models in engineering workflows, Crestia
Recommended
- Browser Automation With Any AI Model, Even Local
- Android AI Agent: AI That Controls Your Phone
- Computer Use: How AI Agents Operate a Screen
Frequently asked questions
What is the best AI model to run locally?
It depends on your memory and your task. Match the model to your GPU or unified memory using the 65% rule, then grade two or three candidates on your own inputs at Q4KM. Coding agents need long context and reliable tool-call parsing, so test those specifically.
How much RAM or VRAM do I need to run AI models locally?
About 8 GB handles roughly 7B models, 16 GB handles about 14B, and 20 to 24 GB handles quantized 27 to 32B models, per the University of Galway guide. Add headroom for the KV cache, which grows with context length.
Is a local AI model automatically private?
No. The model runs on your hardware, but an agent can still call external search services or send logs to remote servers. Review every tool and connection the agent uses, and keep sensitive writes behind approval.
Can I use a local model with Melaya?
Yes. Melaya works with any cloud or local model, including Ollama and LM Studio, as well as Claude, GPT, Gemini, DeepSeek, Mistral and Qwen. You bring the model, and every consequential action still runs behind human approval.
