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

Ollama running models

Ollama running models

Ollama runs models using the ollama run command.

For example, to run qwen3.5:0.8b and chat with it, use the following command:

First run downloads automatically, about 1.0GB:

ollama run qwen3.5:0.8b

After the command runs you'll first see download progress, then enter the conversation directly once complete:



$ ollama run qwen3.5:0.8b

pulling manifest

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

pulling 5e2ad5... 100% |████████████████████|  11KB

verifying sha256 digest

writing manifest

success

>>> 你好,你是什么模型?



>>> /bye

Seeing the >>> prompt means the model is loaded; type a question and press Enter to chat.

If the network drops mid-download, no need to start over—Ollama supports resumable downloads, and rerunning the same command continues from the previous progress.


Select a model with the interactive menu

Besides typing commands directly, entering ollama with no arguments opens an interactive menu; newer versions use it as the unified entry point.



$ ollama

Chat, Code, & Work

    Chat with models, code, search the web, and delegate real work



  Launch Claude Code

    Anthropic's coding tool with subagents



  Launch OpenCode

    Anomaly's open-source coding agent



  Launch Hermes Agent

    Self-improving AI agent built by Nous Research



  Launch OpenClaw

    Personal AI with 100+ skills



  More...

    Show additional integrations

Choose Chat, Code, & Work to pick a downloaded model and start chatting; the effect is identical to ollama run.

Here you can select a model:

Launch in the menu is used to start integrated tools like VS Code and Claude Code; it's an advanced feature covered later in the tutorial.


Choosing your first model: pick according to your memory

Bigger isn't always better—a model your machine can't run will only spin your fans furiously and take seconds or even minutes to reply.

The principle for beginners is simple: run small models first, then gradually increase once things run smoothly. Choose according to your machine's memory and VRAM:

Your machine configuration Recommended tag Download size Expected experience
8GB memory, no discrete GPU qwen3.5:0.8b / 2b 1.0 ~ 2.7GB Smooth lightweight chat
16GB memory, no discrete GPU qwen3.5:4b / 9b 3.4 ~ 6.6GB Default spec, balanced quality and speed
GPU with more than 8GB VRAM qwen3.5:9b or qwen3.5:latest About 6.6GB GPU acceleration, noticeably faster
GPU with more than 16GB VRAM qwen3.5:27b About 17GB Higher quality long text and code
Configuration really insufficient qwen3.5:cloud No download needed Cloud inference, requires signing in to an Ollama account

The capability gap between different specs of the same model is real. 0.8b is suitable for testing environments; for daily use, at least 4b is recommended.


Understanding the model:tag naming rule

The name you write in the command consists of two parts, "model name + tag", which determines exactly what you download.

model:tag naming rule anatomy diagram

Model name: the family's name

The model name corresponds to a family in the official model library, such as qwen3.5, gemma4, deepseek-r1.

A family may have multiple specs sharing one model name.

Tag: spec and version

The tag determines which specific file is downloaded; common ones are parameter specs like 0.8b, 9b, 27b.

When no tag is written, Ollama automatically adds latest, which is the default spec set by the official release for that model.

For qwen3.5, ollama run qwen3.5 is equivalent to ollama run qwen3.5:latest, currently pointing to the 9b spec.

Namespace: who published it

A name with a slash indicates a model published by a third party; before the slash is the publisher's username.

Models in the official library have no namespace; only models published by individuals or teams (in a format like runoob/my-model:4b) do. Model sharing and distribution are demonstrated in the private deployment chapter.

List downloaded models

When unsure which models are local and how much space each takes, use the list command to check:

Example

List all local models

ollama list



$ ollama list

NAME               ID            SIZE      MODIFIED

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

qwen3.5:latest     a8b2c9d3e4f5  6.6GB     2 hours ago

The next chapter covers model management commands such as list, show, and rm in full.


Exit, re-enter, and switch models

In conversation mode, type /bye to exit and return to the normal terminal.

Example

Type /bye to exit the conversation and return to the normal terminal

/

bye

Rerunning the same ollama run command re-enters the conversation; since the model is already downloaded, it enters almost instantly this time.

To chat with a different model, just run another model—the two can be switched back and forth:

Example

Switch from a small model to the default spec

ollama run qwen3.5:4b

Switching back works the same way

ollama run qwen3.5:0.8b

After switching, the previous model stays in memory for about 5 minutes and is unloaded automatically if there are no new requests. This mechanism is called keep-alive, and the next chapter explains how to adjust it.

To enter multiple lines of text during a conversation, wrap them in three double quotes:

Example

""

"Translate the following passage into English:
... RUNOOB is a tutorial website.
... Thank you.
... "

""


Using models via the Python SDK

If you want to integrate Ollama with Python code, you can use Ollama's Python SDK to load and run models.

1. Install the Python SDK

First, install Ollama's Python SDK: open a terminal and run the following command:



pip install ollama

2. Write a Python Script

Next, you can use Python code to load and interact with the model.

The following is a simple Python script example showing how to use the qwen3.5 model to generate text:

Example

import

ollama

response

=

ollama.

generate

(

    model

=

"qwen3.5"

,

 

Model name

    prompt

=

"Who are you."

 

Prompt text

)

print

(

response

)

3. Run the Python script

Run your Python script in the terminal:

python test.py

You'll see the model return an answer based on your input.

4. Conversation mode

Example

from

ollama

import

chat

response

=

chat

(

    model

=

"qwen3.5"

,

    messages

=

[

       

{

"role"

:

"user"

,

"content"

:

"Why is the sky blue?"

}

   

]

)

print

(

response.

message

.

content

)

This code has a conversation with the model and prints the model's reply.

5. Streaming responses

Example

from

ollama

import

chat

stream

=

chat

(

    model

=

"qwen3.5"

,

    messages

=

[

{

"role"

:

"user"

,

"content"

:

"Why is the sky blue?"

}

]

,

    stream

=

True

)

for

chunk

in

stream:

   

print

(

chunk

[

"message"

]

[

"content"

]

,

end

=

""

,

flush

=

True

)

This code receives the model's response in a streaming fashion, suitable for handling large data.