Dev Guide / 2026 ・ No.04

Running large models locally

From CUDA versus Metal to Qwen3.8-27B in LM Studio

Published

LM Studio's chat screen. Left of the input box is the loaded Qwen3.8-27B, with Think and Vision buttons beside it. Above, an English question and an answer listing three benefits of running an LLM locally
Asking Qwen3.8-27B a question in LM Studio. The answer was produced on this machine alone; nothing went over the internet. (Our screenshot.)

AI like ChatGPT normally runs on servers somewhere across the internet.
These days you can also download an openly published model and run it entirely on your own computer.
This guide first sorts out the technology families, what runs on Windows, Mac and Linux, and what labels like 27B and Q4_K_M mean.
It then picks practical models for text, images, voices, OCR and translation, and walks through running Qwen3.8-27B in LM Studio, screen by screen.

1

Why run it locally?

Running a model locally means keeping its weights (the mass of numbers learned in training) as files on your machine and doing the maths on your own GPU or CPU. Questions and answers never leave the computer.

LocalCloud AI service
DataStays with you; easier for confidential or personal materialSent to the provider
CostHardware and electricity; unlimited useSubscription or pay per use
OfflineWorksDoesn't
CapabilityCapped by your machine's memoryThe largest frontier models
EffortYou choose and update modelsAlmost none
CORE

The local catch is that there's a ceiling on what fits. Put the other way round, picking a model that suits your machine's memory decides most of whether running locally works. The first half of this guide is about making that choice.

2

Technology families: CUDA, Metal, ROCm, CPU

It helps to see the setup in layers: app, inference engine, GPU API and memory. When people talk about the "CUDA camp" and the "Metal camp", they mean the bottom two.

Same apps, different layers underneath

Apps: LM Studio, Ollama, ComfyUI and others They look and work much the same on any machine App NVIDIA Apple Silicon AMD / Intel CPU only Engine llama.cpp vLLM, PyTorch llama.cpp MLX, PyTorch llama.cpp PyTorch (some) llama.cpp Main option GPU API CUDA Widest support Metal MPS, MLX ROCm, Vulkan Intel: oneAPI AVX2, NEON On the CPU Memory VRAM Mostly 8-32 GB Unified Shared, large VRAM / shared Varies System RAM Big but slow Same app; the GPU API and memory set speed and size Red boxes: the split people mean by "CUDA" versus "Metal"

The llama.cpp engine supports every family, which is why LM Studio and Ollama run on any machine

