Idle language models can occupy memory long after a client stops using them. LM Studio's idle time-to-live, or TTL, automatically unloads a model after a chosen period without requests.

The lms load command accepts a timeout in seconds for an individual model instance. Without an explicit TTL, CLI-loaded models remain loaded until manually unloaded; the default 60-minute timeout for just-in-time API loads is separate.

Requests reset the idle timer, so an active model stays available while it is doing work. Expiry releases its memory without deleting the downloaded model file, although using it again requires another load.

Steps to set idle TTL for LM Studio models with lms:

  1. List your downloaded language models to find the key for an unloaded GGUF model.
    $ lms ls --llm
    
    You have 1 models, taking up 397.81 MB of disk space.
    
    LLM                      PARAMS    ARCH     SIZE         DEVICE
    qwen2.5-0.5b-instruct    0.5B      Qwen2    397.81 MB    Local

    A running local LM Studio service, an available GGUF runtime, and a downloaded model are required. The listed Qwen2.5 0.5B Instruct file uses Q4_K_M quantization.
    Related: Run the headless LM Studio service
    Related: Download a model with lms

  2. Load your model with a 30-second idle TTL, replacing qwen2.5-0.5b-instruct with its downloaded key.
    $ lms load qwen2.5-0.5b-instruct --identifier ttl-demo \
      --context-length 2048 --gpu off --ttl 30
    ##### snipped #####
    Model loaded successfully in 576.00ms.
    (379.38 MiB)
    To use the model in the API/SDK, use the identifier "ttl-demo".

    –ttl 30 sets the idle interval; 3600 would allow an hour instead. The short interval makes automatic unloading easy to observe. ttl-demo names the loaded instance and must be unused. –gpu off selects CPU loading, and the 2048-token context keeps memory use modest for this small model. On Ubuntu or Debian, if libgomp1 is missing, install it with sudo apt install libgomp1 before loading.
    Related: Select a compatible LM Studio runtime
    Related: LM Studio idle TTL reference

  3. Check that ttl-demo is loaded with the requested TTL.
    $ lms ps
    
    IDENTIFIER    MODEL                    STATUS    SIZE         CONTEXT    PARALLEL    LOAD CONFIG    DEVICE    TTL
    ttl-demo      qwen2.5-0.5b-instruct    IDLE      397.81 MB    2048       4           LM Studio      Local     29s / 30s

    IDLE means the model is loaded and waiting for work. The TTL column shows the remaining time followed by the configured interval. A missing ttl-demo row here does not prove expiry; the model must first appear as loaded.

  4. Leave ttl-demo unused for 35 seconds.
    $ sleep 35

    Requests from another client restart the idle interval. The five extra seconds allow the 30-second timer to expire; a longer TTL needs a correspondingly longer wait.

  5. Confirm that ttl-demo has disappeared from the loaded-model list. Example output:
    $ lms ps
    No models are currently loaded.
    
    To load a model, run:
    
        lms load <model path>

    With other models loaded, the list can still contain their rows. The absence of ttl-demo after its earlier loaded state confirms that its idle timeout took effect. A remaining row means the interval has not elapsed or the model has received more work.

Share this guide