Learn › Local AI on Linux › What a model is

Chapter 1. What a model is

Chapter 1 lab: What a model is. Five objectives on a real Ubuntu 24.04 machine with no internet: download Qwen3 0.6B from the machine's mirror, check it with sha256sum, read its metadata with gguf-dump, write its exact parameter count, and write the token IDs of a sentence from llama-tokenize. Free, one lab a day.

Chapter 1. What a model is

Choose Begin the lesson to start with the explanation and worked examples. The opening checks are an optional starting point for someone who already knows the subject; they are not a prerequisite for learning it. You can return to them after the lesson.

You will inspect a real AI model file and explain what a program needs to use it. By the end, you will have checked your download, read its description and seen how text becomes the numbers a language model uses. Chapter 2 uses those ideas to run the model and inspect its replies.

This chapter covers the following topics through four practical objectives.

Objectives

1. Understand the model file, the program that uses it and the text you give it. 2. Download the small Qwen3 0.6B model and check its fingerprint. 3. Inspect its metadata and count the stored parameters. 4. Use its tokenizer to turn a sentence into token IDs, then check your five lab objectives.

What you need: the Linux Foundations ideas of files, directories and a terminal. Each command below is shown before you try it. Its options, often called flags, are explained beside it. Use the examples as often as you need; copying a command is supported practice, and explaining the result is the next step.

How to use the lab

Start the practice machine when you are ready to work. While it prepares, begin Section 1.1 and its video. In the lesson, read the command and what it does, then enter it in the terminal. Type the command only, without the prompt such as admin@server1:~$. Commands and flags are case-sensitive: ls works, while LS names a different command.

Before a machine is connected, the small practice terminals use recorded examples and check the command they ask for. Once connected, your commands run on the real machine. Its current directory and files persist between steps. If you see an error, stop and compare the command, directory and explanation before continuing.

The lab is an Ubuntu 24.04 machine with 4 processor cores, 8 GB of memory and no graphics card. It uses an internal mirror for this chapter's files. Startup usually takes about three minutes, up to four on a slow start. The machine session is separate from reading: check-progress checks the five machine objectives. Reading or watching alone does not pass those checks.

The chapter's practice machine allows one free lab launch per rolling 24 hours. Follow the commands in order so each step has the files it needs.

Pre-check 1 of 5: what a model is

New to this subject? Choose Begin the lesson above to read the explanation and follow the worked examples first. You can return here afterward. Leaving this question unanswered does not change your machine grade.

Five questions before the material. A wrong answer costs nothing: the explanation states the fact and names the section that teaches it.

Pre-check 2 of 5: open-weight models

New to this subject? Choose Begin the lesson above to read the explanation and follow the worked examples first. You can return here afterward. Leaving this question unanswered does not change your machine grade.

Pre-check 3 of 5: checking a download

New to this subject? Choose Begin the lesson above to read the explanation and follow the worked examples first. You can return here afterward. Leaving this question unanswered does not change your machine grade.

Pre-check 4 of 5: the name 0.6B

New to this subject? Choose Begin the lesson above to read the explanation and follow the worked examples first. You can return here afterward. Leaving this question unanswered does not change your machine grade.

Pre-check 5 of 5: tokens

New to this subject? Choose Begin the lesson above to read the explanation and follow the worked examples first. You can return here afterward. Leaving this question unanswered does not change your machine grade.

1.1 What a model is

An AI language model helps a program produce text. To understand what runs on your machine, keep three things separate:

PartWhat it doesIn this course
Model fileStores numbers learned during training, plus information needed to use themThe Qwen3 0.6B file you will download
Running programLoads those numbers and performs calculationsThe llama.cpp tools here; Ollama in Chapter 2
Input textTells the program what text the model should work withA question, instruction or sentence

The learned numbers are weights. Each learned number is a parameter. Training adjusts the weights using examples. Inference uses the trained weights to produce output. A large language model, or LLM, is a model trained to work with language.

Worked example: from input to a reply

Imagine giving a running language model the text The sky is. This is an illustration of the process, not a captured answer from our lab.

1. The program converts the input into tokens, pieces of text represented by numbers called token IDs. A token can be a word, part of a word or punctuation. 2. The program uses the model's weights to calculate scores for possible next tokens. 3. It selects a token, adds it to the text and repeats using the extended text. The result might begin The sky is blue, but another result is possible.

The file supplies learned numbers; the program does the work; the input changes what the program asks the model to continue. A plausible reply still needs checking. This chapter will inspect the file and tokens; Chapter 2 will run inference and compare actual replies.

Try the idea with support. Identify the three parts in this nearby case: Ollama loads Qwen3 0.6B and receives Explain what a server does. The model is Qwen3 0.6B, Ollama is the running program, and the quoted instruction is the input, also called a prompt. Changing the prompt changes the input; it does not by itself train new weights. You can reread this example whenever those terms blur together.

