跳到正文

第 1 课 · Getting Started

What Is Llama? Meta's Open-Weight Models

Learn what Llama is, what open weights means, who this tutorial is for, what you need, which examples run in your browser and how the course is organized.

Llama is a family of large language models made by Meta. Meta publishes the trained model files, called the weights, so you can download them and run them on hardware you control. You can also use Llama through many hosting providers, but the option to run it yourself is what makes it different from a purely hosted chatbot.

This tutorial is for developers, data people and curious learners who want to understand Llama and build with it. You learn to pick a model, read its license, run it locally, format prompts, fit it into memory, connect it to your documents and tools, fine-tune it and serve it safely. This is an independent tutorial. It is not made, sponsored or approved by Meta or by any tool vendor mentioned here.

Open weights is not the same as open source

When people say Llama is "open", they usually mean open weights: you can download the parameters. That does not mean everything about the model is public or unrestricted.

Question Typical answer for Llama
Can you download the weights? Yes, after accepting the license
Is the full training data published? No
Is it under a standard open source license? No, it uses Meta's own Llama community licenses
Can you use it commercially? Often yes, with conditions you must read

The license lesson explains the conditions. If "large language model" is a new phrase for you, start with Large Language Models or Generative AI and come back.

Why people use open-weight models

Reasons to run your own model

Control of data Prompts can stay on your machines
Customization Fine-tune and quantize
Stable versions A file does not change by itself
1 / 2

A hosted model is often simpler. You send a request and someone else runs the hardware. Running Llama yourself makes sense when privacy rules, offline use, predictable behavior or special customization matter more than convenience. Small models are also much weaker than the largest hosted ones, so always test on your own tasks.

What you need

  • Basic Python: functions, lists, dictionaries and reading files.
  • Comfort with a terminal for the local-running lessons.
  • To run models yourself: a computer with several gigabytes of free memory and disk space. The smallest Llama text models can run on an ordinary laptop. Large ones need serious GPUs.

You do not need a GPU to learn the concepts.

What this tutorial can and cannot run

The code boxes in your browser use plain Python with the standard library. They cannot download or run Llama, call a network or use a GPU. So this tutorial uses two kinds of code:

  • Read-only blocks show real commands and real code (Ollama, llama.cpp, Hugging Face libraries, serving tools). Copy them to your own computer.
  • Stand-in blocks are runnable, hand-written Python. Their titles start with "Stand-in:". They imitate one idea, such as building a prompt or routing a tool call. Their output is not output from a Llama model.

Other runnable boxes are ordinary Python helpers, such as memory calculators and data checks.

Here is a first stand-in. A language model repeatedly picks the next token. This toy does the same with a tiny table that was typed by hand.

Python Stand-in: predict the next word, one step at a time

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The real model works with tokens (pieces of words) rather than whole words, and its scores depend on the whole text so far. The loop of "score, pick, append" is the same idea.

Product facts change

Model names, tools and commands move quickly. Facts about specific products in this tutorial were checked against official documentation as of December 2026 where possible. Always confirm commands and license terms on the official pages before you rely on them.

A model can produce confident but wrong text. Never let output from any model decide something important without a check.

Course map

From first run to production

Basics and models Families, licenses, choosing
Run locally Ollama, llama.cpp, Python
Prompting Chat formats and outputs
1 / 3

Ways to use Llama

There are three common routes, and many teams mix them.

  • On your own computer. Good for learning, prototypes and private experiments. You download a small model and a runtime such as Ollama or llama.cpp.
  • On your own server. You rent or own a machine with a GPU and offer the model to your applications. You control the data path, and you also own the operations work.
  • Through a hosting provider. A company runs Llama for you and charges for use. You skip the hardware, but the provider's terms, data rules and model choices apply to you, in addition to the model's license.

When you compare these routes, ask where your prompts travel, who can read the logs, what happens when the service is down and whether you can keep using the same model version next year.

How to study this course

Read the lessons in order the first time, because later lessons use words from earlier ones. Run every browser box and change a value to see what happens. Then repeat the read-only commands on your own machine when you reach the local lessons. Keep a small notebook of the model name, file, settings and results for each experiment. That habit makes your comparisons trustworthy.

Using it responsibly

Think about data from the start. Do not paste customer records, passwords or company secrets into a tool until you know where that text goes and who may see it. When a model helps with a decision that affects people, keep a person responsible for checking and approving the result.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. What does 'open weights' mean?

    Open weights means you can get the parameter files. It says nothing by itself about training data or license freedom.
  2. 2. What are the runnable 'Stand-in' blocks in this tutorial?

    Browser code cannot run Llama, so stand-ins are plain Python and their output is not model output.
  3. 3. When is running Llama yourself most attractive?

    Self-hosting trades convenience for control, so it pays off when control matters.

Summary

  • Llama is Meta's family of open-weight language models.
  • Open weights is not the same as open source, and the license has conditions.
  • Self-hosting gives control and adds responsibility for hardware and safety.
  • Browser stand-ins are hand-written; real commands are read-only.

Next: How Llama Generates Text

你的学习进度保存在此浏览器中,无需账号。