LM Studio is a polished desktop application for downloading and running AI language models locally. It offers a searchable model browser (pulling from Hugging Face), hardware-specific model recommendations, and a developer mode with an OpenAI-compatible API server. It’s the go-to tool for users who want more control than Jan but don’t want Ollama’s command-line interface.
Installation
Download from lmstudio.ai — available for Windows, macOS, and Linux.
macOS (Apple Silicon): LM Studio uses Metal for GPU acceleration. M1/M2/M3/M4 chips with 16GB+ unified memory deliver excellent local LLM performance.
Windows/Linux: NVIDIA GPUs use CUDA; AMD GPUs use ROCm (Linux) or Vulkan (Windows). AMD support is improving but less optimized than NVIDIA.
Finding and Downloading Models
- Open LM Studio → Discover tab
- Search for model names:
llama,mistral,phi,qwen,gemma - Filter by: My Hardware — LM Studio shows which quantizations fit your VRAM
The model browser pulls from Hugging Face. Recommended sources:
- bartowski: high-quality GGUF quantizations of most popular models
- lmstudio-community: LM Studio’s curated model hub
- TheBloke: older but extensive library
Understanding GGUF and Quantization
GGUF (GPT-Generated Unified Format) is the file format for local LLM inference. Quantization reduces model precision to save memory:
| Quantization | Quality | VRAM for 7B | VRAM for 13B |
|---|---|---|---|
| Q8_0 | Best (FP8) | ~8.5GB | ~15GB |
| Q6_K | Excellent | ~6.5GB | ~11.5GB |
| Q5_K_M | Very good | ~5.5GB | ~9.5GB |
| Q4_K_M | Good | ~4.5GB | ~8GB |
| Q3_K_M | Acceptable | ~3.5GB | ~6GB |
| Q2_K | Lower | ~2.7GB | ~5GB |
Rule of thumb: use the highest quantization that fits in your VRAM. Quality degrades noticeably below Q4_K_M for most models.
Recommended Models by Use Case
Coding
- DeepSeek-Coder-V2-Lite (16B, Q4): excellent code completion and debugging
- Qwen2.5-Coder-7B (Q6): fast, capable for everyday coding tasks
- CodeLlama-13B-Instruct (Q4): strong for Python, JavaScript, C++
General Assistant
- Llama-3.3-70B (Q3 on 24GB VRAM): near-frontier performance locally
- Llama-3.1-8B-Instruct (Q8 on 8GB VRAM): best 8B model overall
- Mistral-7B-Instruct-v0.3 (Q6): fast, well-rounded
Writing and Long Context
- Phi-4 (14B, Q4): Microsoft’s efficient 14B model with strong reasoning
- Gemma-2-9B-it (Q5): Google’s model, excellent instruction following
- Qwen2.5-14B (Q4): strong in creative writing and summarization
Uncensored (for security research)
- Dolphin-Llama3-8B: uncensored fine-tune, useful for cybersecurity education
- NeuralDaredevil-8B: fewer refusals for technical content
GPU Configuration
In LM Studio → My Models → click a loaded model → Advanced Settings:
- GPU Offload (Layers): higher = more layers on GPU (faster), lower = more on CPU/RAM. Set to “Auto” initially; increase manually for speed.
- Context Length: 4096 is default. Increase to 8192 or 32768 if the model supports it — uses more VRAM
- Flash Attention: enable for NVIDIA (RTX 20-series+) — reduces VRAM usage and speeds up long contexts
- Batch Size: affects throughput for API use; keep at default for chat
Check VRAM usage: LM Studio shows real-time VRAM allocation in the model panel. If near your limit, reduce context length or GPU layers.
API Server (Developer Mode)
LM Studio runs an OpenAI-compatible REST API:
- Load a model in LM Studio
- Click Developer tab → Start Server (default:
http://localhost:1234)
Use it with any OpenAI-compatible library:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:1234/v1",
api_key="lm-studio" # any string
)
completion = client.chat.completions.create(
model="llama-3.1-8b-instruct",
messages=[
{"role": "system", "content": "You are a cybersecurity expert."},
{"role": "user", "content": "Explain SQL injection in simple terms."}
],
temperature=0.7
)
print(completion.choices[0].message.content)
Streaming responses
stream = client.chat.completions.create(
model="llama-3.1-8b-instruct",
messages=[{"role": "user", "content": "Write a Python web scraper."}],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
Multi-Modal Models (Vision)
LM Studio supports vision-language models that analyze images:
- LLaVA-v1.6-Mistral-7B: strong image understanding
- Llama-3.2-11B-Vision: Meta’s vision model
- Phi-3.5-Vision-Instruct: Microsoft’s compact vision model
In the chat interface, drag and drop an image to include it in your prompt.
Prompt Templates
Different models use different prompt formats. LM Studio automatically detects and applies the correct template (ChatML, Llama-3, Mistral Instruct, Alpaca) based on the model’s metadata.
If a model misbehaves, manually set the template in Model Settings → Prompt Template.
Typical Workflow
- Load model in LM Studio (takes 5–30 seconds depending on size)
- Test in chat UI
- Integrate via API in your application
- Tune temperature and system prompt for your use case
LM Studio sits between Jan (simplest) and Ollama (most powerful for servers) — the right choice for developers who want a GUI but need programmatic API access.