{"course":{"slug":"building-with-ai","title":"Building with AI","url":"https://addaly.com/learn/building-with-ai","level":"intermediate","track":"build"},"lesson":{"slug":"choosing-a-model","title":"Choosing a model, and designing so you can change your mind","url":"https://addaly.com/learn/building-with-ai/choosing-a-model","position":8,"of":80,"minutes":9,"answer":"Compare models and cascades on task-specific quality, measured total cost and latency, with provider-specific handling behind a narrow interface.","keyIdea":"Compare models and cascades on task-specific quality, measured total cost and latency, with provider-specific handling behind a narrow interface."},"body":{"format":"markdown","text":"## The tiers, and the price gap between them\n\nProviders offer models with different capabilities, prices and latency. Compare candidates on the task you need to perform, using current rates for input, output, cached input and any separately billed features.\n\nA small model may be suitable for a bounded classification task. A more capable model may justify its extra cost on a difficult reasoning or coding task. Those are hypotheses to test on your own inputs, rather than guarantees associated with a model tier. [Model selection](https://platform.claude.com/docs/en/about-claude/models/choosing-a-model).\n\n## Benchmarks will not tell you which to use\n\nPublished scores measure performance on their test sets. They provide context, while your application also needs representative evaluation. Three reasons a ranking may not transfer are:\n\n**Contamination risk.** If benchmark material entered training, the score may overstate performance on new cases. Check what the benchmark and model authors disclose.\n\n**Distribution mismatch.** Your inputs are customer messages with typos in three languages, or scanned invoices from one supplier, or your own product's jargon. Nothing in a reasoning benchmark resembles that.\n\n**The metric is not your metric.** A benchmark rewards the right final answer. Your feature might need to refuse when unsure, cite a source, keep to a format, and finish in 800 milliseconds. A model can win on the first and lose badly on the rest.\n\nStart with a small set of your own cases with known correct answers, then expand it to cover difficult and costly failures. Twenty cases can be an initial comparison, but they do not establish a reliable production error rate. Record cost and latency alongside task-specific quality.\n\n## Route, do not choose\n\nOne design to test is a lower-cost model first, followed by escalation when application checks require it. Compare the cascade with sending requests directly to each candidate.\n\nThe following design sketch assumes `small`, `frontier` and your task-specific `passes_checks` are defined by the application.\n\n```python\ndef answer(q, docs):\n    draft = small(q, docs)\n    if passes_checks(draft, docs):\n        return draft\n    return frontier(q, docs)\n```\n\n`passes_checks()` needs tests for the task. Schema validation checks structure. A retrieval score checks a property of retrieval. A matching quote establishes that text occurs in a source. None alone establishes that an answer is correct. Evaluate their combined false accepts and false rejects against labeled cases, then measure the actual escalation rate.\n\nAccount for both stages when measuring a cascade. Every request pays for the initial attempt, and escalated requests add another model call. Compare total cost, latency and error consequences under the measured traffic mix.\n\n> Figure: A hypothetical 60-fold price gap. Bars (dollars per 1,000 requests): Small model on everything 1; Cheap first, 20% escalates 13; Frontier model on everything 60. One thousand requests, each with 2,000 input and 400 output tokens. Illustrative small-model rates are $0.25 input and $1.25 output per million tokens, versus $15 and $75 for the frontier model. The cascade runs all 1,000 small-model calls and escalates 200, totaling $13. No extra router charge is assumed.\n\n## Open weights are a real option\n\nOpen-weight models can be candidates for hosted or self-managed inference. Evaluate the particular model, license, runtime and task. You can use a hosted endpoint, run a model on your own machine, or operate a server.\n\nLocal inference avoids a per-call provider bill but still consumes hardware, power and maintenance. Hosted compatibility layers can simplify request formats, while model features and response semantics still need checking. Keep a tested fallback that meets your operational and access requirements.\n\n## Design for replacement\n\nModel availability and behavior change. Isolate provider-specific request and response handling behind an interface. This design sketch leaves the application's `Completion` type and provider adapters to define:\n\n```python\nclass LLM(Protocol):\n    def complete(\n        self,\n        system: str,\n        messages: list,\n        *,\n        tools=None,\n        max_tokens=1024,\n        temperature: float | None = None,\n    ) -> Completion: ...\n```\n\nUse one adapter per provider and omit unsupported optional fields. Re-run prompts, retrieval checks, validation and evaluations when switching models. A gateway is another integration option, with its own privacy, routing and feature-support requirements.\n\nA narrow adapter can reduce the implementation work of a model change. A reviewed evaluation set still determines whether that change is acceptable."},"check":{"question":"A team wants to test whether a lower-cost cascade can reduce spend while preserving its support-reply quality target. Which experiment is most informative?","options":[{"text":"Send every request to the small model and accept a slightly lower quality bar.","correct":false,"tempting":"Trades quality uniformly, including on the hard minority of cases where the small model fails badly and the cost of being wrong is highest."},{"text":"Evaluate a small-model-first cascade on labeled cases, measure checks and escalation failures, and compare its total cost and quality with direct model calls.","correct":true},{"text":"Reduce max_tokens so answers are shorter.","correct":false,"tempting":"Saves on the output side only, and risks truncation; on retrieval-heavy features input tokens usually dominate the bill."},{"text":"Ask the model to rate its own confidence and re-ask the frontier model when the rating is low.","correct":false,"tempting":"Uses a self-report as a gate, but stated confidence is generated the same way as the rest of the text and is not calibrated to correctness."}]},"prev":{"slug":"retries-that-do-not-make-it-worse","title":"Errors, retries, and how a retry loop takes down your own service","url":"https://addaly.com/learn/building-with-ai/retries-that-do-not-make-it-worse"},"next":{"slug":"a-model-on-your-own-machine","title":"Running a model on a laptop with no GPU","url":"https://addaly.com/learn/building-with-ai/a-model-on-your-own-machine"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Choosing a model, and designing so you can change your mind', in Building with AI. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/building-with-ai/choosing-a-model (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Choosing a model, and designing so you can change your mind","courseTitle":"Building with AI","module":{"index":1,"slug":"the-call-underneath-everything","title":"The call underneath everything"},"answer":null,"keyIdea":"Compare models and cascades on task-specific quality, measured total cost and latency, with provider-specific handling behind a narrow interface.","hero":{"kind":"figure","figure":{"t":"figure","label":"Figure","figure":{"type":"bars","title":"A hypothetical 60-fold price gap","caption":"One thousand requests, each with 2,000 input and 400 output tokens. Illustrative small-model rates are $0.25 input and $1.25 output per million tokens, versus $15 and $75 for the frontier model. The cascade runs all 1,000 small-model calls and escalates 200, totaling $13. No extra router charge is assumed.","unit":"dollars per 1,000 requests","series":[{"label":"Small model on everything","value":1},{"label":"Cheap first, 20% escalates","value":13,"highlight":true},{"label":"Frontier model on everything","value":60}]},"alt":"Figure: A hypothetical 60-fold price gap. Bars (dollars per 1,000 requests): Small model on everything 1; Cheap first, 20% escalates 13; Frontier model on everything 60. One thousand requests, each with 2,000 input and 400 output tokens. Illustrative small-model rates are $0.25 input and $1.25 output per million tokens, versus $15 and $75 for the frontier model. The cascade runs all 1,000 small-model calls and escalates 200, totaling $13. No extra router charge is assumed."}},"blocks":[{"t":"h2","id":"the-tiers-and-the-price-gap-between-them","runs":[{"text":"The tiers, and the price gap between them"}]},{"t":"p","runs":[{"text":"Providers offer models with different capabilities, prices and latency. Compare candidates on the task you need to perform, using current rates for input, output, cached input and any separately billed features."}]},{"t":"p","runs":[{"text":"A small model may be suitable for a bounded classification task. A more capable model may justify its extra cost on a difficult reasoning or coding task. Those are hypotheses to test on your own inputs, rather than guarantees associated with a model tier. "},{"text":"Model selection","href":"https://platform.claude.com/docs/en/about-claude/models/choosing-a-model"},{"text":"."}]},{"t":"h2","id":"benchmarks-will-not-tell-you-which-to-use","runs":[{"text":"Benchmarks will not tell you which to use"}]},{"t":"p","runs":[{"text":"Published scores measure performance on their test sets. They provide context, while your application also needs representative evaluation. Three reasons a ranking may not transfer are:"}]},{"t":"p","runs":[{"text":"Contamination risk.","b":true},{"text":" If benchmark material entered training, the score may overstate performance on new cases. Check what the benchmark and model authors disclose."}]},{"t":"p","runs":[{"text":"Distribution mismatch.","b":true},{"text":" Your inputs are customer messages with typos in three languages, or scanned invoices from one supplier, or your own product’s jargon. Nothing in a reasoning benchmark resembles that."}]},{"t":"p","runs":[{"text":"The metric is not your metric.","b":true},{"text":" A benchmark rewards the right final answer. Your feature might need to refuse when unsure, cite a source, keep to a format, and finish in 800 milliseconds. A model can win on the first and lose badly on the rest."}]},{"t":"p","runs":[{"text":"Start with a small set of your own cases with known correct answers, then expand it to cover difficult and costly failures. Twenty cases can be an initial comparison, but they do not establish a reliable production error rate. Record cost and latency alongside task-specific quality."}]},{"t":"h2","id":"route-do-not-choose","runs":[{"text":"Route, do not choose"}]},{"t":"p","runs":[{"text":"One design to test is a lower-cost model first, followed by escalation when application checks require it. Compare the cascade with sending requests directly to each candidate."}]},{"t":"p","runs":[{"text":"The following design sketch assumes "},{"text":"small","code":true},{"text":", "},{"text":"frontier","code":true},{"text":" and your task-specific "},{"text":"passes_checks","code":true},{"text":" are defined by the application."}]},{"t":"code","lang":"python","label":"Python","text":"def answer(q, docs):\n    draft = small(q, docs)\n    if passes_checks(draft, docs):\n        return draft\n    return frontier(q, docs)"},{"t":"p","runs":[{"text":"passes_checks()","code":true},{"text":" needs tests for the task. Schema validation checks structure. A retrieval score checks a property of retrieval. A matching quote establishes that text occurs in a source. None alone establishes that an answer is correct. Evaluate their combined false accepts and false rejects against labeled cases, then measure the actual escalation rate."}]},{"t":"p","runs":[{"text":"Account for both stages when measuring a cascade. Every request pays for the initial attempt, and escalated requests add another model call. Compare total cost, latency and error consequences under the measured traffic mix."}]},{"t":"h2","id":"open-weights-are-a-real-option","runs":[{"text":"Open weights are a real option"}]},{"t":"p","runs":[{"text":"Open-weight models can be candidates for hosted or self-managed inference. Evaluate the particular model, license, runtime and task. You can use a hosted endpoint, run a model on your own machine, or operate a server."}]},{"t":"p","runs":[{"text":"Local inference avoids a per-call provider bill but still consumes hardware, power and maintenance. Hosted compatibility layers can simplify request formats, while model features and response semantics still need checking. Keep a tested fallback that meets your operational and access requirements."}]},{"t":"h2","id":"design-for-replacement","runs":[{"text":"Design for replacement"}]},{"t":"p","runs":[{"text":"Model availability and behavior change. Isolate provider-specific request and response handling behind an interface. This design sketch leaves the application’s "},{"text":"Completion","code":true},{"text":" type and provider adapters to define:"}]},{"t":"code","lang":"python","label":"Python","text":"class LLM(Protocol):\n    def complete(\n        self,\n        system: str,\n        messages: list,\n        *,\n        tools=None,\n        max_tokens=1024,\n        temperature: float | None = None,\n    ) -> Completion: ..."},{"t":"p","runs":[{"text":"Use one adapter per provider and omit unsupported optional fields. Re-run prompts, retrieval checks, validation and evaluations when switching models. A gateway is another integration option, with its own privacy, routing and feature-support requirements."}]},{"t":"p","runs":[{"text":"A narrow adapter can reduce the implementation work of a model change. A reviewed evaluation set still determines whether that change is acceptable."}]}],"check":{"question":[{"text":"A team wants to test whether a lower-cost cascade can reduce spend while preserving its support-reply quality target. Which experiment is most informative?"}],"options":[{"text":[{"text":"Send every request to the small model and accept a slightly lower quality bar."}],"correct":false,"tempting":[{"text":"Trades quality uniformly, including on the hard minority of cases where the small model fails badly and the cost of being wrong is highest."}]},{"text":[{"text":"Evaluate a small-model-first cascade on labeled cases, measure checks and escalation failures, and compare its total cost and quality with direct model calls."}],"correct":true,"tempting":null},{"text":[{"text":"Reduce max_tokens so answers are shorter."}],"correct":false,"tempting":[{"text":"Saves on the output side only, and risks truncation; on retrieval-heavy features input tokens usually dominate the bill."}]},{"text":[{"text":"Ask the model to rate its own confidence and re-ask the frontier model when the rating is low."}],"correct":false,"tempting":[{"text":"Uses a self-report as a gate, but stated confidence is generated the same way as the rest of the text and is not calibrated to correctness."}]}],"order":[3,1,0,2],"why":null},"prev":{"slug":"retries-that-do-not-make-it-worse","title":"Errors, retries, and how a retry loop takes down your own service","minutes":9},"next":{"slug":"a-model-on-your-own-machine","title":"Running a model on a laptop with no GPU","minutes":10}}}