Module 2 · Installing and Running Open Source AI

A model on your computer: memory, context and network

Lesson 4 of 15 9 min lesson Updated on October 30, 2026
Progress in the course27%

In this lesson

Local model: memory and care.

Installing Ollama takes a few minutes. Understanding what it does with your memory and your network is what separates people who only try it out from people who use a local model at work.

Running a model, from the inside

The ollama run command looks like one thing, but it is two parts. The client is what you type into. It talks to a server that listens on your own computer, on port 11434. The server puts whatever fits on the graphics card and the rest in regular memory.

The ollama ps command shows what is loaded. Look at the PROCESSOR column: 100% GPU means the whole model is on the card. Any mix with CPU means part of it runs in regular memory, much more slowly.

Quantization: fitting in memory

A model stores billions of numbers. Each number takes up space. Quantization stores each number with fewer bits, like a photo saved with fewer colors: you can still recognize it, and the file is much smaller.

The version Ollama downloads by default already comes compressed. Fewer bits mean a smaller file and a faster answer, with a small loss of quality. Rule of thumb: the file should take up at most half of the memory you have for the model. When it does not fit, the computer struggles.

The context window

The model has no long memory of the conversation. It has a window: a limit on the pieces of text, called tokens, that it can look at in one go. It adds up the instructions, the history and the answer being written. What does not fit falls out, oldest first. That is why the model "forgets" what you agreed.

To make the window bigger, use the command below inside a conversation.

/set parameter num_ctx 16384

A bigger window uses more memory. If the model was 100% on the card and now shows as mixed, it was the context that pushed part of it out. Choose a smaller model, a smaller context or more memory.

What the pros know

A model may accept huge windows while Ollama opens only a small one. The Ollama documentation says the default depends on video memory: with less than 24 GiB, the window is 4 thousand tokens; between 24 and 48 GiB, 32 thousand; from 48 GiB up, 256 thousand. In practice, most ordinary computers start with 4 thousand, which fills up fast with a document of a few pages. People who really use local models always check and adjust the context, instead of blaming the model for "forgetting".

Modelfile: instructions in a file

The Modelfile keeps the assistant's role and the parameters in a text file. It starts from an existing model and creates a new one, with a name of your own, that anyone on the team can run with the same behavior.

FROM qwen3:4b
PARAMETER num_ctx 16384
PARAMETER temperature 0.3
SYSTEM """
You are the team's internal assistant. You answer in English,
in at most five lines. When you do not know, you say you do not know.
"""

Create the model with ollama create. Keep the Modelfile in the project: it is the contract, and whoever changes the instruction leaves a trail. For repeatable tests, use temperature zero.

Network: what never to leave open

The strength of a local model is that your data does not leave the machine. That holds as long as the server listens only to its own computer, which is the default. If someone opens the service to everyone "so the people on the network can use it" and the computer has a public address, anyone can use the model. The API does not ask for a password.

Careful

Never expose Ollama directly to the internet. To use it from other computers, allow only the internal network and put a firewall and a password-protected proxy in front.

License: open does not mean no rules

"Open" is about access to the files, not about the absence of rules. Qwen3 uses the Apache 2.0 license, the simplest one for companies. Llama 3.2 requires you to display "Built with Llama". Gemma requires you to pass the usage restrictions on to whoever receives the product. Before you put a model in a product, read the license.

Practice · 5 min

  1. Download a small model, chat with it and run ollama ps in another terminal. Write down the PROCESSOR column.
  2. Write five questions from your work and run them all. Note whether each answer would be good enough to use.
  3. Create a Modelfile with an instruction of your own and a bigger context, and repeat the same question.
Deliverable: a "Model card" file, with the version used, the PROCESSOR column, the scores for the five questions and your Modelfile.

Summary

Sources

Read on October 30, 2026.

  1. Ollama. Context length: default windows by video memory.
  2. Ollama. FAQ: default address and time kept in memory.
  3. Ollama. Modelfile reference.
  4. Cisco. Detecting Exposed LLM Servers: A Shodan Case Study on Ollama.

Lesson quiz

Three situations to apply what you learned.

Lesson 4 of 15

Before moving on to the next lesson

Put what you saw into practice. The boxes stay checked in this browser, so you can come back later.

Have a question about this lesson? The IV Help team answers personally on WhatsApp.

Ask on WhatsApp