Papa Programmer
Lesson 13 of 36

Choosing a base model

9 min read

Optional

What a good starting model gives you

A Base modelAn existing trained model chosen as the starting point for additional training or adaptation. is the pre-trained model you fine-tune. It already knows language, so your examples only have to teach the specific behaviour. A model that is close to your task needs fewer examples and less training. A model that is far from it, such as a code model for a legal task, needs much more.

Size has four costs

A larger model usually scores higher, and it costs more in four places.

  • Memory. Weights take parameters times bytes per parameter, as Setting up your environment showed, and training adds more on top.
  • Training time. More weights mean more arithmetic per step.
  • Serving cost. You pay again every time the tuned model answers.
  • Speed. Larger models are slower to respond, which matters for a live product.

The cheapest model that meets your target is the right size. Many narrow tasks, such as a three-label classifier, reach a good score with a small model after fine-tuning.

Read the model card and the licence

A model card describes what the model was trained for, what data went in, how it was evaluated and what it is not good at. Read three parts:

  • Intended use and limits. Is your task in scope?
  • Languages and context length. Does it cover the languages and the input sizes you need?
  • Licence. Does it allow commercial use, changing the weights and sharing the result? Some licences restrict large companies, certain uses or the names of derived models. Datasets and libraries can carry their own terms too.

Record the model's exact revision and its tokeniser. A model name can point to different files over time.

Base or instruction-tuned

A base model continues text. An instruction-tuned model has also been trained to follow requests and often to use a chat format. For a classifier or a narrow output format, either works, and the instruction-tuned one needs fewer examples to produce a clean answer. For continued pre-training on domain text, start from a base model. Whichever you pick, use its own tokeniser and chat template.

A shortlist method

  1. Filter by facts. Remove models whose licence or size rules them out.
  2. Test the survivors. Run each on the same held-out questions with the same prompt, before any tuning. That is also your baseline from Define the task and what success means.
  3. Weigh the cost. Compare score against memory and serving cost, not score alone.
  4. Write down the choice, with the scores and the reason, so you can revisit it when a better model appears.

The program below runs steps 1 and 3 on four fictional candidates. The memory figures follow the weights-only rule from the previous Lesson, and the scores stand for results from your own test.

python
candidates = [
	{"name": "model-a", "billions": 1.5, "licence_ok": True, "score": 0.81},
	{"name": "model-b", "billions": 7, "licence_ok": True, "score": 0.89},
	{"name": "model-c", "billions": 8, "licence_ok": False, "score": 0.91},
	{"name": "model-d", "billions": 70, "licence_ok": True, "score": 0.94},
]
memory_limit_gb = 24
bytes_per_parameter = 2

for model in candidates:
	gigabytes = model["billions"] * bytes_per_parameter
	if not model["licence_ok"]:
		verdict = "out: licence"
	elif gigabytes > memory_limit_gb:
		verdict = f"out: needs {gigabytes:g} GB"
	else:
		verdict = f"keep: {gigabytes:g} GB, score {model['score']:.2f}"
	print(f"{model['name']}: {verdict}")

It prints:

text
model-a: keep: 3 GB, score 0.81
model-b: keep: 14 GB, score 0.89
model-c: out: licence
model-d: out: needs 140 GB

Model C scores well and is out because of its licence. Model D scores best and needs 140 GB for weights alone, far beyond a 24 GB card. The choice is between A and B. Model B scores 0.08 higher and needs about four times the memory of A, so the question becomes whether those eight points matter for your task. If the target is 0.85, B is the answer, and if it is 0.80, A is cheaper to train and to serve.

Leaderboards are a start

Public benchmarks measure other people's questions. They can suggest which models to test and say little about your data, your format or the errors that matter to your users. Treat a leaderboard rank as a reason to put a model on the shortlist, never as the decision.

QuestionWhere to look
Does the licence allow my use?Commercial use, modified weights, sharingThe licence text, not a summary
Will it fit?Weights plus training stateMemory arithmetic, then a short trial run
Does it know my languages?Languages and context lengthThe model card
Is it good at my task?Score on held-out questionsYour own test, not a leaderboard
Can I serve it?Cost and speed per answerA measured trial
What to check before you commit
Filter, then scoreRemove models by licence and memory first, then test the rest on your data.
Smallest that worksPick the cheapest model that meets the target on your own questions.
Read the licenceCheck commercial use and changed weights before you invest in training.

Your reading position is saved

0%

0 of 36 complete

Contents

Learning tools