Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Ollama Model Management

Ollama Model Management

In this chapter we explain Ollama's model management commands: pull, view, copy, delete, and the mechanism by which models reside in memory.


Pulling models: ollama pull

The pull command only downloads a model without entering a chat, suitable for preparing models in advance.

Download the default tag (latest):



ollama pull qwen3.5

Download a specific spec tag:



ollama pull qwen3.5:4b

After execution you will see the standard download progress output:



$ ollama pull qwen3.5:4b

pulling manifest

pulling 87497c5f0e8f... 100% |████████████████████| 3.4GB

verifying sha256 digest

writing manifest

success

An interrupted download does not need to restart; Ollama verifies storage layer by layer, and re-running the same command automatically resumes incomplete layers.

Also note that ollama run has built-in pull logic: when running a model for the first time, download and loading complete automatically, so in daily use a separate pull is often unnecessary.

Different spec tags correspond to different prebuilt model files from the vendor; you cannot specify an extra quantization level when pulling. To compress a large model into a smaller size yourself, use the create command to quantize, which is covered in the Modelfile customization chapter.


Viewing local models: list and show

list shows all local models and their disk usage, the most common inventory command.

List local models:



ollama list

For example:



$ ollama list

NAME               ID            SIZE      MODIFIED

qwen3.5:0.8b       9e3f4b3a1c2d  1.0GB     5 minutes ago

qwen3.5:4b         b1c7d9e2f3a4  3.4GB     2 days ago

qwen3.5:latest     a8b2c9d3e4f5  6.6GB     2 hours ago

The four columns are model name, version fingerprint, disk usage, and last modified time; when disk is low, checking by the SIZE column is most direct.

To look deeper at a model's details, use the show command:

# 查看模型详情:能力、参数、系统提示词、许可证等

ollama show qwen3.5

show answers several typical questions: what capabilities the model supports (chat, vision, tool calling), what the default generation parameters are, what the system prompt says, and how large the context window is.

It also has an advanced use: export the model's full configuration into a Modelfile:

Example

Export the model recipe, which you can modify to rebuild your own model

ollama show

--modelfile

qwen3.5

This "view recipe - modify - rebuild" workflow is fully covered in the Modelfile customization chapter.


Viewing running models: ollama ps

list looks at disk, ps looks at memory: what is loaded, how much it uses, and when it will unload.

Example

List models currently loaded in RAM/VRAM

ollama

ps



$ ollama ps

NAME             ID            SIZE      PROCESSOR    CONTEXT    UNTIL

qwen3.5:9b       a8b2c9d3e4f5  9.6GB     100% GPU     131072     4 minutes from now

The columns mean the following:

Column Name Meaning
NAME / ID Model name and version fingerprint, same as list
SIZE Total memory currently used by the model (including RAM and VRAM)
PROCESSOR Load location: 100% GPU means entirely on the graphics card; 100% CPU means entirely in RAM; a ratio like 48%/52% CPU/GPU means VRAM is insufficient and the model is split
CONTEXT Currently allocated context window size
UNTIL Time remaining until automatic unload (keep-alive countdown)

The PROCESSOR column is the first entry point for troubleshooting "why the model is slow": as long as it is not 100% GPU, the model is not fully loaded into VRAM. Specific performance optimization methods are discussed in detail in the GPU and performance chapter.


Copying and renaming: ollama cp

cp gives an existing model a new name, often used for renaming or keeping a snapshot.

Example

Copy out a newly named model

ollama

cp

qwen3.5:4b runoob-test

Use it like a normal model

ollama run runoob-test

It has a very useful advanced trick: "borrowing a name" for a model.

Some tools hardcode a model name (such as gpt-3.5-turbo); using cp to copy a local model to that name lets such tools use the local model directly:

Example

Copy a local model to the name the tool expects

ollama

cp

qwen3.5 gpt-

3.5

-turbo

cp completes almost instantly because it only creates a new model name entry pointing to the original model file, without copying a second several-GB chunk of data on disk.


Deleting models and disk cleanup: ollama rm

rm deletes local models, the remedy for the "in but never out" problem of the model library.

Example

Delete a specified model

ollama

rm

qwen3.5:0.8b



$ ollama rm qwen3.5:0.8b

deleted 'qwen3.5:0.8b'

The recommended disk cleanup flow is: first use ollama list to find large, unused models, then rm them one by one.

If multiple tags share the same underlying files, deleting one tag does not affect the normal use of the others.

Remember to also handle models that borrowed a name via cp: after deleting the original model, the borrowed-name copy still exists and continues to occupy space; don't let them become invisible disk black holes.


Stopping models and the keep-alive residency mechanism

First look at a model lifecycle diagram, and it becomes clear at which step each management command acts.

Ollama model lifecycle: download, load, residency, and unload

The key mechanism is keep-alive: after a chat ends, the model is not unloaded immediately but resides in RAM or VRAM for 5 minutes by default.

If another request comes within these 5 minutes, the response no longer waits for model loading; if no new request arrives after the time, the model unloads automatically and frees memory.

To make a model release resources immediately, use the stop command to unload it manually:

Example

Immediately unload a specified model

ollama stop qwen3.5:4b

There are three ways to adjust the residency duration:

Method Approach Applicable scenarios
Change the global default Set the environment variable OLLAMA_KEEP_ALIVE, such as 30m or 2h Servers that want a unified residency policy
Specify per request Pass the keep_alive parameter when calling the API, such as -1 for permanent residency without unloading Application layer treats different models differently
Unload immediately ollama stop model_name Temporarily free VRAM for other tasks