AlgoViz

Reading a model card and choosing a deployment

easy 8 min

Model selection is an experiment under constraints.

Video lesson · Chapter 1 of 4

The invoice that leaves the building

0:00 / 3:57

Theory

Read or listen first. About 3 min.

What it is

Model selection is an experiment under constraints. Start with data residency, modality, license and serving limits, then compare the feasible candidates on the same held-out tasks. Hosted APIs and open-weight deployments move operational responsibilities to different places.

Why it exists

Model family names from the original course are historical examples. Record the exact model ID, evaluation date, prompt template and serving configuration. Verify availability and pricing in the linked provider documentation before using a result for a new release.

Choose a model for private scanned invoices

Invoice fixtures → Eligible candidates (define contract). Eligible candidates → Accepted results (record paired evidence)
Invoice fixtures → Eligible candidates (define contract). Eligible candidates → Accepted results (record paired evidence)

Inside this chapter

Chapter sources
GPU & Hardware Basics
An accelerator performs many multiply-add operations together. Training also stores activations, gradients and optimizer state. Serving must fit weights, temporary activations and the growing attention cache. A model that fits on a GPU for one short request can exhaust memory when several users submit long documents together.

Serving memory has a fixed part and a variable part. Weights are loaded once and shared; the attention cache grows with every token of every active sequence. That is why a model that answers one short question comfortably can fail with out-of-memory errors under real traffic. Training needs far more again, because gradients and optimiser state are stored alongside the weights.

Example. Budget a device with 16 GiB: weights use 10 GiB and workspace needs 2 GiB. Only 4 GiB remain for all active sequences and other overhead.

Another example. A team tests a document assistant with one 500-token prompt and it runs fine. In production, eight users each paste a 10,000-token contract and the cache, not the weights, is what overflows.

Where a 16 GiB device's memory goes

UseGiBGrows with
Model weights10parameter count and precision
Workspace and activations2batch and implementation
KV cache and other overhead4active users times context length
Total16
The example's budget. Long documents from several users at once can exhaust the last 4 GiB.
Reading Model Cards
A model card records intended use, evaluation conditions, training information, limitations and licensing. Before adopting a checkpoint, identify its exact revision and compare its evaluation population with your own. A high English benchmark score gives little evidence about extracting dates from scanned multilingual invoices.

A model card tells you what was measured, which is not the same as what will work for you. Read the evaluation section with your own traffic in mind: language, document quality, length, format. Wherever they differ, add cases to your own acceptance set. The card for a given revision is the reference; a later revision under the same name may change behaviour.

Example. A card evaluates clean English pages. Add ten rotated Spanish scans to your own acceptance set before relying on it for a multilingual invoice service.

Another example. A card reports strong results on clean English text. An insurer processing faxed claim forms in Portuguese adds twenty faxed Portuguese forms to its acceptance set before trusting it.

What to pull from a model card

  • Exact revision

    Which checkpoint the claims describe. Pin it.

  • Intended use

    The tasks and users the authors had in mind.

  • Evaluation conditions

    Languages, data and metrics. Compare with your traffic.

  • Limitations

    Known failure modes worth testing first.

  • Licence

    What you may deploy, modify or redistribute.

OpenAI model families
The GPT-4o and GPT-5 families are examples of hosted model offerings from OpenAI. Treat each available model ID as a separate deployment candidate. Test your exact input modalities, output contract and latency distribution against that ID, and keep the tested identifier with results so a future substitution can be evaluated.

Hosted providers ship many model IDs under one family name, and they differ in behaviour, supported inputs, tools and latency. Treat each ID as its own candidate. Keep a frozen fixture (inputs plus expected outputs) and the exact ID it was run against, so swapping IDs is a measured change rather than a silent one.

Example. Pin one hosted model ID and its prompt. Re-run a frozen extraction fixture when changing the ID, even if the product family name stays familiar.

Lifecycle of a pinned model ID

A familiar family name is not a substitute for re-running the fixture.
Anthropic model families
Claude 3.7 and Claude 4 illustrate why provider and model family are insufficient identifiers for an experiment. Prompt structure, tools and available reasoning controls depend on the model and endpoint. Measure extraction fidelity and time to the first usable answer on your own cases before choosing configuration settings.

Behaviour depends on the full configuration: model ID, system prompt, tool definitions and any reasoning controls the endpoint offers. A family-level impression tells you little about how your configuration handles an edge case. Build edge cases such as missing fields into the evaluation set and record time to first usable answer alongside accuracy.

Example. Use a support ticket with a missing field. Check whether the selected Claude endpoint abstains under the exact prompt and tool configuration you intend to ship.

Does the configuration abstain when it should?

Test the configuration you will ship, not the family name.
Google model families
Gemini 2.5 Pro is an example of a model used with text and other modalities. A document service should compare passing a page image with passing extracted text, checking table alignment and citation accuracy separately. Record the exact input representation, model revision and token usage beside each evaluation.

Multimodal models let you choose the representation: send the page image and let the model read layout, or extract text first and send that. OCR flattening can lose which number sat in which column, while image input costs different token amounts and may miss small print. Measure both on the same documents, and record the representation and token usage with each result.

