Run a local LLM with LM Studio

LM Studio is a desktop app for downloading and chatting with models, with a command-line tool (lms) and a local server on top. It runs GGUF files through llama.cpp and, on Apple Silicon, MLX builds as well.

macOS, Linux, Windows · model sizes synced 2026-11-30

Pick LM Studio when

  • You want a graphical app to browse, download and compare models.
  • You want to see a memory estimate before a model loads.
  • You are on a Mac and want to switch between GGUF and MLX builds.

Look elsewhere when

  • You are setting up a headless server and want a single binary.
  • You serve many users at once: vLLM batches far better.

1. Install

All platforms

Download the app from lmstudio.ai and start it once. The lms command becomes available after that first launch.

Check that it worked

2. Run a model

Example: Qwen 3.8 27B as Q4_K_M on NVIDIA GeForce RTX 4090 (24 GB). With a 16K context it needs 21.5 GB of 22.8 GB usable memory and should generate about 32–43 tok/s.

Size your own model and hardware for LM Studio

3. The settings that decide memory use

Set the context window

Pass the context length when you load a model. lms ls lists the keys of the models you have downloaded.

Halve the KV cache

The CLI documents no flag for KV cache quantization. Where the app offers it, it is a per-model load setting in the GUI.

Ask for an estimate first

--estimate-only prints the memory LM Studio expects to need for the chosen context and GPU offload, without loading anything. Compare it with our number before you commit to a download.

4. Connect your tools

Use it from other tools

Start the local server from the CLI. It prints the address it listens on and reuses the last port; lms server status shows whether it is running. By default it only accepts connections from this machine.

Or let your coding agent do it

Paste this into Claude Code, Codex or any agent with a shell. It carries the target, our estimates and the steps, and tells the agent to check the hardware first and to report measured memory and speed against the estimates. The calculator builds the same prompt for any model, hardware and runtime.

Set up a local LLM on this machine and verify that it works.

Target
- Model: Qwen 3.8 27B (Hugging Face: Qwen/Qwen3.8-27B)
- Runtime: LM Studio
- Build: Q4_K_M, ggml-org/Qwen3.8-27B-GGUF
- Context window: 16,384 tokens (16K)
- Hardware this was sized for: NVIDIA GeForce RTX 4090 (24 GB)

Estimates from llmsizing.com
- Memory: 21.5 GB of 22.8 GB usable (weights 18.9 GB, KV cache 1.0 GB, approximate, overhead 1.6 GB)
- Fit: Tight fit. Uses 94.5% of usable memory. Close other GPU-heavy apps or switch to an 8-bit KV cache.
- Speed: 32–43 tok/s for one request. Scaled from 10 published llama.cpp measurements on this GPU.

