LM Studio Guide
Isometric purple cube on a stacked platform with glowing pink circuit lines linking to small nodes, suggesting a local AI model loaded onto hardware.
how-to

How to Load a Model in LM Studio: GUI, CLI and API

Load a model in LM Studio with Cmd/Ctrl+L, lms load or the REST API. Import a GGUF from disk and preview memory use before loading.

By LM Studio Guide Editorial · ·Updated · 7 min read

To load a model in LM Studio, press Cmd+L on macOS or Ctrl+L on Windows and Linux to open the model picker. Select a downloaded model, adjust GPU offload or context length if needed, and load it. In a terminal, run lms load and choose a model from the prompt.

What does loading a model in LM Studio actually do?

LM Studio’s getting-started docs say loading a model typically means allocating RAM for its weights and other parameters.

See also GGUF quantization levels explained. The PagedAttention paper from the vLLM authors describes how per-request KV cache memory grows and shrinks during serving. Since LM Studio 0.3.27, the loader’s memory estimate accounts for context length, flash attention and whether the model is a vision model. See also how much VRAM a 7B model needs.

How to load a model in the LM Studio app

  1. Get a model onto disk. Open the Discover tab (Cmd+2 or Ctrl+2 from anywhere), then search by keyword, by user/model, or by pasting a Hugging Face URL. The download docs suggest a 4-bit option or higher if your machine can run it. See GGUF vs safetensors in LM Studio for format guidance.
  2. Open the model loader. The documented path is the Chat tab, then the model loader. Cmd/Ctrl+L opens the model picker from anywhere in the app. Press it again to dismiss the picker. LM Studio 0.4.0 release notes
  3. Select a model you downloaded or sideloaded.
  4. Check the load parameters. For Qwen models, LM Studio selects load parameters for your hardware by default. Adjust context length or hardware settings as needed. Qwen’s LM Studio guide
  5. Load. The app warns before loading if the memory estimate indicates you are likely to run out of memory. If you believe the estimate is too conservative, the app lets you override the guardrail and attempt the load.

To free the memory, select Eject in the model picker.

Which load settings can you change?

You can adjust context length and GPU offload before loading.

SettingWhat it controlsLoad details
GPU offloadHow much of the model to offload to the GPU--gpu accepts 0 to 1, off or max.
Context lengthMaximum number of tokens the model considersThe memory estimate accounts for context length.
Flash attentionWhether to use flash attentionThe memory estimate accounts for whether flash attention is enabled.
Parallel slots (n_parallel)Maximum number of requests processed at once when parallel processing is enabledThe 0.4.0 release notes document this setting for LM Studio’s llama.cpp engine.

In llama.cpp, --n-gpu-layers sets the maximum number of layers stored in VRAM. See the llama.cpp server docs. See also best local LLM for 16GB RAM.

In the My Models tab, the gear icon next to a model opens its per-model defaults for GPU offload, context size and flash attention. Changes made at load time can be saved as the new default, and the defaults apply when loading the model anywhere in the app, including through lms load.

Loading a model from the command line

Run LM Studio at least once before using lms. Run lms --help for help. The lms load reference lists the flags used in this example.

# List downloaded models and use your model key in the commands below
lms ls

# Dry run: print the memory estimate, load nothing
lms load --estimate-only qwen/qwen3-4b-2507 --gpu max

# Load with explicit settings and assign an API identifier
lms load qwen/qwen3-4b-2507 \
 --gpu max \
  --identifier qwen3-4b-chat \
  --ttl 3600

# Unload all currently loaded models
lms unload --all

The 0.3.27 release notes show --estimate-only reporting 65.68 GB of estimated GPU memory for gpt-oss-120b, followed by a message indicating that the guardrail settings may allow the load. The estimate reflects --context-length and --gpu when you supply them.

Models loaded with lms load have no TTL by default and stay resident until you unload them. Use --ttl to set an idle timer in seconds. Use --host with lms load or lms unload to connect to a running, reachable LM Studio instance. See also headless LM Studio server on Unraid.

For a GGUF downloaded outside the app, run lms import with the file path and follow the interactive prompt. The import docs mark the command experimental.

Load a model file from disk

By default, lms import moves the original file into LM Studio’s models directory. The lms import CLI reference documents options to copy or link it. Replace ~/Downloads/model.gguf with your file path and preview the import first.

lms import ~/Downloads/model.gguf --dry-run

After previewing, run one of these import commands.

Import methodCommand
Copy and keep the originallms import ~/Downloads/model.gguf --copy
Create a hard linklms import ~/Downloads/model.gguf -L
Create a symbolic linklms import ~/Downloads/model.gguf -l
Copy into a named folder and skip categorization promptslms import ~/Downloads/model.gguf --copy --user-repo my-user/custom-models

Then list the models to confirm the import. Run lms load and select the imported model when prompted.

lms ls
lms load

