Sub topic 17
A checklist for making and revisiting the choice
This chapter assumes you have read the earlier chapters. You should know the difference between hosted APIs and open-weight models, how parameter count affects memory and speed, how token prices turn into monthly cost, and how to score models on your own examples. Here you combine those pieces into one repeatable process.
The decision process
The goal is the smallest model that meets your requirements. Smaller models cost less, respond faster, and need less hardware. Move up in size only when your evaluation shows you must.
The checklist
Work through these steps in order and write down each answer.
- Define the task. Describe the input, the output, and what a wrong answer costs. Note the typical prompt length so you can check it against the context window.
- Set hard limits. List constraints that rule options out: data that cannot leave your network, a latency target, a monthly budget, or a license that forbids your use.
- Shortlist candidates. Include at least one hosted model and, if your limits allow it, one open-weight model. Add a small and a large size from each family.
- Estimate cost and memory. For hosted models, use
request_costwith your real token counts. For open-weight models, useweight_memory_gb, then add room for the KV cache and runtime overhead. - Score on your own examples. Run the same cases against every candidate with
pass_rate. Include a few hard and unusual inputs, not only typical ones. - Pick the smallest model that passes. If two models both meet your quality bar, choose the cheaper or faster one.
- Keep it swappable. Read the endpoint, key, and model name from environment variables so a change needs no code edits.
- Record the decision. Save the model name and version, the eval score, the price or hardware cost, and the date.
def weight_memory_gb(params_billion: float, bits_per_weight: int) -> float:
return params_billion * bits_per_weight / 8
def request_cost(input_tokens, output_tokens, price_in, price_out):
return (input_tokens / 1_000_000) * price_in + (output_tokens / 1_000_000) * price_out
# Placeholder numbers for illustration
print(f"Hosted: ${request_cost(2_000, 300, 1.00, 4.00) * 50_000:.2f} per month")
print(f"Local 7B at 4-bit: {weight_memory_gb(7, 4):.1f} GB for weights alone")Revisiting the choice
A choice is only good for the conditions it was made under. Schedule a review, and also trigger one when any of these happen:
| Trigger | What to do |
|---|---|
| Provider changes price or retires a model | Re-estimate cost and rerun your eval on the replacement |
| A new model or size is released | Add it to the shortlist and score it |
| Your traffic or prompt length grows | Recompute monthly cost and check the context window |
| Quality complaints appear | Add the failing inputs to your eval set, then rescore |
| Your data or compliance rules change | Recheck your hard limits |
Exercise
Your eval shows a 7B model passes 92% of your cases and a 70B model passes 94%. Your requirement is 90%. Which do you choose, and what makes you reconsider later?
Show answer
Choose the 7B model, because it meets the 90% requirement and is smaller, cheaper, and faster. Reconsider if the requirement rises, if failures appear that your eval set missed, or if a new model or price change shifts the comparison.
Exercise
Name two of the hard limits from step 2 that could remove a candidate before you run any evaluation.
Show answer
Any two of: data that must not leave your network (rules out hosted APIs), a license that forbids your use, a memory limit that the model's weights cannot fit, a latency target the model cannot meet, or a budget the estimated cost exceeds.