The name 0.6B describes an approximate parameter count. Section 1.6 explains why the exact count reported by this particular file differs from that rounded name. You do not need to memorize the count now.

The lab model is Qwen3 0.6B, published by the Qwen team under the Apache 2.0 licence. Its file uses the same kinds of parts as larger models in its family. In Chapter 2 you will compare the model file's checksum before and after inference to check whether its bytes changed in that experiment.

The film uses Qwen3 8B, a larger model of the same family. The checksum it shows is this chapter's 0.6B file. Its example replies and score bars are illustrations, not captured model output. The written explanation above is a complete route through these ideas if you prefer reading.

1.2 Where models come from

Model publishers make files available through repositories such as Hugging Face and the Ollama library. An open-weight model makes its trained weights available under a licence. That does not automatically include its training data or permission to do anything with it. Read the licence before using or sharing a model.

This lab already has a web server called nginx running on it. During setup, the lab downloads selected files, checks their hashes and puts copies in the server's download directory. A server holding copies of files from another source is called a mirror. You do not need to install or start this server. Your task is to request its files and check the copies you save.

The address http://mirror.internal/models/ has three parts:

PartMeaning
http://Use HTTP, the protocol for sending a web request and receiving a response
mirror.internalThe server name configured inside this lab
/models/Ask that server for its models directory

Inside the lab, mirror.internal points to 127.0.0.1, an address that means this same machine. The server reads files from /srv/mirror; you will save your own copies under ~/models. Those are different directories. This address works in the lab terminal, not in your laptop's browser. The lab has no internet access after setup, so use this mirror for the lesson's downloads.

Start by asking for the directory listing. The program curl sends the request and prints the response. With no save option, it does not create a model file. Here the response is HTML, the text a browser normally turns into a web page. You can read the filenames between the links without learning HTML.

Find which model files the isolated AI machine offers.

curl http://mirror.internal/models/

curl requests the mirror URL and prints the directory listing. The trailing / asks for the models directory, not a named file. Run this from your home directory; it does not save a file.

Run the command above, then use the explanation below to interpret the result.

prompt: admin@server1:~$ answer: curl http://mirror.internal/models/ output: <html> <head><title>Index of /models/</title></head> <body> <h1>Index of /models/</h1><hr><pre><a href="../">../</a> <a href="LICENSE">LICENSE</a> 15-Jan-2026 09:00 11338 <a href="SHA256SUMS">SHA256SUMS</a> 15-Jan-2026 09:00 338 <a href="SOURCES.txt">SOURCES.txt</a> 15-Jan-2026 09:00 879 <a href="qwen3-0.6b-f16.gguf">qwen3-0.6b-f16.gguf</a> 15-Jan-2026 09:00 1509347040 <a href="qwen3-0.6b-q4_k_m.gguf">qwen3-0.6b-q4_k_m.gguf</a> 15-Jan-2026 09:00 522640096 <a href="qwen3-1.7b-q4_k_m.gguf">qwen3-1.7b-q4_k_m.gguf</a> 15-Jan-2026 09:00 1359279776 </pre><hr></body> </html> hint: Section 1.2. curl, then the address of the mirror's models directory, http://mirror.internal/models/ with its closing slash.

The lines containing qwen3-0.6b-q4_k_m.gguf show that the server offers that file. You have read a listing, not downloaded the model or run it. To request a file, add its name after /models/, as the next step does with SOURCES.txt. Each file has a date and a size in bytes. Three are models: Qwen3 0.6B in the Q4_K_M format, 522,640,096 bytes; the same model at 16 bits per number, 1,509,347,040 bytes; and Qwen3 1.7B in Q4_K_M, 1,359,279,776 bytes. A bit is a single 0 or 1. Q4_K_M is called 4-bit because most of its numbers take 4 bits, but it is a mix, and llama.cpp counts this file at about 5.5 bits per number. That is why the 16-bit file is 2.9 times larger, not 4 times. Chapter 4 explains the bit counts. The other three files describe the models: their checksums, their sources and their licence.

You can check the address with getent hosts mirror.internal. getent hosts asks the system to look up a hostname; the lab configuration should return 127.0.0.1. This verifies the name lookup, not whether the web server is working.

To check the web response without downloading a model, run:

curl -I http://mirror.internal/models/SOURCES.txt

Uppercase -I asks for the response headers, which describe the response rather than containing the file. A status of 200 means this request succeeded. A 404 means the server answered but did not find that path. Check the filename and capital letters. Curl error 6 means name lookup failed; error 7 means it could not connect. Confirm the machine is ready and that you used the lab terminal. You do not need sudo or a new server installation to complete this chapter.

The mirror sends existing files. In Chapter 2 you will start a separate program, Ollama, that loads a model and generates replies. Downloading the model and running it are two separate actions.

1.2 SOURCES.txt: where each file came from

A file you download should come with a record of where it came from. The mirror keeps one, SOURCES.txt:

Check the mirror's source record before choosing a model file.

curl http://mirror.internal/models/SOURCES.txt