FamilyTypical machinesStrengthsWeaknesses
NVIDIA, CUDAWindows and Linux PCs with GeForce RTXThe most software support; image, audio and training all work; fastVRAM of 8 to 32 GB; big models don't fit
Apple, Metal / MPS / MLXM1 to M5 MacsCPU and GPU share memory (unified memory); 64 or 128 GB Macs hold large models; quiet and efficientSlower compute than NVIDIA at the same price; CUDA-only software won't run
AMD, ROCm / VulkanRadeon, Ryzen AI Max machinesCheap per GB of VRAM; Ryzen AI Max has large shared memoryLess software support than CUDA; varies by OS and model
Intel, oneAPI / VulkanArc GPUs, Core UltraAffordableLittle software support
CPU onlyPCs and servers without a GPURuns anywhereSlow; small models only
  • CUDA is NVIDIA's platform for computing on its GPUs. Nearly all AI software, PyTorch first of all, supports it before anything else.
  • Metal is Apple's GPU platform, MPS is the part that runs PyTorch on it, and MLX is Apple's own machine-learning framework for Apple Silicon. On a Mac, the MLX version of a model is usually the fastest.
  • Vulkan is a vendor-neutral GPU interface; llama.cpp uses it on AMD and Intel GPUs.
  • NPUs (Copilot+ PCs, Apple's Neural Engine) are built for AI too, but as of autumn 2026 they are not yet the main way to run large language models freely.
3

Options on Windows, Mac and Linux

UseWindowsMac (Apple Silicon)Linux
Chat in a GUILM Studio, OllamaLM Studio (MLX), OllamaLM Studio (AppImage)
Command line, background serviceOllama, llama.cpp, lmsOllama, llama.cpp, mlx-lm, lmsOllama, llama.cpp, lms, llmster
Serving many usersvLLM under WSL2(Not suited)vLLM, SGLang (for NVIDIA)
Image generationComfyUIComfyUI, Draw ThingsComfyUI
Voice, OCR, translationEach model's official repo (Python) or ComfyUI nodes; where a model runs in Ollama or LM Studio, use that
  • LM Studio: search, download, load, chat and even an API server, all in one app. Apple Silicon Macs; Windows on x86 and ARM64 (Snapdragon); Linux on x86 and ARM64 (per the download page). This guide uses it.
  • Ollama: the classic one-liner, ollama run model-name. Mac and Windows get a GUI app too; on Linux you install it from the command line.
  • llama.cpp: the inference engine inside LM Studio and Ollama, for people who want fine control.
  • vLLM: a fast serving engine for many simultaneous users, mainly Linux plus NVIDIA.
4

Terms: what 27B, Q4_K_M and A3B mean

Model names and download pages are full of cryptic labels. Once you can read them, you can tell at a glance whether a model will run on your machine.

TermMeaningExample
xBNumber of parameters (weights); B is billion. More is smarter but needs more memory and compute27B = 27 billion
ExB"Effective" parameters actually used in computation (Gemma's small models)Gemma 4 E4B
xB-AyB (MoE)Mixture of experts. The first number is the total, the one after A is what runs per token. Memory follows the total; speed follows the active partQwen3.6-35B-A3B (35B total, 3B active)
DenseUses every parameter every time. Usually smarter than MoE of the same size, but slowerQwen3.8-27B
QuantisationStoring weights in fewer bits to shrink them: BF16 (16-bit), then 8-bit, then 4-bit, losing a little accuracy each stepQ8_0, Q4_K_M
Q4_K_MA llama.cpp quantisation of roughly 4 to 5 bits; the standard balance of size and quality16.8 GB for 27B
MXFP4, NVFP4Newer 4-bit formats. gpt-oss ships in MXFP4; NVFP4 targets NVIDIA's newest GPUsgpt-oss-20b
GGUFllama.cpp's file format, used by LM Studio and Ollama; one self-contained file...-Q4_K_M.gguf
MLXThe Apple Silicon format; usually faster on a Mac...-MLX-4bit
safetensorsThe original weights, used by PyTorch, vLLM, ComfyUI and othersOfficial repos
Context lengthHow much the model can keep in view at once, in tokens. Longer means more memory for the KV cache256K (262,144)
TokenThe unit text is cut into; roughly three quarters of an English word
tok/sTokens generated per second: the speed. Faster than you read feels smooth20 tok/s
VRAM / unified memoryMemory dedicated to the GPU / memory a Mac's CPU and GPU share. The model has to fit here24 GB on an RTX 4090
GPU offloadHow many of the model's layers go on the GPU. All of them is fastest
-Instruct, -itTuned for conversation; the one you normally want (Base is the raw model)gemma-4-31B-it
ThinkingShows a reasoning process before answering: smarter but slowerSwitchable in Qwen3.8
VL, VisionModels that read images. GGUF versions come with a separate mmproj filemmproj-....gguf
LicenceWhether you may use it commercially. Apache 2.0 and MIT allow it; some licences are custom, research-only or non-commercial
5

Rules of thumb for memory and speed

Memory needed is roughly parameters × bits ÷ 8. The chart shows the actual file sizes of Qwen3.8-27B, the model used here.

How many GB is a 27B model?

16GB 24GB 32GB BF16 55.6GB Original weights, 2 bytes per parameter: too big at home Q8_0 29.0GB Q6_K 22.4GB Q4_K_M 16.8GB Quantised to about 4 bits: the one we use 27B x about 5 bits / 8 = about 17 GB: the B tells you the memory On top come the conversation (KV cache) and the software itself LM Studio's estimate: Q4_K_M at 8K tokens, 19.24 GB in total

File sizes from lmstudio-community/Qwen3.8-27B-GGUF on Hugging Face (BF16 computed as 27.78B × 2 bytes)

Speed is set almost entirely by how fast the weights can be read from memory (bandwidth), because every new token means reading all the weights again.

Speed = memory bandwidth / model size

Upper bound for Qwen3.8-27B (Q4_K_M, 16.8 GB) RTX 5090 1792 GB/s up to 107 tok/s RTX 4090 1008 GB/s up to 60 tok/s M4 Max 546 GB/s up to 32 tok/s M4 Pro 273 GB/s up to 16 tok/s Test PC 1.2 GB/s Reads from disk: 5-15 s per token (measured) Each token reads all weights: speed = bandwidth / size Real speed is ~50-70% of this; MoE reads only its active part Bandwidths are vendor figures; the test PC's is our measurement

Theoretical ceilings. Real speeds are lower; MLX on a Mac and MTP (multi-token prediction) claw some back

Your memoryComfortable sizeExamples
8 GB (laptop without GPU)2B to 4BGemma 4 E2B, E4B
12-16 GB VRAM / 16-24 GB MacUp to 12B, or a 20B-class MoEGemma 4 12B, gpt-oss-20b
24-32 GB VRAM / 32-48 GB Mac27B to 35B at 4-bitQwen3.8-27B, Gemma 4 26B-A4B, 31B
64 GB+ Mac35B at 8-bit, larger MoEQwen3.6-35B-A3B (8-bit)
128 GB+ Mac and similar100B-class MoEgpt-oss-120b
NOTE

A Mac can't give all its memory to the GPU; by default it's roughly two thirds to three quarters. Leave room for macOS and other apps too: a model file a little over half your memory is a safe target.

6

Practical models today (October 2026)

Release dates, sizes and licences were checked on each model's official Hugging Face page. "Commercial" is ticked for Apache 2.0, MIT and similar licences that allow it (check each licence for the details).

Text and chat (LLMs)

ModelSizeAt 4-bitComm.In short
Qwen3.8-27B (Alibaba, Aug 2026)27B dense17 GBYesTop of its size class; reads images and video; 256K
Gemma 4 (Google, from Mar 2026)E2B, E4B, 12B, 26B-A4B, 31BE4B a few GB to 31B about 20 GBYesPick your size; small ones suit laptops
Qwen3.6-35B-A3B (Apr 2026)35B MoE, 3B activeAbout 24 GBYesFast, because little of it runs per token
gpt-oss-20b / 120b (OpenAI, Aug 2025)21B, 117B MoEAbout 14 / 65 GBYesShips in MXFP4; runs in 16 GB

Text to image

ModelSizeComm.In short
Z-Image-Turbo (Alibaba Tongyi, Nov 2025)6BYesEight steps, fast; practical on 16 GB GPUs; strong at photorealism
FLUX.2 [klein] 4B / 9B (Black Forest Labs, Jan 2026)4B, 9B4B onlyLight, and can edit images. 9B is non-commercial
Qwen-Image-2512 (Dec 2025)20BYesStrong at text inside images (Chinese, English); heavy, use a quantised build
Qwen-Image-2.1 (Sep 2026)7BResearchNew and light, but under a research licence
SDXL (Stability AI, 2023)About 2.6BYes (conditions)Old but light, with by far the most add-ons (LoRAs)

Voice cloning (speech synthesis)

ModelSizeComm.In short
Qwen3-TTS (Alibaba, Jan 2026)0.6B, 1.7BYesClones from three seconds of audio; ten languages incl. English, Chinese, Japanese
VoxCPM2 (OpenBMB, Apr 2026)2BYes30 languages, 48 kHz; can also design a voice from a text description
IndexTTS-2.5 (bilibili, Aug 2026)—Own licenceFine control of emotion and duration; 2.5 adds Japanese
Fun-CosyVoice3-0.5B (Alibaba, Dec 2025)0.5BYesLight and fast
GPT-SoVITS (open source)—Yes (MIT)Fine-tunes on about a minute of audio; big community

Only clone voices whose owners have agreed. Publishing audio made with someone else's voice as if it were theirs invites fraud and rights violations.

OCR (reading text in images and PDFs)

ModelSizeComm.In short
PaddleOCR-VL-1.6 (Baidu, May 2026)0.9BYesTables, formulas and charts too; 96.33% on OmniDocBench v1.6 (official figure)
GLM-OCR (Z.ai, Jan 2026)About 0.9BYes (MIT)Small and fast; runs in Ollama
DeepSeek-OCR-2 (Jan 2026)3BYesReads long documents with few tokens
MinerU2.5-Pro (OpenDataLab, May 2026)1.2BYesFor turning PDFs into Markdown
olmOCR-2 (Ai2, Oct 2025)7BYesFor batch-processing large PDF collections

Translation

ModelSizeComm.In short
Hy-MT2 (Tencent, May 2026)1.8B, 7B, 30B-A3BYes33 languages; official GGUF; 1.8B runs on a laptop
TranslateGemma (Google, Jan 2026)4B, 12B, 27BYes (Gemma terms)Gemma tuned for translation
PLaMo 2 Translate (PFN, May 2025)About 10BConditionsSpecialised in Japanese and English
NLLB-200 (Meta, 2022)0.6B to 3.3BNon-commercial200 languages; old but good for rare ones

The LLMs above (Qwen3.8, Gemma 4) translate well too. Dedicated models win on being small and fast.

7

If you pick one: Qwen3.8-27B

For one model that is easy to run locally and still highly accurate, our pick is Qwen3.8-27B, released in August 2026.

  • Accurate: in Qwen's own comparison it beats the previous Qwen3.6-27B across the board; for writing, code, research and agent tasks it is at the top of its size class (SWE-bench Pro 61.7 against 53.5; GPQA Diamond 89.2).
  • Just fits: 16.8 GB at 4-bit (Q4_K_M), so it sits on a 24 GB GPU (RTX 3090, 4090 and the like) or a Mac with 32 GB or more.
  • Reads images: hand it photos, diagrams or PDF screenshots. Context is 262,144 tokens.
  • Apache 2.0: free for commercial use.
  • Runs anywhere: GGUF and MLX builds are published, so LM Studio, Ollama (ollama run qwen3.8), llama.cpp and vLLM all work.
IF

With 16 GB or less, follow the same steps with Gemma 4 12B (about 8 GB) or Gemma 4 E4B. Only the search term changes.

8

Step 1: install LM Studio

The screenshots use LM Studio 0.4.25 for Linux. The Mac and Windows versions look the same apart from the window frame and menus.

The lmstudio.ai download page. Under the Download LM Studio heading are menus for operating system, CPU and version, and a purple Download button
Pick (1) your OS (macOS, Windows, Linux) and (2) CPU type, then press (3) Download. (Source: lmstudio.ai/download, captured 4 October 2026; numbers added afterwards.)
  • Open lmstudio.ai/download. The top of the page features a separate product, LM Studio Bionic (an agent app); what we want is Download LM Studio further down.
  • Mac: open the dmg and drag LM Studio into Applications. Windows: run the installer. Linux: make the AppImage executable (chmod +x) and run it.
LM Studio's first screen: large text reading Local AI on your computer., a Get Started button and Version 0.4.25
The first launch. Press (1) Get Started. (Our screenshot; numbers added afterwards.)
The Your first model screen, suggesting google/gemma-3-4b with a Download button, and a Skip for now link below
It suggests the small Gemma 3 4B as a first model. We will choose our own, so press (1) Skip for now. (Our screenshot; numbers added afterwards.)
The Advanced settings screen: switches for Developer Mode and for adding lms to the PATH, and a Continue to LM Studio button
Leave (1) the switch that installs the lms command on, and press (2) Continue to LM Studio. Developer Mode can be changed later. (Our screenshot; numbers added afterwards.)

No sign-in is needed. That's the setup done.

9

Step 2: download Qwen3.8-27B

The Model Search screen: results for qwen3.8 on the left; on the right, details for lmstudio-community/Qwen3.8-27B-GGUF, a Q4_K_M 17.74 GB selector, a Download button and a red Likely too large label
(1) Click the magnifier, (2) search for qwen3.8, (3) pick lmstudio-community's Qwen3.8-27B-GGUF, (4) check the quantisation (Q4_K_M) and (5) Download. The red "Likely too large" warns that our test machine lacks memory. (Our screenshot; numbers added afterwards.)
  • On a Mac, choose lmstudio-community/Qwen3.8-27B-MLX-4bit at step 3: the MLX build for Apple Silicon, which runs faster.
  • If unsure about quantisation, take Q4_K_M. With memory to spare, Q6_K (22.4 GB) or Q8_0 (29.0 GB) are slightly more accurate.
  • The mmproj file for images (about 0.9 GB) downloads too, for about 17.7 GB in all.
  • The red Likely too large means "this machine probably lacks the memory". It shows because our test machine has 8 GB; you won't see it on a 24 GB GPU or a 32 GB Mac.
A notification reading Download Completed!, Qwen3.8-27B-Q4_K_M.gguf has finished downloading., with a Load Model button
When the download finishes, a notice appears at the bottom right. (1) Load Model loads it straight away. (Our screenshot; numbers added afterwards.)
10

Step 3: load it and chat

Choose the model from "Pick a model" under the chat (⌘+L on a Mac, Ctrl+L on Windows and Linux) and the load settings open.

The model load settings: Estimated Memory Usage totals 19.24 GB, Context Length 8192, a GPU Offload slider and a Load Model button
Load settings: set (1) the conversation length (Context Length) and (2) how many layers go on the GPU (GPU Offload), then (3) Load Model. The estimate above is 19.24 GB in total. Our test machine has no GPU, so GPU Offload shows 0. (Our screenshot; numbers added afterwards.)
  • Context Length: 8,192 is fine to start. Raise it for long documents (memory use rises too).
  • GPU Offload: on a machine with a GPU, slide it all the way right. All layers on the GPU is fastest; anything left over runs on the CPU and slows things down.
LM Studio's chat screen with numbers: 1 is the loaded model left of the input box, 2 the Think button, 3 the input box, 4 the answer
(1) The loaded model, (2) Think on or off, (3) the input box. (4) The answer appears like this. (Our screenshot; numbers added afterwards.)

Once loaded, the model's name sits left of the input box. Type a question and press Enter. The Think button toggles the reasoning process: on for hard problems, off for everyday chat, which is faster.

NOTE

These screenshots come from a Linux test machine with no GPU and 8 GB of memory. A 27B model doesn't fit, so we turned off the guardrails described below and let it read the weights from disk as it went, which took roughly 5 to 15 seconds per token. On a 24 GB GPU or a 32 GB Mac, the same steps give a comfortable chat speed.

11

Step 4: use it as an API (optional)

LM Studio can also act as a server you call exactly like the OpenAI API, so your own programs, and tools that accept an OpenAI-compatible API, can use the model on your machine.

LM Studio's Developer screen: Status Running, Reachable at http://127.0.0.1:1234, the loaded qwen3.8-27b and API examples
(1) Open Developer on the left and (2) switch Status on; (3) an OpenAI-compatible API is now at http://127.0.0.1:1234. (Our screenshot; numbers added afterwards.)
A terminal sending a question with curl to /v1/chat/completions on localhost:1234, and Qwen3.8-27B's reply coming back as JSON
Calling the API from a terminal on the same machine: (1) send to localhost:1234, (2) name qwen3.8-27b as the model, (3) the reply comes back. (Our actual run, redrawn as a terminal window for legibility; numbers added afterwards.)
# Send a question from a terminal (write curl.exe in Windows PowerShell)
curl http://localhost:1234/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "qwen3.8-27b", "reasoning_effort": "none",
       "messages": [{"role": "user", "content": "Hello"}]}'

Through the API, Qwen3.8 also thinks out loud by default. Adding "reasoning_effort": "none" skips that and answers straight away (checked on our test machine).

Without the GUI, the lms command does the same (lms get to download, lms load to load, lms server start to serve). With Ollama, the one line ollama run qwen3.8 takes you from download to chat.

12

Troubleshooting

A Failed to load the model notice at the bottom right of LM Studio, reading error loading model: unable to allocate CPU_REPACK buffer
Run out of memory and you get "Failed to load the model" like this (it really happened on our test machine). (Our screenshot; numbers added afterwards.)
SymptomCauseFix
Likely too large / won't loadNot enough memoryA smaller quantisation (Q4_K_M to Q3) or model (Gemma 4 12B); close other apps
Loads but crawlsDoesn't fit on the GPU, so the CPU does the workMax out GPU Offload; if that's not enough, go smaller
Stalls or slows on long documentsContext too short, or the KV cache eats memoryRaise or lower Context Length; split the document
Thinks for ages before answeringThinking is onTurn Think off
Windows isn't using the GPUOld driver or wrong runtimeUpdate the GPU driver and choose CUDA (Vulkan for AMD) in LM Studio's Runtime settings
Settings, Model Defaults: Default Context Length and the Model loading guardrails options OFF, Relaxed, Balanced, Strict and Custom
Settings, Model Defaults, "Model loading guardrails". (1) This stops models that would overflow your memory. We turned it off on the test machine; normally leave it alone. (Our screenshot; numbers added afterwards.)

§ — On one page

  1. Local AI comes in layers: app, engine, GPU API, memory. "CUDA" versus "Metal" is about the bottom two.
  2. NVIDIA (CUDA) wins on software and speed, Macs (Metal, MLX) on large unified memory; AMD and Intel get by with Vulkan and friends.
  3. Memory: parameters × bits ÷ 8, so 27B at Q4_K_M is about 17 GB. Speed: memory bandwidth ÷ model size.
  4. Practical picks: text Qwen3.8 and Gemma 4, images Z-Image and FLUX.2 klein, voices Qwen3-TTS and VoxCPM2, OCR PaddleOCR-VL and GLM-OCR, translation Hy-MT2.
  5. If you pick one, pick Qwen3.8-27B: search in LM Studio, download Q4_K_M (MLX on a Mac), load, chat. It doubles as an API server.

References

The LM Studio screenshots were taken by us while actually using LM Studio 0.4.25 (Linux x64), with the circled numbers added afterwards. Model release dates, sizes and licences follow the official Hugging Face pages as of 4 October 2026. GPU memory bandwidths are vendor figures, and the speed chart shows theoretical ceilings. Versions and screens may change.

Dev Guide No. 4 — Running Large Models Locally / 2026.10

← Back to all posts