Local language models keep using memory while they are loaded, even between requests. LM Studio's lms CLI can unload one selected model instance while keeping its downloaded file on disk.
A downloaded model can be loaded under a custom identifier. That identifier names the instance used by client applications, so it is the value to select for unloading.
The local LM Studio service must be running, with lms available to the account that owns it. Requests from other applications can load a model again when just-in-time loading is enabled.
The instance becomes unavailable to clients after unloading, so any response you need should finish first. The –all option unloads every instance and is unnecessary for removing one.
Steps to unload a model in LM Studio:
- List the loaded models to find the identifier of the instance to unload. Example output:
$ lms ps IDENTIFIER MODEL STATUS SIZE CONTEXT PARALLEL LOAD CONFIG DEVICE TTL local-chat qwen2.5-0.5b-instruct IDLE 397.81 MB 2048 4 LM Studio Local 59m / 1h
local-chat is the loaded instance's identifier; qwen2.5-0.5b-instruct is its model name. An empty list means there is no loaded instance to unload.
Related: How to run LM Studio headlessly with llmster
Related: How to load a model with lms in LM Studio - Unload your selected instance using its identifier in place of local-chat. Example output:
$ lms unload local-chat Model "local-chat" unloaded.
- Confirm that the selected identifier is absent from the loaded-model list. Example output:
$ lms ps No models are currently loaded. ##### snipped #####
If other instances remain loaded, their rows still appear. The selected identifier must be missing; the unload confirmation alone does not show the current list.
- Check that the same model remains in the downloaded-model inventory. Example output:
$ lms ls You have 2 models, taking up 481.91 MB of disk space. LLM PARAMS ARCH SIZE DEVICE qwen2.5-0.5b-instruct 0.5B Qwen2 397.81 MB Local EMBEDDING PARAMS ARCH SIZE DEVICE text-embedding-nomic-embed-text-v1.5 Nomic BERT 84.11 MB Local
The qwen2.5-0.5b-instruct entry remains on disk even though local-chat is no longer loaded. The embedding-model entry is a separate downloaded model. Unloading does not delete either file.
Related: How to download a model with lms in LM Studio