Lompat ke konten

Pelajaran 24 ยท Projects and Reference

Llama Glossary and Cheat Sheet

A quick reference for Llama terms, model facts, local commands, prompt tokens, memory formulas and a launch checklist, checked as of December 2026.

Use this page as a quick reference after the course. Product facts come from official documentation checked as of December 2026. Tools change quickly, so confirm anything important on the official pages.

Glossary

Term Meaning
Adapter Small trained files, for example from LoRA, used with a base model
Base model Pretrained model that continues text
Chat template Rules that turn role messages into the model's token format
Context window Maximum number of tokens the model can see at once
Embedding A vector that represents the meaning of text
Fine-tuning Continued training on your own examples
GGUF Model file format used by llama.cpp
Hallucination Confident output that is untrue or unsupported
Instruct model Model trained to follow instructions in chat
KV cache Stored attention keys and values for earlier tokens
LoRA / QLoRA Low-rank adapter training; QLoRA also uses a 4-bit base
MoE Mixture of experts: many parameters, only some active per token
Open weights Downloadable parameters, which is not the same as open source
Prompt injection Untrusted text that tries to override instructions
Quantization Storing numbers with fewer bits
RAG Retrieval-augmented generation
Token A piece of text that the model reads and writes
TTFT Time to first token

Models

Llama 3.x text sizes

1B and 3B Llama 3.2
8B, 70B, 405B Llama 3.1
70B Llama 3.3
1 / 2

Commands

Terminal
# Ollama
ollama pull llama3.2:3b
ollama run llama3.2:3b
ollama ls
ollama ps
ollama create my-helper -f Modelfile

# llama.cpp
llama-server -m model.gguf -c 8192 -ngl 99 --host 127.0.0.1 --port 8081
llama-quantize in-f16.gguf out-Q4_K_M.gguf Q4_K_M

# Hugging Face (after you have access)
hf auth login
hf download meta-llama/Llama-3.2-1B-Instruct --local-dir ./llama-1b

# vLLM
vllm serve meta-llama/Llama-3.2-3B-Instruct --host 127.0.0.1 --port 8000

Endpoints

Task Ollama native OpenAI style
Chat POST /api/chat /v1/chat/completions
Embeddings POST /api/embed /v1/embeddings (where supported)

Ollama listens on 127.0.0.1:11434 by default.

Prompt tokens

Purpose Llama 3.x Llama 4
Start of prompt <|begin_of_text|> <|begin_of_text|>
Role header start <|start_header_id|> <|header_start|>
Role header end <|end_header_id|> <|header_end|>
End of turn <|eot_id|> <|eot|>

Prefer the official chat template over typing these.

Memory formulas

  • Weights (GB): parameters in billions ร— bits per weight รท 8.
  • KV cache (bytes): 2 ร— layers ร— tokens ร— KV heads ร— head size ร— bytes per value ร— sequences.
  • Add runtime overhead and leave headroom.

A quick calculator

Python Memory cheat calculator

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.

Launch checklist

  • License and use policy for the exact model version read, and attribution handled.
  • Naming rule applied if you distribute a model built with Llama.
  • Model file source and revision pinned, in a safe format.
  • Chat template and stop tokens verified.
  • Context size set on purpose, and memory tested under load.
  • Test set passed on the final artifact in the final runtime.
  • Input and output checks, tool permissions and human approval in place.
  • Server not exposed without authentication, with limits and timeouts set.
  • Logging and retention decided with privacy in mind.
  • Monitoring and rollback ready.

Quick troubleshooting

Symptom First check
Long text is forgotten Context size actually allocated
Bot writes the user's lines Chat template and stop tokens
Very slow replies GPU placement and model size
Out of memory Context, parallel requests, quantization
Tool call shown as text Server parser, flags and template
Gated download error License access and hf auth login

Where to look for current facts

  • Meta's official llama-models repository and Llama documentation: licenses, model cards, prompt formats.
  • The official meta-llama pages on Hugging Face: access and model cards.
  • The documentation of Ollama, llama.cpp, vLLM, TRL and PEFT: commands and settings.

Keep learning

Review the Large Language Models tutorial for theory, Prompt Engineering for better prompts and AI Agents for systems that use tools.

Choosing quickly

Your goal Start here
Try Llama today Ollama with a small instruct model
Control files and flags llama.cpp
Write Python research code Transformers
Answer from your documents Retrieval
Call your own functions Tool calling
Change behavior with examples Fine-tuning
Offer it to many users Serving and safety

Habits worth keeping

Write down the model file and revision for every experiment. Keep one test set and rerun it after any change. Treat model output and retrieved text as untrusted. Give the model the fewest permissions that let it do the job, and keep a person in charge of actions that are hard to undo.

A final word on dates

This sheet reflects what was checked in December 2026. If a command fails or a limit looks different, trust the current official documentation over this page, and update your own notes with the date you checked.

How to use the checklist

Treat the launch checklist as a conversation, not a box-ticking exercise. For each line, name the person responsible and point to the evidence: the saved license text, the test report, the load test result or the rollback instructions. If you cannot show evidence, the item is not done. Some items never end. Monitoring, license review and safety testing continue after launch, and they start again whenever you change the model, the quantization, the template, the runtime or the main prompt.

Common mix-ups

  • Context window and memory: a model's maximum context is not what your runtime has allocated.
  • Total and active parameters: mixture-of-experts names can show the smaller active number.
  • Open weights and open source: downloading the weights does not remove license conditions.
  • Retrieval and fine-tuning: retrieval supplies facts at request time, while fine-tuning changes behavior through training.
  • Valid format and correct answer: a reply can match a JSON schema and still be wrong.
  • A safety filter and safety: a filter is one layer, and permissions and human review matter at least as much.

Practice idea. Without looking back, explain five glossary terms aloud in your own words, then compare them with the table. Reopen the lesson behind any term that felt unclear, and run its browser example again with different values.

Check your understanding

Quick check ยท 3 questions

of 3 answered You scored / 3 ยท perfect!

  1. 1. Which endpoint does Ollama's native API use for embeddings?

    POST /api/embed returns one vector for each input.
  2. 2. Which pair of markers belongs to Llama 4 role headers?

    Llama 4 uses the header_start and header_end tokens.
  3. 3. What should you confirm before shipping?

    Shipping needs legal, quality, safety and operational checks.

Summary

  • Keep terms, model facts and commands close at hand.
  • Use official templates, set the context on purpose and estimate memory.
  • Work through the checklist before you ship.

Next: Back to the Llama tutorial

Progres Anda disimpan di browser ini. Tidak perlu akun.