Example. Give the same two-column invoice as an image and as OCR text. Count cases where the model assigns a correct amount to the wrong column.

Another example. An expense tool compares receipt photos with OCR text. OCR wins on long receipts with clean print; images win on receipts where the tip and total sit side by side.

Same invoice, two input representations

Grade column alignment and citation separately for each representation.
Meta Llama deployments
Open-weight Llama deployments shift some responsibility to the operator. Review the model card and license, choose a compatible inference stack, budget memory for the weights and cache, and test the prompt template. A hosted endpoint and a locally quantized checkpoint can behave differently despite sharing a family name.

A hosted endpoint hides tokenisation, templating, batching and hardware. Self-hosting hands them to you, and every one can change results. The most common quiet failure is the chat template: concatenating messages as plain text instead of using the checkpoint's role markers degrades instruction following even though nothing errors. A quantised local copy can also behave differently from the provider's version of the same family.

Example. Run the same question through the checkpoint’s recommended chat template and a plain text concatenation. A quality difference implicates input serialization.

What the operator now owns
  1. 1Licence and cardread terms for this checkpoint
  2. 2Inference stackengine that supports the format
  3. 3Memory budgetweights plus cache at target load
  4. 4Chat templatethe checkpoint's own format
  5. 5Evaluationsame fixture as the hosted option

With open weights, each of these is your job rather than the provider's.

Mistral & DeepSeek
Mistral and DeepSeek each publish distinct models with different architectures, deployment options and terms. For open-weight candidates, inspect the individual checkpoint, tokenizer and serving requirements. Compare quality per completed task on the same workload. Advertised parameter counts alone cannot predict latency or operating cost.

Two models with similar headline sizes can have very different serving costs: a mixture-of-experts model activates only part of its weights per token but still needs memory for all of them, and different attention designs change cache size. Compare complete cost per accepted task, including the engineers who keep a self-served model running.

Example. Compare a hosted endpoint with a self-served checkpoint on identical prompts. Include operator time and the hardware needed for the required concurrency.

Costs that a parameter count does not show

FactorHosted endpointSelf-served checkpoint
Per-call priceprovider's ratenone, but hardware is yours
Hardware for peak concurrencyprovider'syou buy or rent it
Operator timelowupgrades, monitoring, on-call
Latency controllimitedfull, if you tune it
Quality per completed taskmeasuremeasure on the same prompts
Compare on the same workload; architecture and serving stack drive cost more than headline size.
The "Right Tool" Matrix
A selection matrix separates hard constraints from trade-offs. Eliminate candidates that cannot meet data residency, modality or context requirements. Compare the survivors on task success, tail latency and cost per accepted result. A cheaper call may cost more overall when it requires retries or manual correction.

Build the matrix in two passes. First the hard constraints: residency, modality, context length, licence. A candidate that fails any of these is out, however well it scores. Then compare survivors on task success, tail latency and cost per accepted result, counting retries and human correction. A model that is cheap per call but needs frequent fixes often loses.

Example. Provider A costs 10 cents for ten attempts with five accepted; B costs 12 cents with eight accepted. B costs less per accepted task.

Cheaper per call, dearer per result

CA=10 cents5 accepted=2 centsCB=12 cents8 accepted=1.5 centsC_A=\frac{10\text{ cents}}{5\text{ accepted}}=2\text{ cents}\qquad C_B=\frac{12\text{ cents}}{8\text{ accepted}}=1.5\text{ cents}
B costs more per attempt but less per accepted task.

How it works

Step through the idea, or press Play.

Step 1 of 3

Invoice fixtures. 100 consented pages

Understand it

Worked example

Choose a model for private scanned invoices

  1. 1

    100 consented pages

    Include rotated scans, handwritten corrections and missing totals. Keep each source document in a single split and define field-level acceptance.

  2. 2

    2 satisfy residency

    First apply modality, deployment, licensing and residency requirements. Run the survivors on the same pages with the intended preprocessing.

  3. 3

    A 92/100 · B 97/100

    In this example B recovers five additional invoices. Compare latency and cost per accepted invoice, and inspect the failures before locking an exact model revision.

Cost per accepted result

Caccepted=CtotalNacceptedC_{\mathrm{accepted}}=\frac{C_{\mathrm{total}}}{N_{\mathrm{accepted}}}
If 100 jobs cost 12 dollars and 80 pass the acceptance check, the cost is 15 cents per accepted result. Include retry costs in the numerator and count accepted jobs once.

Follow the handoffs

Model family names from the original course are historical examples. Record the exact model ID, evaluation date, prompt template and serving configuration. Verify availability and pricing in the linked provider documentation before using a result for a new release.

Filtering before scoring

Hard constraints remove candidates; only survivors get scored.

Cost per accepted invoice

CandidateAccepted of 100Cost for 100 pagesCost per accepted
A92$1213.0 cents
B97$1212.4 cents
Illustrative equal costs to show the formula. Use your measured costs, including retries.

Summary

The whole topic in one minute.

A hard deployment requirement defines feasibility. Only feasible candidates belong in the quality and cost trade-off.

Model family names from the original course are historical examples. Record the exact model ID, evaluation date, prompt template and serving configuration. Verify availability and pricing in the linked provider documentation before using a result for a new release.

Sources