Before the session
Install LM Studio and download your model
In this lesson you install LM Studio, download the workshop model, ask it a question from inside the app, and turn on the server your code will use. At the end, if you want to compare with the cloud during the session, you get a free OpenRouter key.
An honest warning: these steps are about real apps and websites, and they change. This guide is from October 2026. If a button has a different name, the logic is the same.
First, understand what you're downloading
The model is a file
A language model, seen from your disk, is a big file full of numbers. Those numbers are called parameters (or weights): they're what the model "learned" while training on an enormous amount of text. When you ask it a question, your computer does math with those numbers to work out, word by word, how the text continues.
The model's name tells you how many parameters it has:
| In the name | How many parameters | In the analogy |
|---|---|---|
4b | 4 billion | A cook with good experience who fits in a regular kitchen |
8b / 9b | 8 or 9 billion | More experience, needs a bigger kitchen |
27b, 31b, 120b | Tens or hundreds of billions | The restaurant's chefs: they don't fit in your home |
Why a model with 4 billion numbers fits in 2.5 GB
Each parameter is a number with decimals. Stored at full precision it would take 2 bytes, and 4 billion parameters would be about 8 GB. To fit on a laptop, the model is quantized: each number is stored with less precision (about 4 to 5 bits instead of 16). The file ends up less than a third of the size and the model loses a little quality, much less than you'd expect.
Not quantized Quantized (about 5 bits per number)
4 billion x 2 bytes 4 billion x ~0.6 bytes
= about 8 GB = about 2.5 GB
+--------------------------------+ +--------+
|################################| |########|
+--------------------------------+ +--------+
doesn't fit comfortably in 8 GB fits, with room for everything elseIn the analogy: it's the same cook with their recipes written in a pocket recipe book. It weighs much less and loses some fine detail.
In LM Studio you'll see two words next to the models: GGUF and MLX. They're two file formats for the same model. MLX is the format optimized for Macs with an Apple chip; GGUF works everywhere. LM Studio offers you the ones that work on your computer and preselects one; for the workshop either one works (on a test Mac, lms get downloaded the GGUF version).
The workshop model: Qwen3 4B
We'll all use the same model, so we can compare results live:
| Detail | Value |
|---|---|
| Name in LM Studio | qwen/qwen3-4b-2507 |
| Parameters | 4 billion |
| Download | about 2.5 GB |
| Why this one | It fits on an 8 GB laptop, knows how to use tools (we need that in part 4), and answers directly, without a long "reasoning" phase before responding |
Watch out for a model with an almost identical name: qwen/qwen3-4b-thinking-2507. It's the version that "thinks out loud" before answering: it takes longer and fills the answer with reasoning text. Download the one that doesn't say thinking.
Step 1. Install LM Studio
LM Studio is a free app that does three things: it downloads models, loads them into your laptop's memory, and serves them, either in a chat inside the app or on a server so other programs can talk to them.
- Go to lmstudio.ai and download the version for your system.
- Install it like any other app. On Mac, drag it to Applications. On Windows, open the installer and follow the steps. On Linux it downloads as an AppImage: give it permission to run and open it.
- Open it. If it offers an initial tour or to download a suggested model, you can skip it: we're going to download a specific one.
What LM Studio requires, according to its documentation:
| System | What it needs |
|---|---|
| Mac | Apple chip (M1 or newer) and macOS 14 or higher. Intel Macs are not supported |
| Windows | x64 processor with AVX2 support (almost any from recent years) or ARM (Snapdragon X) |
| Linux | x64 or ARM64; tested mostly on Ubuntu 20.04 and 22.04 |
Step 2. Download the model
- In LM Studio, go to the model search: the Discover tab (the magnifying glass icon, in the left sidebar).
- Search for
qwen3-4b-2507. - Choose Qwen3 4B 2507, the one that doesn't say Thinking, and click Download.
- Wait for it to finish. The downloads bar shows you the progress; it depends on your internet.
If you prefer the terminal, LM Studio comes with its own command, lms, which does the same thing:
# Download the workshop model (it asks you before downloading)
lms get qwen/qwen3-4b-2507If the terminal says lms doesn't exist, open LM Studio at least once, close the terminal, and open a new one: just like with Python, the new terminal reads the updated PATH.
Step 3. Try it in the LM Studio chat
Before connecting code, check that the model answers:
- Go to the Chat tab.
- At the top, in the model selector (Select a model to load), choose Qwen3 4B 2507. LM Studio loads it: it copies it from the disk into RAM. It takes a bit the first time.
- Type something to it, for example:
Explain in two sentences what a CSV file is.
If it answers, the model works on your laptop. Notice two numbers LM Studio shows below the answer: the tokens per second (how fast it writes) and the time to first token. We'll measure them with code during the session.
Turn off your Wi-Fi and ask it again. It will answer the same way. That's the clearest proof that the model lives on your computer: there's nobody else in the conversation.
Step 4. Turn on the server
The LM Studio chat is handy, but in the workshop we'll talk to the model from a Python script. For that, LM Studio opens an order window: a local server.
- Go to the Developer tab (in the left sidebar).
- Turn on the server switch (Start server, or the status changes from Stopped to Running).
- LM Studio shows you the address:
http://localhost:1234.
localhost is the name your computer uses to refer to itself. A request to localhost doesn't go out to the internet: it goes from one program to another inside your laptop. And 1234 is the port, the window number: your computer can have many servers, and each one serves at a different number.
YOUR LAPTOP
+-------------------------------------------------------+
| |
| Your Python script |
| | |
| | order to http://localhost:1234/v1 |
| v |
| +------------------------+ +-----------------+ |
| | LM Studio: server | --> | Qwen3 4B | |
| | (window 1234) | <-- | (in your RAM) | |
| +------------------------+ +-----------------+ |
| |
+-------------------------------------------------------+
none of this goes out to the internetIn the server settings there's an option to serve requests from other computers on your network (Serve on Local Network). Leave it off: that way only your laptop can talk to your model.
If you prefer the terminal:
# Turn on the LM Studio local server
lms server start
# Load the model into RAM
lms load qwen/qwen3-4b-2507
# Show which models are loaded in RAM right now
lms psStep 5. Check that the server responds
With the server on, ask it for the list of models from the terminal. On Mac and Linux:
curl http://localhost:1234/v1/modelsOn Windows (PowerShell), type curl.exe instead of curl:
curl.exe http://localhost:1234/v1/models
curl is a program that makes a request to an address and shows what comes back. The answer comes in JSON, the data format you saw in the previous lesson: curly braces to group, square brackets for lists. You should see text with this shape, with the names of the models you've downloaded in place of ...:
{
"data": [
{
"id": "...",
"object": "model",
"owned_by": "organization_owner"
}
],
"object": "list"
}Write down your model's id. It should be qwen/qwen3-4b-2507. If LM Studio named it differently, the session code has to use exactly that text.
If curl says Connection refused (or "No connection could be made"), the server is off: go back to step 4.
Step 6. When you're done, free up the memory
A loaded model keeps taking up RAM even if you're not talking to it. When you finish practicing, unload it from memory and turn off the server:
- In the app: in the top bar, the Eject button next to the model; in Developer, turn off the server.
- In the terminal:
# Remove all loaded models from RAM
lms unload --all
# Turn off the local server
lms server stopThe model stays on your disk: next time you load it again without downloading it. If someday you want the space back, delete it from the My Models tab.
(Optional) Your OpenRouter key, to compare with the cloud
In part 3 of the session we'll send the same orders to your laptop and to a model in the cloud, to compare. For the cloud we use OpenRouter, a service with free models that doesn't ask for a card. If you don't want to create the account, you can do the whole workshop with just your laptop and watch the comparison on screen.
If you're coming from the terminal agents workshop, you already have this key. Use the same one.
- Go to openrouter.ai and create an account (you can use Google or GitHub).
- In your account menu, go to Keys and create a new key (Create Key). Give it a name you'll recognize, for example
local-model-workshop. - Copy it and save it right then: the full key is shown only once. It looks something like this:
sk-or-v1-xxxxxxxxxxxx.
The key is secret: whoever has it can make requests in your name. Don't paste it in the video call chat or write it inside a code file. In the session we'll show you how to give it to the script without writing it in any file.
About the limits: OpenRouter's free models allow 20 requests per minute and 50 per day if you've bought fewer than 10 credits (or none). That's more than enough for the session.
Check that you're ready
- LM Studio is installed and opens.
-
qwen/qwen3-4b-2507is downloaded and answered in the LM Studio chat. - With the server on,
curl http://localhost:1234/v1/modelsshows my model. - (Optional) I have my OpenRouter key saved.
What if the model won't load, or the computer gets very slow?
It's almost always memory. Close the browser (or the tabs you're not using) and heavy programs, and load it again. If you have 8 GB and it still won't load, come as you are to the session: you do the cloud part and watch the local demo on screen. What you learn is the same.
Check your understanding
1. What does it mean to "quantize" a model, and what is lost?
Storing each of its parameters with less precision (about 4 to 5 bits instead of 16). The file ends up less than a third of the size, and that's why it fits on a laptop; in exchange, the model loses a little quality.
2. Your script talks to http://localhost:1234. Does your request go out to the internet?
No. localhost is your own computer: the request goes from your script to LM Studio without leaving the laptop. 1234 is the port, the number of the window where the server takes orders.
3. You finished practicing and your laptop is still slow. What happened?
The model is still loaded in RAM, taking up space even though nobody is talking to it. Eject it (Eject, or lms unload --all) and turn off the server.
Summary
- A model is a file full of parameters.
4bis 4 billion; quantized to about 4 to 5 bits they fit in 2.5 GB. - You downloaded
qwen/qwen3-4b-2507(the one that doesn't say thinking), tried it in the LM Studio chat, and turned on the server athttp://localhost:1234. curl .../v1/modelstells you your model's exactid. When you're done: eject the model and turn off the server.- Optional: a free OpenRouter key to compare with the cloud. With that, you're ready for the session.