[ norboten ]
automation · lab ollama-03

The Model That Will Not Load

· about 35 minutes · runs on ubuntu-26.04-automation · unrated

An unrated lab. It runs on your machine with no account and no network, and everything about it — the faults, the checks, the hints and the reference solution — is in the repository. An attempt on it is recorded on your profile and never moves a rating: only rated labs do. Rated and unrated labs.

The briefing

The operations team's assistant runs Ollama with qwen2.5:0.5b on this 3 GB machine. After a round of "tuning" it stopped answering entirely: some requests come back with a 500 and a long error about a buffer, others never come back at all, and the service's restart counter keeps climbing.

The tuning is all in one place, and every line of it was meant well: long documents need a big context window, eight people use the assistant, and a memory limit keeps a runaway model from taking the machine down.

What the team actually needs:

  • answers to questions of up to 4,096 tokens,
  • two people served at the same time,
  • a memory limit on the service of at least 1 GiB and at most 2 GiB, with the model comfortably inside it.

What is expected, and graded:

  1. A question gets an answer, and Ollama does not restart while answering it.
  2. The loaded model serves a 4,096-token context to at least two requests at once.
  3. The service has a memory limit between 1 GiB and 2 GiB, and its peak memory stays well below it.

You have root through sudo. Everything must still hold after a reboot.

What is graded

The machine is checked, rebooted, and checked again. A check passes only if it passes both times.

CheckObjective
01_a_question_gets_an_answerSize a model server's context and parallelism to the memory it has
02_two_people_with_4096_tokens_eachSize a model server's context and parallelism to the memory it has
03_a_memory_limit_with_room_to_workCap a service's memory without starving it, and tell an out-of-memory kill from an allocation failure

Start it

  1. 2Labs
  2. ollama-03select this one
  3. udownload it
  4. sstart the machine

Reading

Where the lab's hints send you, level by level, as you ask for them (h, then l opens a journal section in the TUI).

Theory for this lab

4 questions on the same topic, in the lab's Theory tab. They never affect the lab's grade. Three of them, to answer here:

Question 1

A model file is 400 MB. Ollama is started with OLLAMA_CONTEXT_LENGTH=32768 and OLLAMA_NUM_PARALLEL=8. Why does loading need far more memory than 400 MB?

Question 2

The journal of a service says "A process of this unit has been killed by the OOM killer" and "Failed with result 'oom-kill'", and the machine has gigabytes free. What is the likeliest cause?

Question 3

Ollama answers a request with HTTP 500 "failed to allocate buffer for kv cache", and NRestarts does not change. How does this differ from an OOM kill?