Day 1 of 960 minCipher Cadet
Day 1: Orientation and Your First Chat With a Local Model
Taught by Mr Elite Updated
By the end of today you can
- Explain in plain words what a language model is and what you will build over nine days
- Install Python 3, a code editor and Ollama and confirm each one works
- Run a small model from the terminal and get an answer
- Exit the chat cleanly and list the models on your machine
Imagine you type a question into a chatbot and it answers. Now imagine that every word you typed went to a company's server, and you had no idea what happened to it afterwards. For a private note, a work document or a half-finished idea, that is uncomfortable.
Today we fix that by running the model on your own computer. Nothing leaves your machine, nothing costs money, and you can break things safely. Over nine days you will turn this into your own assistant, then attack it and harden it. That order matters: you cannot defend something you do not understand, so we build first.
What you will build, and why security comes into it
Over nine days you will build a small AI assistant that runs on your own machine. It starts as a chat in the terminal. Then it becomes a Python script, gets a role, learns from your own notes, and finally gets one limited tool it can use.
Alongside each step I will show you how that feature can be abused. A chatbot that follows instructions can be tricked into following the wrong ones. A bot that reads documents can be fed poisoned documents. A bot with a tool can be talked into misusing it. On day 9 you attack your own assistant, fix what you find and write it up.
What a language model actually is
A language model is a program that has read a huge amount of text and learned patterns in it. When you give it some text, it predicts what text should come next, one small piece at a time. Those pieces chain together into sentences that read like an answer.
It does not look things up in a database, and it does not understand things the way you do. It produces likely-sounding text. That is why it can be fluent and wrong at the same time, and why it can be talked into things. Keep that in mind, because most of this course comes back to it.
- Model
- The file of learned patterns that generates text. It is the part that does the predicting.
- Prompt
- The text you send to the model. Your question is a prompt.
- Local model
- A model that runs on your own computer instead of on a company's server.
- Ollama
- A free program that downloads and runs local models for you with simple commands.
Quick check
Why can a language model sound confident and still be wrong?
It generates text that fits the pattern of the question, with no built-in fact check.
Watch me do it: install the tools
We need three free things: Python 3, a code editor and Ollama. I will install them in that order and check each one. Use Terminal on macOS or Linux, and PowerShell on Windows. You can find it by searching for its name in your Start menu or Spotlight.
python3 --versionollama --versionWatch me do it: your first chat
Now we download a small model and talk to it. I am choosing a small one so it runs on an ordinary laptop. The first run downloads the file, which is around a couple of gigabytes, so use a decent connection and give it a few minutes.
ollama run llama3.2What is a firewall, in two sentences?ollama listQuick check
You typed /bye and the chat closed. Is the model still on your computer?
Leaving the chat stops the model running, but the downloaded files remain, as ollama list shows.
Your own practice: poke at it
No lab today, so this exercise is on your own machine. Start the model again with ollama run llama3.2 and try the three prompts below. Write down what you notice. You are learning how the model behaves, which is the groundwork for attacking and defending it later.
Everything you typed stayed on your computer. You can even turn off your wi-fi after the download and the model still answers. That is what local means.
If it did not work
Running ollama commands inside the chat prompt, or chat text in the normal terminal
If the line starts with >>> you are inside the chat. Type /bye to leave. Commands like ollama list belong at the normal prompt.
Forgetting to tick Add Python to PATH on Windows
Run the Python installer again, choose Modify or reinstall, and tick the box. Then open a new terminal window.
Testing the install in a terminal that was already open
Close it and open a new one. Old terminals do not see programs installed after they started.
Trusting the model's answer without checking
Treat every answer as a draft. Verify anything that matters against a reliable source.
Recap
- A language model predicts likely next text, so it can sound sure and be wrong
- A local model runs on your machine, so your prompts do not leave it
- Ollama downloads and runs models with one command
- You need Python, a code editor and Ollama for the rest of the course
- ollama run starts a chat, /bye ends it, ollama list shows what is installed
- Security starts with understanding how the system behaves, so we build first and attack later
Cheat sheet
python3 --version- Checks Python 3 is installed (try python or py on Windows)
ollama --version- Checks Ollama is installed
ollama run llama3.2- Downloads if needed, then opens a chat with the model
/bye- Leaves the chat and returns to your normal terminal
ollama list- Lists the models stored on your computer
Prompt- The text you send to a model
Before the next day
Mission: Install and ask your first question
Make sure all three tools work on your machine, then have one real conversation with your local model. A clean setup today saves you from confusing errors tomorrow, when we start sending messages from a script.
About 30 min
You are done when: One screenshot showing your question and the model's answer in the terminal, saved somewhere you can find it.
Want more? Run ollama run llama3.2:1b as well, ask both models the same question and write two lines on how the answers differ.
Quiz
4 questions. Your score is saved with your progress.
1. What is the best plain description of what a language model does?
It generates text that fits patterns, which is why it can be fluent but wrong.
2. What is one security benefit of running a model locally?
With a local model the text you send is processed on your machine rather than sent to a third party.
3. Your terminal shows >>> Send a message. What does that tell you?
That prompt appears when ollama run has opened an interactive chat. Use /bye to leave.
4. You ask the same creative question twice and get different answers. Why?
Generation involves randomness in choosing the next piece of text, so outputs vary.
Finish the day
Mark the day complete to save your progress.
Next: Tomorrow you write your first Python script that sends a message to the same local model and prints the reply. Today's install is what makes that possible.
Your notes
Private to this device. Write what you want to remember from today.