सामग्री पर जाएँ

लेसन 5 · Models and Licenses

Choosing a Llama Model

Pick a Llama model by task, hardware, language, license and quality. Build a small test set and score candidates instead of guessing from model size.

The best model is not the biggest one. It is the smallest one that does your job well enough, fits your hardware and has a license you can accept. This lesson gives you a repeatable way to choose.

Start from the task

Write one sentence that describes the job, for example "sort support emails into five categories" or "answer questions from our product manual in German". Then ask:

  1. Does it need images? If yes, you need a multimodal model, and you must check the EU restriction in the license lesson.
  2. Which languages matter? Compare them with the supported list on the model card.
  3. How long is the input? A whole contract needs a far bigger context than a short email.
  4. Does it need tool calling? Check that the model and your serving software support it.
  5. How fast must it reply, and for how many users?

Hardware narrows the list

Memory decides what is possible. A rough weight-size estimate is parameters × bits per weight ÷ 8 bytes. The context and runtime need extra memory on top. The memory lesson does this properly.

Python Which sizes fit? A first-pass filter

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 value 4.9 stands for a typical "4-bit" file, which uses a little more than 4 bits per weight. These results are estimates. Always try the real file.

A simple decision guide

Situation Reasonable first candidate
Learning, simple tasks on a laptop A 1B or 3B instruct model
General assistant with a good local machine An 8B instruct model
High quality on a strong GPU server A 70B instruct model
Image input, large hardware, license allows it A multimodal model

This table only gives a starting point. Smaller models often struggle with multi-step reasoning, long instructions and less common languages. Also compare with other open-weight families. The skills in this tutorial transfer.

Test on your own examples

Public benchmarks measure general skills, and models may have seen benchmark data during training. See benchmarks and contamination. Your own test set is more useful:

  • 20 to 50 real examples to start with (remove private data first),
  • the expected answer or a checklist for each,
  • a few hard and unusual cases, including requests the system should refuse.

Run every candidate on the same set with the same prompt. Score automatically where you can, and read some answers by hand.

Python Stand-in: compare two candidates on a test set

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 two scoring rules rank the candidates differently. Decide what your program can accept before you compare, or you may tune the rule to favor a model.

Record cost and speed too

For each candidate, note memory use, time to first token, tokens per second and quality. A slightly weaker model that is several times faster may serve users better. Pin the exact file or revision you tested, so that you can reproduce the result later.

Candidate Score on test set Memory used First token Tokens per second License checked
(your model 1)
(your model 2)

Fill this table from your own measurements. An empty cell is a reminder that you have not checked that point yet.

Revisit the choice

Your choice is not permanent. New models and new quantized files appear, your task may change and your user load may grow. Keep the test set and the scoring script, so that testing a new candidate takes an hour instead of a week. Switch only when the new candidate wins on your measures and its license works for you.

A worked example

Suppose you want to sort support messages for a small shop, in English and Spanish, on one office computer. The task is narrow, the replies are one word and speed matters little. That suggests starting with a small instruct model, checking that Spanish is in the supported list on its card, writing a short test set in both languages and only then trying a larger model if the small one fails.

Now suppose the same shop wants answers to open questions from long manuals. The input is much longer, wrong answers are more costly and you need citations. Here you need more context, a retrieval step and stronger evaluation. The model choice depends on the whole system, not only on the weights.

When no candidate passes

If no model reaches your quality bar, do not immediately jump to the largest one. First improve the prompt, add examples, supply better context or split the task. Consider whether a rule, a database query or a human should handle part of the job. A model is one component, and some steps are better done by ordinary code.

Write the decision down

End with a few sentences that anyone on your team can read: the model and file you chose, the alternatives you tested, the scores, the hardware, the license review and the main known weakness. This note explains the choice later and shows what must be true for it to remain a good one.

One more caution. Compare candidates at the settings you will really use, including the quantized file and context size.

Common mistakes

Do not pick a model from one impressive demo prompt. Test typical, hard and hostile inputs, and repeat the test after every change of model, quantization or prompt.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. What is a good goal when choosing a model?

    Smaller models are cheaper and faster, as long as they pass your tests.
  2. 2. What is the rough size of model weights in bytes?

    That covers the weights only. Context and runtime need more.
  3. 3. Why build your own test set?

    Your examples reflect your language, format and edge cases.

Summary

  • Define the task, languages, input length, speed and image needs first.
  • Estimate memory, then confirm with the real file.
  • Compare candidates on your own test set with a fixed scoring rule.
  • Record the exact version, quality, memory and speed.

Next: Run Llama with Ollama

आपकी प्रगति इसी ब्राउज़र में सेव होती है। खाते की ज़रूरत नहीं है।