Lesson 11 of 13 · Using AI well
Choosing and running a model
How to choose a model for a task without being an ML engineer: hosted API or open-weight model you run yourself, large or small, what drives cost and speed, what happens to your data, and when fine-tuning is worth it. A short decision guide and the questions to ask a vendor.
Two ways to get a model
| Hosted model (API) | Open-weight model, self-hosted | |
|---|---|---|
| Examples | The large commercial assistants' APIs, also via cloud providers | Families such as Llama, Mistral, Qwen, Gemma and others |
| Start-up effort | Minutes | Days to weeks (GPUs, serving, scaling, updates) |
| Quality | Usually the most capable models | Very good and improving; often a step behind the best |
| Cost shape | Pay per token; zero when idle | Pay for hardware whether used or not; cheap per token at high volume |
| Data | Leaves your network; governed by the contract | Stays with you |
| Operations | Provider's problem | Yours: monitoring, scaling, security patches |
Many organisations use both: hosted models for most work, a self-hosted model for sensitive data or very high volume.
It's like getting around a city. A hosted model is a taxi: no car to maintain, pay per trip, always the latest model of car, but you share the road with the company's rules. Self-hosting is owning a car: more upfront cost and maintenance, but it's yours, it goes where you say, and it's cheaper if you drive every day.
What drives cost and speed
- Tokens: cost is input tokens plus output tokens, at different prices. Long prompts (big documents, long histories) are the usual surprise. Some providers discount repeated prompt prefixes (prompt caching).
- Model size: bigger models are slower and more expensive per token. Many tasks (classification, extraction, routing, short summaries) work well on small models.
- Reasoning: models that think step by step use many extra tokens; worth it for hard problems, wasteful for easy ones.
- Latency: two numbers matter: time until the first token appears, and tokens per second after that.
Rule of thumb: start with a capable model to prove the task can be done, build a test set, then try smaller and cheaper models and keep the cheapest one that passes.
Running a model yourself, in brief
- Laptop or small server: tools such as Ollama download and run open-weight models with one command. Good for learning and private experiments.
- Production: GPU servers with a serving engine such as vLLM, behind an API, with autoscaling and monitoring. Model memory roughly equals parameters × bytes per parameter, so a 7–8 billion parameter model needs about 16 GB at 16-bit, or around 5 GB when quantised to 4-bit.
Fine-tuning: when is it worth it?
Fine-tuning trains an existing model further on your examples. Techniques such as LoRA make this much cheaper than training from scratch.
| Want | Best tool |
|---|---|
| Answers from current company documents | RAG (lesson 7) |
| Use a system or take actions | Tools and MCP (lessons 8–10) |
| A consistent output format or tone | Good prompt with examples first; fine-tune if that is not enough |
| A specialised skill at lower cost (a small model doing one job well) | Fine-tuning |
Try prompting and RAG first: they are cheaper to change and easier to inspect.
A short decision guide
- What data is involved? If it cannot leave your network → self-hosted or a provider deployment in your own cloud account and region.
- How hard is the task? Hard reasoning → a large or reasoning model. Simple and repetitive → small model.
- How much volume? Low or spiky → hosted. Very high and steady → compare self-hosting cost.
- How fast must it answer? Interactive chat needs low time-to-first-token.
- Measure on your own examples; public leaderboards are a starting point, not a decision.
Recap
- Hosted = fast start, best models, pay per token, data leaves; self-hosted = control and privacy, you run it.
- Cost and speed depend on tokens, model size and reasoning; small models are often enough.
- Quantisation lets models fit on smaller hardware.
- Prefer prompting and RAG before fine-tuning; choose by measuring on your own test set.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.