curl prints SOURCES.txt from the mirror. This is a read-only request and works from your home directory; it saves nothing.

Run the command above, then use the explanation below to interpret the result.

prompt: admin@server1:~$ answer: curl http://mirror.internal/models/SOURCES.txt output: Where each file on this mirror came from. Every file was checked against the SHA-256 below when this machine was built.

qwen3-0.6b-q4_k_m.gguf Qwen3 0.6B by the Qwen team (Alibaba Cloud), 4-bit (Q4_K_M). Ollama library model qwen3:0.6b, model layer sha256:7f4030143c1c477224c5434f8272c662a8b042079a0a584f0a27a1684fe2e1fa qwen3-1.7b-q4_k_m.gguf Qwen3 1.7B by the Qwen team (Alibaba Cloud), 4-bit (Q4_K_M). Ollama library model qwen3:1.7b, model layer sha256:3d0b790534fe4b79525fc3692950408dca41171676ed7e21db57af5c65ef6ab6 qwen3-0.6b-f16.gguf Qwen3 0.6B by the Qwen team (Alibaba Cloud), 16-bit (F16). Ollama library model qwen3:0.6b-fp16, model layer sha256:bc2421370aa09f86eedd8e57e5b5ff3d1200f4638623c749c2ec820c3b5bff97 LICENSE The licence published with these models: Apache License 2.0.

The same files are also served as an Ollama registry under /v2/. hint: Section 1.2. curl, then the file SOURCES.txt in the mirror's models directory, http://mirror.internal/models/.

Each model file is a copy of a model in Ollama's library: qwen3:0.6b is the 0.6B model in the 4-bit Q4_K_M format. The long sha256: value after each one is the file's SHA-256 checksum, which Section 1.4 recomputes on your own copy. Q4_K_M names the 4-bit storage mix that Section 1.6 looks inside. The /v2/ registry at the end is what Chapter 2's Ollama downloads from.

1.2 The licence

An open-weight model comes with a licence: the terms under which you may use, change and share it. Read the first lines of the one on the mirror. The -s option silences curl's progress meter and its error messages, and head -n 4 keeps the first four lines:

Identify the model licence before using its weights.

curl -s http://mirror.internal/models/LICENSE | head -n 4

curl -s fetches the licence quietly, including suppressing errors; | sends its text to head; head -n 4 prints the first four lines. If nothing prints, do not assume the download succeeded. No local file is created.

Run the command above, then use the explanation below to interpret the result.

prompt: admin@server1:~$ answer: curl -s http://mirror.internal/models/LICENSE | head -n 4 output: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ hint: Section 1.2. curl, silenced, on the file LICENSE in http://mirror.internal/models/, piped into head for the first four lines.

Apache License, Version 2.0. It allows use, change and redistribution, including commercial use, on condition that you give recipients a copy of the licence, mark the files you changed, and keep the copyright and attribution notices. Other models carry other licences, and some limit how a model may be used, so read the licence before you build on a model. The model's own file records its licence too: Section 1.5 finds it.

1.3 Downloading a model file

Downloads, models, tools and your answers each get a directory of their own in your home directory. mkdir makes all four at once:

Separate the AI model, tool archive, unpacked programs and answer files.

mkdir ~/models ~/downloads ~/tools ~/answers

mkdir creates the four named directories in your home directory (~). It prints nothing on success. Start from your home directory; the ~/ paths also work from elsewhere.

Run the command above, then use the explanation below to interpret the result.

prompt: admin@server1:~$ answer: mkdir ~/models ~/downloads ~/tools ~/answers output: hint: Section 1.3. mkdir with four directories in your home: ~/models, ~/downloads, ~/tools and ~/answers.

mkdir prints nothing when it succeeds. List the directories in your home with ls -d ~/*/, where the trailing slash matches directories only:

/home/admin/answers/    /home/admin/models/
/home/admin/downloads/  /home/admin/tools/

1.3 Into ~/models

The download in the next step saves the file into the directory you are standing in. Move into ~/models first:

Put subsequent model downloads where the lab expects them.

cd ~/models

cd changes your shell's current directory to ~/models. The next commands use bare file names, so their location now matters.

Run the command above, then use the explanation below to interpret the result.

prompt: admin@server1:~$ answer: cd ~/models output: hint: Section 1.3. cd into the new directory ~/models.

The prompt now shows ~/models. The commands in Sections 1.3 to 1.6 name the model file without a path, so they work from here. Each also accepts the full name, ~/models/qwen3-0.6b-q4_k_m.gguf, from anywhere.

1.3 curl -O: the download

curl fetches the address it is given. With -O it saves what it receives to a file named after the last part of the address, here qwen3-0.6b-q4_k_m.gguf. With -R it gives the file the date the server reports, instead of the time of the download. The name itself car

Practice Chapter 1. What a model is in a real Linux terminal at The Linux Camp. Progress is verified automatically as you type commands on the machine.