For manual import, place the GGUF in the expected layout, ~/.lmstudio/models/publisher/model/model-file.gguf. You can change the models directory from the My Models tab. Download docs

Loading a model through the API

Install the Python SDK with pip install lmstudio before running the example. Use qwen/qwen3-4b-2507 if it is available locally, or replace it with a local model key from lms ls. The SDK returns the loaded instance or loads it on demand.

import lmstudio as lms

# Returns the loaded instance, or loads it. ttl applies only to a fresh load.
model = lms.llm("qwen/qwen3-4b-2507", ttl=3600)
print(model.respond("Reply with OK if you are loaded."))

# Release the memory when the job is done
model.unload()

client.llm.load_new_instance() creates an additional instance. The REST load endpoint accepts model, context_length, eval_batch_size, flash_attention, num_experts, offload_kv_cache_to_gpu, and echo_load_config as JSON. The fields eval_batch_size, flash_attention, and offload_kv_cache_to_gpu have an effect only for LLMs and decision models loaded by LM Studio’s llama.cpp engine. The num_experts field has an effect only for those models if they use a mixture of experts (MoE).

Start the server with lms server start, as shown in the REST quickstart. If the server requires authentication, set LM_API_TOKEN to your token and include the Authorization header. Otherwise, omit the header line.

Use openai/gpt-oss-20b only if it is downloaded locally. Otherwise, replace it with a model key from lms ls.

curl http://localhost:1234/api/v1/models/load \
  -H "Authorization: Bearer $LM_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-oss-20b",
    "context_length": 16384,
    "flash_attention": true,
    "echo_load_config": true
  }'

The response carries "status": "loaded", an instance_id, load_time_seconds, and, when echo_load_config is true, the applied configuration in load_config. The load_config object may include settings omitted from the request.

With JIT loading enabled by default, a request can load an unloaded model on demand. JIT-loaded models have a 60-minute idle TTL by default. In the documented JIT chat example at /api/v0/chat/completions, set ttl in seconds to override the timer for a model loaded by that request. With auto-evict enabled, at most one JIT-loaded model stays in memory. Models loaded without JIT are unaffected by auto-evict. You can toggle auto-evict in Developer tab > Server Settings.

The reporter in LM Studio issue #1631 accessed a headless machine through LM Link. They used “Load anyway” in the GUI and found no equivalent override in the CLI or REST API. The reporter saw LM Studio estimate about 22.92 GB for qwen3.5-9b at a 110,000-token context. They saw about 11.5 GB of memory use in llama.cpp with what they described as effectively the same setup.

Why won’t my model load in LM Studio?

  • “Model loading was stopped due to insufficient system resources.” The memory guardrail blocked the load. Try a shorter context. If the GPU memory estimate is too high, try lowering GPU offload. Rerun lms load --estimate-only with the revised settings after each change.
  • The model never appears in the loader. For a manually added GGUF, check the publisher and model folder layout shown above.
  • It was loaded, and now it’s gone. Check whether the idle TTL expired. If auto-evict is enabled, another JIT load could have evicted a previously JIT-loaded model.

See also LM Studio’s system requirements.

FAQ

Which model formats can LM Studio load?

Look for a compatible GGUF build or, on Apple Silicon, a build supported by LM Studio’s MLX engine.

Can LM Studio load more than one model at a time?

Yes. The Python SDK’s load_new_instance() can load multiple instances of the same model. With auto-evict on by default, LM Studio keeps at most one JIT-loaded model in memory.

How do I disable GPU offload in LM Studio?

For a GGUF model using llama.cpp, disable GPU offload with lms load --gpu off and select the model when prompted. The CLI reference documents the offload setting.

Evidence and limits

This guide covers LM Studio 0.4.28, listed in the changelog. The steps and settings are drawn from the official documentation and release notes. No hands-on testing was performed for this guide.

Sources

  1. LM Studio Docs - Get started with LM Studio
  2. LM Studio Docs - Download an LLM
  3. LM Studio Docs - lms load
  4. LM Studio Docs - lms import
  5. LM Studio Docs - Per-model defaults
  6. LM Studio Docs - Import models
  7. LM Studio Docs - Idle TTL and Auto-Evict
  8. LM Studio Docs - Python SDK: loading and unloading models
  9. LM Studio Docs - Python SDK installation
  10. LM Studio Docs - REST API quickstart
  11. LM Studio Docs - REST API: load a model
  12. LM Studio changelog
  13. LM Studio 0.4.0 changelog
  14. LM Studio 0.3.27 release notes (memory estimates)
  15. LM Studio 0.3.4 ships with Apple MLX
  16. llama.cpp server README (n-gpu-layers and load flags)
  17. Kwon et al., Efficient Memory Management for LLM Serving with PagedAttention (arXiv 2309.06180)
  18. Qwen documentation - LM Studio
  19. lmstudio-bug-tracker issue 1631 - guardrail estimate and Load anyway

Related