Steps
1. Check the hardware before downloading anything (`nvidia-smi`, or the vendor's equivalent). If it is not NVIDIA GeForce RTX 4090 (24 GB), or less than 21.5 GB of memory is free, stop and tell me what you found.
2. Check whether LM Studio is installed with `lms --help`. If it is not, install it:
   - All platforms: Download the app from lmstudio.ai and start it once. The `lms` command becomes available after that first launch.
3. Start the model: `lms get qwen/qwen3.8-27b@q4_k_m`
4. Load it with the planned context: `lms ls` to find the model key, then `lms load <key> --context-length 16384 --gpu max`. Run it once with --estimate-only first and report the estimate.
5. To expose an API, run `lms server start`.
6. Send one short test prompt. Then report, next to the estimates above: memory actually used (`lms load --estimate-only MODEL_KEY --context-length 16384`), tokens per second, and whether everything runs on the GPU.
7. Tell me the base URL and model name to use from other tools. LM Studio API: printed by `lms server start`.

Rules
- Ask me before using sudo, changing system settings or installing system packages.
- Do not delete or replace models that are already on this machine.
- If the download is larger than the free disk space, stop and tell me.
- If the measured memory or speed is far from the estimates, say so plainly.

Sized with https://llmsizing.com/?m=qwen3-8-27b&hw=rtx-4090-24gb&q=q4_k_m&ctx=16384&rt=lmstudio
Setup guide: https://llmsizing.com/guides/lm-studio

How to read our numbers for LM Studio

LM Studio runs the same GGUF builds as llama.cpp, so our GGUF numbers apply. Sizes come from the GGUF repositories on Hugging Face.

  • --gpu max puts every layer on the GPU. Without the flag LM Studio decides itself and may leave layers on the CPU.
  • Binding the server to anything other than 127.0.0.1 exposes it to your network; turn on authentication if you do.

73 models with a ready Q4_K_M build for LM Studio

Command
Qwen 3 0.6B0.4 GB
Gemma 3 1B0.8 GB
Qwen 3 1.7B1.2 GB
Gemma 2 2B1.6 GB
Qwen 2.5 3B1.8 GB
Qwen 3.5 2B1.8 GB
Llama 3.2 3B Instruct1.9 GB
Phi-4 Mini 3.8B2.3 GB
Phi-4 Mini Reasoning 3.8B2.3 GB
Qwen 3 4B Instruct 25072.3 GB
Ministral 3 3B2.8 GB
Gemma 3n E2B2.8 GB
Gemma 3 4B3.1 GB
Qwen 3.5 4B3.5 GB
MedGemma 4B3.9 GB
Mistral 7B Instruct v0.34.1 GB
Gemma 4 E2B4.1 GB
Gemma 3n E4B4.2 GB
Qwen 2.5 Coder 7B4.4 GB
Qwen 2.5 7B4.4 GB
DeepSeek R1 Distill Qwen 7B4.4 GB
DeepSeek R1 Distill Llama 8B4.6 GB
Llama 3 8B Instruct4.6 GB
Qwen 3 8B4.7 GB
Gemma 2 9B5.4 GB
Qwen 2.5 VL 7B5.6 GB
Gemma 4 E4B6.4 GB
Ministral 3 8B6.4 GB
Gemma 4 12B6.8 GB
Qwen 3 VL 8B6.8 GB
Mistral Nemo 12B7.0 GB
Qwen 3.5 9B7.0 GB
Gemma 3 12B7.6 GB
Phi-4 14B8.3 GB
DeepSeek R1 Distill Qwen 14B8.4 GB
Qwen 2.5 14B8.4 GB
Qwen 2.5 Coder 14B8.4 GB
Qwen 3 14B8.4 GB
Phi-4 Reasoning Plus 14B8.4 GB
Phi-4 Reasoning 14B8.4 GB
Ministral 3 14B9.3 GB
DeepSeek Coder V2 Lite (16B MoE)9.7 GB
gpt-oss-20b (MoE)10.8 GB
Codestral 22B12.4 GB
Devstral Small 24B15.0 GB
Magistral Small 24B15.0 GB
Mistral Small 3.1 24B15.0 GB
Gemma 2 27B15.5 GB
Gemma 3 27B16.2 GB
MedGemma 27B17.0 GB
GLM-4.7 Flash (30B-A3B MoE)17.1 GB
Qwen 3 30B A3B (MoE)17.3 GB
Qwen 3.5 27B17.3 GB
Gemma 4 26B A4B (MoE)17.9 GB
Qwen 3 32B18.4 GB
Qwen 2.5 Coder 32B18.5 GB
QwQ 32B18.5 GB
DeepSeek R1 Distill Qwen 32B18.5 GB
Qwen 2.5 32B18.5 GB
Qwen 3.8 27B18.9 GB
Qwen 3.6 27B18.9 GB
Gemma 4 31B19.2 GB
Qwen 3.6 35B A3B (MoE)20.0 GB
Qwen 3.5 35B A3B (MoE)22.2 GB
Qwen 4 35B A3B (MoE)31.2 GB
DeepSeek R1 Distill Llama 70B39.6 GB
Llama 3.3 70B Instruct39.6 GB
Qwen 2.5 VL 72B45.5 GB
Qwen3 Coder Next 80B A3B (MoE)45.9 GB
gpt-oss-120b (MoE)58.5 GB
Llama 4 Scout (109B MoE)62.5 GB
Qwen 3 235B A22B (MoE)132 GB
Qwen 3.5 397B A17B (MoE)229 GB